Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# IOOS models: how to find model data in the catalog\n",
"\n",
"This is the third post on the series “IOOS Ocean Models IOOS.”"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"code_folding": []
},
"outputs": [],
"source": [
"models = {\n",
" \"DOPPIO\": {\n",
" \"RA\": \"MARACOOS\",\n",
" \"url\": \"http://tds.marine.rutgers.edu/thredds/dodsC/roms/doppio/2017_da/avg/Averages_Best\",\n",
" \"var\": {\"standard_name\": \"sea_water_potential_temperature\"},\n",
" },\n",
" \"NYHOPS\": {\n",
" \"RA\": \"MARACOOS\",\n",
" \"url\": \"http://colossus.dl.stevens-tech.edu:8080/thredds/dodsC/latest/Complete_gcmplt.nc\",\n",
" \"var\": {\"standard_name\": \"sea_water_temperature\"},\n",
" },\n",
" \"NECOFS-GOM3\": {\n",
" \"RA\": \"NERACOOS\",\n",
" \"url\": \"http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_GOM3_FORECAST.nc\",\n",
" \"var\": {\"standard_name\": \"sea_water_potential_temperature\"},\n",
" },\n",
" \"NECOFS-MASSBAY\": {\n",
" \"RA\": \"NERACOOS\",\n",
" \"url\": \"http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc\",\n",
" \"var\": {\"standard_name\": \"sea_water_potential_temperature\"},\n",
" },\n",
" \"CNAPS\": {\n",
" \"RA\": \"SECOORA\",\n",
" \"url\": \"http://thredds.secoora.org/thredds/dodsC/SECOORA_NCSU_CNAPS.nc\",\n",
" \"var\": {\"standard_name\": \"sea_water_potential_temperature\"},\n",
" },\n",
" \"CMOP-SELFE\": {\n",
" \"RA\": \"NANOOS\",\n",
" \"url\": \"http://amb6400b.stccmop.org:8080/thredds/dodsC/model_data/forecast\",\n",
" \"var\": {\"standard_name\": \"average_sea_water_temperature\"},\n",
" },\n",
" \"OSU-ROMS\": {\n",
" \"RA\": \"NANOOS\",\n",
" \"url\": \"http://ona.coas.oregonstate.edu:8080/thredds/dodsC/NANOOS/OCOS\",\n",
" \"var\": {\"standard_name\": \"sea_water_potential_temperature\"},\n",
" },\n",
" \"Hawaii-ROMS\": {\n",
" \"RA\": \"PacIOOS\",\n",
" \"url\": \"http://oos.soest.hawaii.edu/thredds/dodsC/hioos/roms_forec/hiig/ROMS_Hawaii_Regional_Ocean_Model_best.ncd\",\n",
" \"var\": {\"standard_name\": \"sea_water_potential_temperature\"},\n",
" },\n",
" \"WCOFS\": {\n",
" \"url\": \"http://opendap.co-ops.nos.noaa.gov/thredds/dodsC/WCOFS/fmrc/Aggregated_7_day_WCOFS_Fields_Forecast_best.ncd\",\n",
" \"var\": {\"standard_name\": \"sea_water_temperature\"},\n",
" },\n",
" \"WestCoastUCSC\": {\n",
" \"url\": \"http://oceanmodeling.pmc.ucsc.edu:8080/thredds/dodsC/ccsra_2016a_phys_agg_zlevs/fmrc/CCSRA_2016a_Phys_ROMS_z-level_(depth)_Aggregation_best.ncd\",\n",
" \"var\": {\"long_name\": \"potential temperature\"},\n",
" },\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from owslib import fes\n",
"\n",
"\n",
"cf_names = set([list(model[\"var\"].values())[0] for model in models.values()])\n",
"\n",
"kw = dict(\n",
" wildCard=\"*\",\n",
" escapeChar=\"\\\\\",\n",
" singleChar=\"?\",\n",
" propertyname=\"apiso:Subject\",\n",
")\n",
"\n",
"or_filt = fes.Or(\n",
" [\n",
" fes.PropertyIsLike(literal=(\"*{val}*\"), **kw)\n",
" for val in cf_names\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime\n",
"from ioos_tools.ioos import fes_date_filter\n",
"\n",
"\n",
"start = datetime(2020, 1, 1)\n",
"stop = datetime(2020, 1, 8)\n",
"\n",
"begin, end = fes_date_filter(start, stop)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"bbox = [-145, 20, -45, 50]\n",
"crs = \"urn:ogc:def:crs:OGC:1.3:CRS84\"\n",
"\n",
"\n",
"bbox_crs = fes.BBox(bbox, crs=crs)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"filter_list = [\n",
" fes.And(\n",
" [\n",
" bbox_crs,\n",
" begin,\n",
" end,\n",
" or_filt,\n",
" ]\n",
" )\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from owslib.csw import CatalogueServiceWeb\n",
"from ioos_tools.ioos import get_csw_records\n",
"\n",
"\n",
"endpoint = \"https://data.ioos.us/csw\"\n",
"csw = CatalogueServiceWeb(endpoint, timeout=120)\n",
"csw = get_csw_records(csw, filter_list, esn=\"full\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OrderedDict()\n"
]
}
],
"source": [
"print(csw.records)"
]
}
],
"metadata": {
"_draft": {
"nbviewer_url": "https://gist.github.com/082ff31d26e85767e2bdcb622fb753b4"
},
"gist": {
"data": {
"description": "2018-04-21-horizontal-slices",
"public": true
},
"id": "082ff31d26e85767e2bdcb622fb753b4"
},
"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.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}