Created
February 17, 2014 20:28
-
-
Save rsignell-usgs/9058460 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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:9b4c9cdcd5d9c026aca41a403b593bc5b12ddc7df01c86ea23b75974003692ff" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#Use CSW to find model data at NODC, NGDC, and CATALOG.DATA.GOV" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from owslib.csw import CatalogueServiceWeb\n", | |
"from owslib import fes\n", | |
"import netCDF4" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"##Find model results at NODC" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"filt=fes.PropertyIsLike(propertyname='apiso:AnyText',literal='NCOM\\ Region\\ 1\\ Aggregation',\n", | |
" escapeChar='\\\\',wildCard='*',singleChar='?')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 17 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"endpoint = 'http://www.nodc.noaa.gov/geoportal/csw' # NODC/UAF Geoportal: granule level\n", | |
"csw = CatalogueServiceWeb(endpoint,timeout=60)\n", | |
"\n", | |
"csw.getrecords2(constraints=[filt],maxrecords=1000,esn='full')\n", | |
"len(csw.records.keys())" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 21, | |
"text": [ | |
"2" | |
] | |
} | |
], | |
"prompt_number": 21 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"choice=random.choice(list(csw.records.keys()))\n", | |
"print choice\n", | |
"csw.records[choice].references" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"ncom.ncom_reg1_agg.NCOM_Region_1_Aggregation_best.ncd\n" | |
] | |
}, | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 45, | |
"text": [ | |
"[{'scheme': 'urn:x-esri:specification:ServiceType:ArcIMS:Metadata:Onlink',\n", | |
" 'url': 'http://www.navo.navy.mil/'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:ArcIMS:Metadata:Document',\n", | |
" 'url': 'http://www.nodc.noaa.gov/geoportal/csw?getxml=%7B99CB524F-EA88-49F7-8C4C-7BB5077E052A%7D'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:OPeNDAP',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:WMS',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/wms/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd?service=WMS&version=1.3.0&request=GetCapabilities'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:WCS',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/wcs/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd?service=WCS&version=1.0.0&request=GetCapabilities'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:WCT',\n", | |
" 'url': 'http://www.ncdc.noaa.gov/oa/wct/wct-jnlp-beta.php?singlefile=http://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd'}]" | |
] | |
} | |
], | |
"prompt_number": 45 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Find model results at NGDC" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw' # NGDC/IOOS Geoportal\n", | |
"csw = CatalogueServiceWeb(endpoint,timeout=60)\n", | |
"csw.getrecords2(constraints=[filt],maxrecords=1000,esn='full')\n", | |
"len(csw.records.keys())" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 49, | |
"text": [ | |
"1" | |
] | |
} | |
], | |
"prompt_number": 49 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"choice=random.choice(list(csw.records.keys()))\n", | |
"print choice\n", | |
"csw.records[choice].references" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd\n" | |
] | |
}, | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 50, | |
"text": [ | |
"[{'scheme': 'urn:x-esri:specification:ServiceType:distribution:url',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd.html'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:distribution:url',\n", | |
" 'url': 'http://www.ncdc.noaa.gov/oa/wct/wct-jnlp-beta.php?singlefile=http://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:wms:url',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/wms/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd?service=WMS&version=1.3.0&request=GetCapabilities'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:wcs:url',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/wcs/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd?service=WCS&version=1.0.0&request=GetCapabilities'},\n", | |
" {'scheme': 'urn:x-esri:specification:ServiceType:odp:url',\n", | |
" 'url': 'http://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom/ncom_reg1_agg/NCOM_Region_1_Aggregation_best.ncd'}]" | |
] | |
} | |
], | |
"prompt_number": 50 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment