Skip to content

Instantly share code, notes, and snippets.

@MBcode
Created November 15, 2022 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MBcode/87b31a44effdec0a8a15d3a8316a9b41 to your computer and use it in GitHub Desktop.
Save MBcode/87b31a44effdec0a8a15d3a8316a9b41 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "43a58753",
"metadata": {
"papermill": {},
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"#github.com/nteract/papermill'parameters'tag used to inject them into template then post a gist runable by colab\n",
"url,ext,urn=None,None,None\n",
"%load_ext rpy2.ipython\n",
"%load_ext google.colab.data_table\n",
"import httpimport\n",
"with httpimport.github_repo('earthcube', 'earthcube_utilities'):\n",
" import earthcube_utilities as ec\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8fa1b3ac",
"metadata": {
"tags": [
"injected-parameters"
]
},
"outputs": [],
"source": [
"# Parameters\n",
"url = \"https://ecl.earthchem.org/view.php?id=839\"\n",
"ext = \"application/vnd.ms-excel\"\n",
"urn = \"urn:gleaner:summoned:earthchem:fd8e38eb03f8be290ef91f349a20287348f1b317\"\n",
"q = None\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "53c94ce5",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"ec.wget_rdf(urn)\n",
"#!ls -l or FilePaneBrowser on left, to see it\n",
"df=ec.read_file(url,ext)\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "3675429d",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"!ls -l "
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "1ca27b07",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"ec.viz() #shows .nt metadata from urn, can use for (rdf)xml as well "
]
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"papermill": {
"default_parameters": {},
"environment_variables": {},
"input_path": "/app/templates/template.ipynb",
"output_path": "/tmp/https:ecl.earthchem.orgview.phpid=839.ipynb",
"parameters": {
"ext": "application/vnd.ms-excel",
"q": null,
"url": "https://ecl.earthchem.org/view.php?id=839",
"urn": "urn:gleaner:summoned:earthchem:fd8e38eb03f8be290ef91f349a20287348f1b317"
},
"version": "2.4.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment