Skip to content

Instantly share code, notes, and snippets.

@larsbuntemeyer
Created July 15, 2022 19:59
Show Gist options
  • Save larsbuntemeyer/308eb6ab7111aaa2c9cc59a0d57fbd68 to your computer and use it in GitHub Desktop.
Save larsbuntemeyer/308eb6ab7111aaa2c9cc59a0d57fbd68 to your computer and use it in GitHub Desktop.
access CORDEX esgf data via http
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "60ac64c5-0608-4383-be29-26f6b8c4b980",
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import pyesgf\n",
"from pyesgf.logon import LogonManager\n",
"from pyesgf.search import SearchConnection\n",
"\n",
"\n",
"\n",
"lm = LogonManager()\n",
"\n",
"# logon\n",
"myproxy_host = 'esgf-data.dkrz.de'\n",
"lm.logon(hostname=myproxy_host, interactive=True, bootstrap=True)\n",
"print(lm.is_logged_on())\n",
"\n",
"# search\n",
"conn = SearchConnection('http://esgf-data.dkrz.de/esg-search', distrib=False)\n",
"ctx = conn.new_context(project='CORDEX', experiment='evaluation', time_frequency='mon',\n",
" variable='tas', driving_model=\"ECMWF-ERAINT\", domain=\"EUR-11\")\n",
"result = ctx.search()\n",
"print(f\"length: {len(result)}\")\n",
"\n",
"res = result[0]\n",
"ctx = res.file_context()\n",
"#ctx.facet_counts\n",
"dataset = ctx.search()\n",
"\n",
"download_url = dataset[0].download_url\n",
"opendap_url = dataset[0].opendap_url"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4da9aa26-1900-4dae-93f3-9ddc9d2a3f99",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"('http://cordexesg.dmi.dk/thredds/fileServer/cordex_general/cordex/output/EUR-11/DMI/ECMWF-ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/v20140620/tas_EUR-11_ECMWF-ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc',\n",
" 'http://cordexesg.dmi.dk/thredds/dodsC/cordex_general/cordex/output/EUR-11/DMI/ECMWF-ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/v20140620/tas_EUR-11_ECMWF-ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc')"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"download_url, opendap_url"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "3b2d4f4f-7928-4b49-993b-96e4de1d9048",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2 {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
"Dimensions: (rlat: 412, rlon: 424, time: 24, bounds: 2)\n",
"Coordinates:\n",
" * rlat (rlat) float64 -23.38 -23.26 -23.16 ... 21.61 21.73 21.83\n",
" * rlon (rlon) float64 -28.38 -28.26 -28.16 ... 17.93 18.05 18.16\n",
" * time (time) datetime64[ns] 1989-01-16T12:00:00 ... 1990-12-16T12...\n",
" lat (rlat, rlon) float64 ...\n",
" lon (rlat, rlon) float64 ...\n",
"Dimensions without coordinates: bounds\n",
"Data variables:\n",
" rotated_pole |S64 b&#x27;R&#x27;\n",
" time_bnds (time, bounds) datetime64[ns] 1989-01-01 ... 1990-12-31\n",
" height float64 2.0\n",
" tas (time, rlat, rlon) float32 ...\n",
"Attributes: (12/25)\n",
" CDI: Climate Data Interface version 1.5.3 (ht...\n",
" history: Thu Nov 14 20:02:22 2013: /usr/local/bin...\n",
" institution: Danish Meteorological Institute\n",
" Conventions: CF-1.6\n",
" tracking_id: 108d904e-e9e9-464b-85a7-dba596f6b5bc\n",
" contact: obc@dmi.dk\n",
" ... ...\n",
" driving_experiment: ECMWF-ERAINT,evaluation,r1i1p1\n",
" driving_model_id: ECMWF-ERAINT\n",
" CORDEX_domain: EUR-11\n",
" NCO: 4.0.9\n",
" DODS.strlen: 0\n",
" DODS_EXTRA.Unlimited_Dimension: time</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-2e2d827f-d38e-4e7e-87d0-bb2d68221162' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-2e2d827f-d38e-4e7e-87d0-bb2d68221162' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>rlat</span>: 412</li><li><span class='xr-has-index'>rlon</span>: 424</li><li><span class='xr-has-index'>time</span>: 24</li><li><span>bounds</span>: 2</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-24ce27d2-bfd9-4f51-a633-ed38c04ca673' class='xr-section-summary-in' type='checkbox' checked><label for='section-24ce27d2-bfd9-4f51-a633-ed38c04ca673' class='xr-section-summary' >Coordinates: <span>(5)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>rlat</span></div><div class='xr-var-dims'>(rlat)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-23.38 -23.26 ... 21.73 21.83</div><input id='attrs-7d2bec5d-88a0-4aa5-a312-33b6a4d78051' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-7d2bec5d-88a0-4aa5-a312-33b6a4d78051' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-96586ef7-9b75-4ec5-aaca-0ef684d9a546' class='xr-var-data-in' type='checkbox'><label for='data-96586ef7-9b75-4ec5-aaca-0ef684d9a546' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>latitude in rotated-pole grid</dd><dt><span>units :</span></dt><dd>degrees</dd><dt><span>standard_name :</span></dt><dd>grid_latitude</dd><dt><span>axis :</span></dt><dd>Y</dd><dt><span>_ChunkSizes :</span></dt><dd>412</dd></dl></div><div class='xr-var-data'><pre>array([-23.375 , -23.264999, -23.155001, ..., 21.615 , 21.725 ,\n",
" 21.834999])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>rlon</span></div><div class='xr-var-dims'>(rlon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-28.38 -28.26 ... 18.05 18.16</div><input id='attrs-cdf53613-9422-4c5c-b71d-b0f775bbfbe0' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-cdf53613-9422-4c5c-b71d-b0f775bbfbe0' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-593eaf0d-8eae-4f07-971c-04d5fc104acd' class='xr-var-data-in' type='checkbox'><label for='data-593eaf0d-8eae-4f07-971c-04d5fc104acd' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>longitude in rotated-pole grid</dd><dt><span>units :</span></dt><dd>degrees</dd><dt><span>standard_name :</span></dt><dd>grid_longitude</dd><dt><span>axis :</span></dt><dd>X</dd><dt><span>_ChunkSizes :</span></dt><dd>424</dd></dl></div><div class='xr-var-data'><pre>array([-28.375 , -28.264999, -28.155001, ..., 17.934999, 18.045 ,\n",
" 18.155001])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>1989-01-16T12:00:00 ... 1990-12-...</div><input id='attrs-e5e6caf8-3379-44c2-9c57-8ed79da483c9' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-e5e6caf8-3379-44c2-9c57-8ed79da483c9' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cbca1cda-69fc-4772-aa83-5cc71ab71f46' class='xr-var-data-in' type='checkbox'><label for='data-cbca1cda-69fc-4772-aa83-5cc71ab71f46' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>standard_name :</span></dt><dd>time</dd><dt><span>bounds :</span></dt><dd>time_bnds</dd><dt><span>_ChunkSizes :</span></dt><dd>1</dd></dl></div><div class='xr-var-data'><pre>array([&#x27;1989-01-16T12:00:00.000000000&#x27;, &#x27;1989-02-16T12:00:00.000000000&#x27;,\n",
" &#x27;1989-03-16T12:00:00.000000000&#x27;, &#x27;1989-04-16T12:00:00.000000000&#x27;,\n",
" &#x27;1989-05-16T12:00:00.000000000&#x27;, &#x27;1989-06-16T12:00:00.000000000&#x27;,\n",
" &#x27;1989-07-16T12:00:00.000000000&#x27;, &#x27;1989-08-16T12:00:00.000000000&#x27;,\n",
" &#x27;1989-09-16T12:00:00.000000000&#x27;, &#x27;1989-10-16T12:00:00.000000000&#x27;,\n",
" &#x27;1989-11-16T12:00:00.000000000&#x27;, &#x27;1989-12-16T12:00:00.000000000&#x27;,\n",
" &#x27;1990-01-16T12:00:00.000000000&#x27;, &#x27;1990-02-16T12:00:00.000000000&#x27;,\n",
" &#x27;1990-03-16T12:00:00.000000000&#x27;, &#x27;1990-04-16T12:00:00.000000000&#x27;,\n",
" &#x27;1990-05-16T12:00:00.000000000&#x27;, &#x27;1990-06-16T12:00:00.000000000&#x27;,\n",
" &#x27;1990-07-16T12:00:00.000000000&#x27;, &#x27;1990-08-16T12:00:00.000000000&#x27;,\n",
" &#x27;1990-09-16T12:00:00.000000000&#x27;, &#x27;1990-10-16T12:00:00.000000000&#x27;,\n",
" &#x27;1990-11-16T12:00:00.000000000&#x27;, &#x27;1990-12-16T12:00:00.000000000&#x27;],\n",
" dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(rlat, rlon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-5b3e8b7d-10d7-4077-ba4c-6f548b3307b7' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-5b3e8b7d-10d7-4077-ba4c-6f548b3307b7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-87f1b0d0-40ae-4a3f-83df-ab510ad58f34' class='xr-var-data-in' type='checkbox'><label for='data-87f1b0d0-40ae-4a3f-83df-ab510ad58f34' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>_CoordinateAxisType :</span></dt><dd>Lat</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd></dl></div><div class='xr-var-data'><pre>[174688 values with dtype=float64]</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(rlat, rlon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-0c169690-b622-491c-a35c-1b47541abc7f' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-0c169690-b622-491c-a35c-1b47541abc7f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-83e9cbb2-2eb0-4840-9851-0abda5f5544a' class='xr-var-data-in' type='checkbox'><label for='data-83e9cbb2-2eb0-4840-9851-0abda5f5544a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>_CoordinateAxisType :</span></dt><dd>Lon</dd><dt><span>long_name :</span></dt><dd>longitude</dd><dt><span>standard_name :</span></dt><dd>longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd></dl></div><div class='xr-var-data'><pre>[174688 values with dtype=float64]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-eccb9594-25b5-4ff6-93c7-44ae52df112c' class='xr-section-summary-in' type='checkbox' checked><label for='section-eccb9594-25b5-4ff6-93c7-44ae52df112c' class='xr-section-summary' >Data variables: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>rotated_pole</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>|S64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-d0588d7a-c1f0-40e9-9a7b-135ce1408ecb' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-d0588d7a-c1f0-40e9-9a7b-135ce1408ecb' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-010f9fde-8d93-43f3-a3c2-c063616863d2' class='xr-var-data-in' type='checkbox'><label for='data-010f9fde-8d93-43f3-a3c2-c063616863d2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>grid_mapping_name :</span></dt><dd>rotated_latitude_longitude</dd><dt><span>grid_north_pole_latitude :</span></dt><dd>39.25</dd><dt><span>grid_north_pole_longitude :</span></dt><dd>-162.0</dd></dl></div><div class='xr-var-data'><pre>array(b&#x27;R&#x27;, dtype=&#x27;|S64&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>time_bnds</span></div><div class='xr-var-dims'>(time, bounds)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-74559395-f461-4712-970d-bf1fb5f4b925' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-74559395-f461-4712-970d-bf1fb5f4b925' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c487df22-9581-4c35-8036-50c0b519266c' class='xr-var-data-in' type='checkbox'><label for='data-c487df22-9581-4c35-8036-50c0b519266c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>_ChunkSizes :</span></dt><dd>[1 2]</dd></dl></div><div class='xr-var-data'><pre>array([[&#x27;1989-01-01T00:00:00.000000000&#x27;, &#x27;1989-01-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-02-01T00:00:00.000000000&#x27;, &#x27;1989-02-28T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-03-01T00:00:00.000000000&#x27;, &#x27;1989-03-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-04-01T00:00:00.000000000&#x27;, &#x27;1989-04-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-05-01T00:00:00.000000000&#x27;, &#x27;1989-05-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-06-01T00:00:00.000000000&#x27;, &#x27;1989-06-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-07-01T00:00:00.000000000&#x27;, &#x27;1989-07-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-08-01T00:00:00.000000000&#x27;, &#x27;1989-08-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-09-01T00:00:00.000000000&#x27;, &#x27;1989-09-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-10-01T00:00:00.000000000&#x27;, &#x27;1989-10-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-11-01T00:00:00.000000000&#x27;, &#x27;1989-11-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1989-12-01T00:00:00.000000000&#x27;, &#x27;1989-12-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-01-01T00:00:00.000000000&#x27;, &#x27;1990-01-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-02-01T00:00:00.000000000&#x27;, &#x27;1990-02-28T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-03-01T00:00:00.000000000&#x27;, &#x27;1990-03-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-04-01T00:00:00.000000000&#x27;, &#x27;1990-04-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-05-01T00:00:00.000000000&#x27;, &#x27;1990-05-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-06-01T00:00:00.000000000&#x27;, &#x27;1990-06-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-07-01T00:00:00.000000000&#x27;, &#x27;1990-07-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-08-01T00:00:00.000000000&#x27;, &#x27;1990-08-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-09-01T00:00:00.000000000&#x27;, &#x27;1990-09-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-10-01T00:00:00.000000000&#x27;, &#x27;1990-10-31T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-11-01T00:00:00.000000000&#x27;, &#x27;1990-11-30T00:00:00.000000000&#x27;],\n",
" [&#x27;1990-12-01T00:00:00.000000000&#x27;, &#x27;1990-12-31T00:00:00.000000000&#x27;]],\n",
" dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>height</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-9c0010c5-45eb-412a-9f18-dda06d08c4af' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-9c0010c5-45eb-412a-9f18-dda06d08c4af' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-21f0aa4d-3729-4e55-ba6c-67f57058e8b7' class='xr-var-data-in' type='checkbox'><label for='data-21f0aa4d-3729-4e55-ba6c-67f57058e8b7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>Z</dd><dt><span>units :</span></dt><dd>m</dd><dt><span>standard_name :</span></dt><dd>height</dd><dt><span>long_name :</span></dt><dd>height</dd><dt><span>positive :</span></dt><dd>up</dd></dl></div><div class='xr-var-data'><pre>array(2.)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>tas</span></div><div class='xr-var-dims'>(time, rlat, rlon)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-bc423eec-6c98-4f29-a3ee-43ddbe656a15' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-bc423eec-6c98-4f29-a3ee-43ddbe656a15' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-32df6103-2294-4159-b76d-862d13c2ca4d' class='xr-var-data-in' type='checkbox'><label for='data-32df6103-2294-4159-b76d-862d13c2ca4d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>grid_mapping :</span></dt><dd>rotated_pole</dd><dt><span>standard_name :</span></dt><dd>air_temperature</dd><dt><span>units :</span></dt><dd>K</dd><dt><span>cell_methods :</span></dt><dd>time: mean</dd><dt><span>long_name :</span></dt><dd>Near-Surface Air Temperature</dd><dt><span>_ChunkSizes :</span></dt><dd>[ 1 412 424]</dd></dl></div><div class='xr-var-data'><pre>[4192512 values with dtype=float32]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-abe6baf5-4a9e-4a13-be7b-c27b703009a0' class='xr-section-summary-in' type='checkbox' ><label for='section-abe6baf5-4a9e-4a13-be7b-c27b703009a0' class='xr-section-summary' >Attributes: <span>(25)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>CDI :</span></dt><dd>Climate Data Interface version 1.5.3 (http://code.zmaw.de/projects/cdi)</dd><dt><span>history :</span></dt><dd>Thu Nov 14 20:02:22 2013: /usr/local/bin/ncks --mk_rec_dmn time tas_EUR-11_ECMWF-ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc out1.nc\n",
"Sun Oct 07 10:02:45 2012: cdo setday,16 NAM-44/DMI/ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/tas_NAM-44_ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc NAM-44/DMI/ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/tas_NAM-44_ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012_sub.nc\n",
"Sun Oct 07 10:02:43 2012: cdo monmean NAM-44/DMI/ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/day/tas/tas_NAM-44_ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_day_19890101-19901231.nc NAM-44/DMI/ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/tas_NAM-44_ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc\n",
"Fri Sep 28 12:10:50 2012: cdo selindexbox,11,165,13,142 tas_NAM-44_ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_day_19890101-19901231.nc tas_NAM-44_ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_day_19890101-19901231sub.nc</dd><dt><span>institution :</span></dt><dd>Danish Meteorological Institute</dd><dt><span>Conventions :</span></dt><dd>CF-1.6</dd><dt><span>tracking_id :</span></dt><dd>108d904e-e9e9-464b-85a7-dba596f6b5bc</dd><dt><span>contact :</span></dt><dd>obc@dmi.dk</dd><dt><span>creation_date :</span></dt><dd>2012-09-28 12:10:49</dd><dt><span>driving_model_ensemble_member :</span></dt><dd>r1i1p1</dd><dt><span>institute_id :</span></dt><dd>DMI</dd><dt><span>model_id :</span></dt><dd>DMI-HIRHAM5</dd><dt><span>rcm_version_id :</span></dt><dd>v1</dd><dt><span>project_id :</span></dt><dd>CORDEX</dd><dt><span>product :</span></dt><dd>output</dd><dt><span>CDO :</span></dt><dd>Climate Data Operators version 1.5.3 (http://code.zmaw.de/projects/cdo)</dd><dt><span>frequency :</span></dt><dd>mon</dd><dt><span>nco_openmp_thread_number :</span></dt><dd>1</dd><dt><span>experiment :</span></dt><dd>Evaluation run with reanalysis forcing</dd><dt><span>experiment_id :</span></dt><dd>evaluation</dd><dt><span>driving_experiment_name :</span></dt><dd>evaluation</dd><dt><span>driving_experiment :</span></dt><dd>ECMWF-ERAINT,evaluation,r1i1p1</dd><dt><span>driving_model_id :</span></dt><dd>ECMWF-ERAINT</dd><dt><span>CORDEX_domain :</span></dt><dd>EUR-11</dd><dt><span>NCO :</span></dt><dd>4.0.9</dd><dt><span>DODS.strlen :</span></dt><dd>0</dd><dt><span>DODS_EXTRA.Unlimited_Dimension :</span></dt><dd>time</dd></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (rlat: 412, rlon: 424, time: 24, bounds: 2)\n",
"Coordinates:\n",
" * rlat (rlat) float64 -23.38 -23.26 -23.16 ... 21.61 21.73 21.83\n",
" * rlon (rlon) float64 -28.38 -28.26 -28.16 ... 17.93 18.05 18.16\n",
" * time (time) datetime64[ns] 1989-01-16T12:00:00 ... 1990-12-16T12...\n",
" lat (rlat, rlon) float64 ...\n",
" lon (rlat, rlon) float64 ...\n",
"Dimensions without coordinates: bounds\n",
"Data variables:\n",
" rotated_pole |S64 ...\n",
" time_bnds (time, bounds) datetime64[ns] ...\n",
" height float64 ...\n",
" tas (time, rlat, rlon) float32 ...\n",
"Attributes: (12/25)\n",
" CDI: Climate Data Interface version 1.5.3 (ht...\n",
" history: Thu Nov 14 20:02:22 2013: /usr/local/bin...\n",
" institution: Danish Meteorological Institute\n",
" Conventions: CF-1.6\n",
" tracking_id: 108d904e-e9e9-464b-85a7-dba596f6b5bc\n",
" contact: obc@dmi.dk\n",
" ... ...\n",
" driving_experiment: ECMWF-ERAINT,evaluation,r1i1p1\n",
" driving_model_id: ECMWF-ERAINT\n",
" CORDEX_domain: EUR-11\n",
" NCO: 4.0.9\n",
" DODS.strlen: 0\n",
" DODS_EXTRA.Unlimited_Dimension: time"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds = xr.open_dataset(opendap_url)\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "311f3cca-dc79-4315-a02a-a1602c77634a",
"metadata": {},
"outputs": [
{
"ename": "FileNotFoundError",
"evalue": "http://cordexesg.dmi.dk/thredds/fileServer/cordex_general/cordex/output/EUR-11/DMI/ECMWF-ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/v20140620/tas_EUR-11_ECMWF-ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mClientResponseError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/implementations/http.py:391\u001b[0m, in \u001b[0;36mHTTPFileSystem._info\u001b[0;34m(self, url, **kwargs)\u001b[0m\n\u001b[1;32m 389\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 390\u001b[0m info\u001b[38;5;241m.\u001b[39mupdate(\n\u001b[0;32m--> 391\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m _file_info(\n\u001b[1;32m 392\u001b[0m url,\n\u001b[1;32m 393\u001b[0m size_policy\u001b[38;5;241m=\u001b[39mpolicy,\n\u001b[1;32m 394\u001b[0m session\u001b[38;5;241m=\u001b[39msession,\n\u001b[1;32m 395\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkwargs,\n\u001b[1;32m 396\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 397\u001b[0m )\n\u001b[1;32m 398\u001b[0m )\n\u001b[1;32m 399\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m info\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msize\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/implementations/http.py:772\u001b[0m, in \u001b[0;36m_file_info\u001b[0;34m(url, session, size_policy, **kwargs)\u001b[0m\n\u001b[1;32m 771\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m r:\n\u001b[0;32m--> 772\u001b[0m \u001b[43mr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 774\u001b[0m \u001b[38;5;66;03m# TODO:\u001b[39;00m\n\u001b[1;32m 775\u001b[0m \u001b[38;5;66;03m# recognise lack of 'Accept-Ranges',\u001b[39;00m\n\u001b[1;32m 776\u001b[0m \u001b[38;5;66;03m# or 'Accept-Ranges': 'none' (not 'bytes')\u001b[39;00m\n\u001b[1;32m 777\u001b[0m \u001b[38;5;66;03m# to mean streaming only, no random access => return None\u001b[39;00m\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/aiohttp/client_reqrep.py:1004\u001b[0m, in \u001b[0;36mClientResponse.raise_for_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1003\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrelease()\n\u001b[0;32m-> 1004\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ClientResponseError(\n\u001b[1;32m 1005\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequest_info,\n\u001b[1;32m 1006\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhistory,\n\u001b[1;32m 1007\u001b[0m status\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstatus,\n\u001b[1;32m 1008\u001b[0m message\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mreason,\n\u001b[1;32m 1009\u001b[0m headers\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mheaders,\n\u001b[1;32m 1010\u001b[0m )\n",
"\u001b[0;31mClientResponseError\u001b[0m: 401, message='401', url=URL('https://cordexesg.dmi.dk/esg-orp/home.htm?redirect=http://cordexesg.dmi.dk/thredds/fileServer/cordex_general/cordex/output/EUR-11/DMI/ECMWF-ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/v20140620/tas_EUR-11_ECMWF-ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc')",
"\nThe above exception was the direct cause of the following exception:\n",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [5]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mfsspec\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m fsspec\u001b[38;5;241m.\u001b[39mopen(download_url, ssl\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m 3\u001b[0m ds \u001b[38;5;241m=\u001b[39m xr\u001b[38;5;241m.\u001b[39mopen_dataset(f)\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/core.py:104\u001b[0m, in \u001b[0;36mOpenFile.__enter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__enter__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 102\u001b[0m mode \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmode\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mt\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 104\u001b[0m f \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 106\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfobjects \u001b[38;5;241m=\u001b[39m [f]\n\u001b[1;32m 108\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcompression \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/spec.py:1037\u001b[0m, in \u001b[0;36mAbstractFileSystem.open\u001b[0;34m(self, path, mode, block_size, cache_options, compression, **kwargs)\u001b[0m\n\u001b[1;32m 1035\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1036\u001b[0m ac \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mautocommit\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_intrans)\n\u001b[0;32m-> 1037\u001b[0m f \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_open\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1038\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1039\u001b[0m \u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1040\u001b[0m \u001b[43m \u001b[49m\u001b[43mblock_size\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mblock_size\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1041\u001b[0m \u001b[43m \u001b[49m\u001b[43mautocommit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mac\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1042\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1043\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1044\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1045\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m compression \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1046\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfsspec\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcompression\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m compr\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/implementations/http.py:340\u001b[0m, in \u001b[0;36mHTTPFileSystem._open\u001b[0;34m(self, path, mode, block_size, autocommit, cache_type, cache_options, size, **kwargs)\u001b[0m\n\u001b[1;32m 338\u001b[0m kw[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124masynchronous\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39masynchronous\n\u001b[1;32m 339\u001b[0m kw\u001b[38;5;241m.\u001b[39mupdate(kwargs)\n\u001b[0;32m--> 340\u001b[0m size \u001b[38;5;241m=\u001b[39m size \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msize\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 341\u001b[0m session \u001b[38;5;241m=\u001b[39m sync(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloop, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_session)\n\u001b[1;32m 342\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m block_size \u001b[38;5;129;01mand\u001b[39;00m size:\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/asyn.py:86\u001b[0m, in \u001b[0;36msync_wrapper.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 83\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(func)\n\u001b[1;32m 84\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 85\u001b[0m \u001b[38;5;28mself\u001b[39m \u001b[38;5;241m=\u001b[39m obj \u001b[38;5;129;01mor\u001b[39;00m args[\u001b[38;5;241m0\u001b[39m]\n\u001b[0;32m---> 86\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msync\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/asyn.py:66\u001b[0m, in \u001b[0;36msync\u001b[0;34m(loop, func, timeout, *args, **kwargs)\u001b[0m\n\u001b[1;32m 64\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m FSTimeoutError \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mreturn_result\u001b[39;00m\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(return_result, \u001b[38;5;167;01mBaseException\u001b[39;00m):\n\u001b[0;32m---> 66\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m return_result\n\u001b[1;32m 67\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m return_result\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/asyn.py:26\u001b[0m, in \u001b[0;36m_runner\u001b[0;34m(event, coro, result, timeout)\u001b[0m\n\u001b[1;32m 24\u001b[0m coro \u001b[38;5;241m=\u001b[39m asyncio\u001b[38;5;241m.\u001b[39mwait_for(coro, timeout\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m 25\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 26\u001b[0m result[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m coro\n\u001b[1;32m 27\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m ex:\n\u001b[1;32m 28\u001b[0m result[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m=\u001b[39m ex\n",
"File \u001b[0;32m/opt/anaconda3/envs/pyesgf/lib/python3.10/site-packages/fsspec/implementations/http.py:404\u001b[0m, in \u001b[0;36mHTTPFileSystem._info\u001b[0;34m(self, url, **kwargs)\u001b[0m\n\u001b[1;32m 401\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 402\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m policy \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mget\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 403\u001b[0m \u001b[38;5;66;03m# If get failed, then raise a FileNotFoundError\u001b[39;00m\n\u001b[0;32m--> 404\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(url) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 405\u001b[0m logger\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;28mstr\u001b[39m(exc))\n\u001b[1;32m 407\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m: url, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msize\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39minfo, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfile\u001b[39m\u001b[38;5;124m\"\u001b[39m}\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: http://cordexesg.dmi.dk/thredds/fileServer/cordex_general/cordex/output/EUR-11/DMI/ECMWF-ERAINT/evaluation/r1i1p1/DMI-HIRHAM5/v1/mon/tas/v20140620/tas_EUR-11_ECMWF-ERAINT_evaluation_r1i1p1_DMI-HIRHAM5_v1_mon_198901-199012.nc"
]
}
],
"source": [
"import fsspec\n",
"with fsspec.open(download_url, ssl=True) as f:\n",
" ds = xr.open_dataset(f)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2178d24b-ac01-4542-b8f5-189be2a1bc8f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:pyesgf]",
"language": "python",
"name": "conda-env-pyesgf-py"
},
"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.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment