Created
April 4, 2022 19:44
-
-
Save smrgeoinfo/8d0d3afdac9a68b8e0a1044d99aa39b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "e449a6c3", | |
"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", | |
"q=None\n", | |
"q=\"norway\"" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "11d060ed", | |
"metadata": { | |
"tags": [ | |
"injected-parameters" | |
] | |
}, | |
"outputs": [], | |
"source": [ | |
"# Parameters\n", | |
"url = None\n", | |
"ext = None\n", | |
"urn = None\n", | |
"q = \"OGC\"\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "252f682f", | |
"metadata": { | |
"papermill": {}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"%load_ext rpy2.ipython\n", | |
"%load_ext google.colab.data_table\n", | |
"import httpimport\n", | |
"with httpimport.github_repo('MBcode', 'ec'):\n", | |
" import ec\n", | |
"#ec.get_ec() #work from scratch version for a bit\n", | |
"#import ec\n", | |
"df=ec.txt_query(q)\n", | |
"df" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "4db29d2d", | |
"metadata": { | |
"papermill": {}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"#1st-cut:will have to cut&paste into vars, from Row of interest:\n", | |
"urn=None\n", | |
"dfR=ec.wget_rdf(urn)\n", | |
"#!ls -l or FilePaneBrowser on left, to see it\n", | |
"url,ext=None,None\n", | |
"#dfR=ec.read_file(url,ext)\n", | |
"dfR" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "37b5578d", | |
"metadata": { | |
"papermill": {}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"!ls -l \n", | |
"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/sparql.ipynb", | |
"output_path": "/tmp/q_OGC.ipynb", | |
"parameters": { | |
"ext": null, | |
"q": "OGC", | |
"url": null, | |
"urn": null | |
}, | |
"version": "2.3.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment