Skip to content

Instantly share code, notes, and snippets.

@benbovy
Created January 11, 2018 15:44
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 benbovy/3009f342fb283bd0288125a1f7883ef2 to your computer and use it in GitHub Desktop.
Save benbovy/3009f342fb283bd0288125a1f7883ef2 to your computer and use it in GitHub Desktop.
Test xarray rich output in notebook and jupyterlab
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import xarray as xr # html_repr branch"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"lon = np.array([[-99.83, -99.32, -99.56],\n",
" [-99.27, -99.39, -99.91],\n",
" [-99.79, -99.23, -99.42]])\n",
"lat = np.array([[ 42.25, 42.21, 42.82],\n",
" [ 42.91, 42.47, 42.71],\n",
" [ 42.63, 42.59, 42.29]])\n",
"\n",
"ds = xr.Dataset(data_vars={'foo': (('x', 'y'), np.random.rand(3, 3))},\n",
" coords={\n",
" 'x': [0, 1, 2], 'y': [0, 1, 2],\n",
" 'lon': (('x', 'y'), lon, {'standard_name': 'longitude'}),\n",
" 'lat': (('x', 'y'), lat, {'standard_name': 'latitude'})\n",
" },\n",
" attrs={'title': 'example dataset'})"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'>xarray.Dataset</div><ul class='xr-sections'><li><input id='section-cfe03ac8-7d7d-4c8b-93fd-d31fb17f3124' class='xr-section-in' type='checkbox' disabled ><label for='section-cfe03ac8-7d7d-4c8b-93fd-d31fb17f3124'>Dimensions:</label><ul class='xr-dim-list'><li><span class='xr-has-index'>x</span>: 3</li><li><span class='xr-has-index'>y</span>: 3</li></ul></li><li><input id='section-51836650-9a0d-46ac-8a38-3d6130f9f911' class='xr-section-in' type='checkbox' checked><label for='section-51836650-9a0d-46ac-8a38-3d6130f9f911'>Coordinates: <span>(4)</span></label><ul class='xr-var-list'><li><input id='attrs-34a99343-c3fc-4854-8f3a-ed7b9ca99097' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname xr-has-index' for='attrs-34a99343-c3fc-4854-8f3a-ed7b9ca99097'>x</label><span class='xr-dims'>(x)</span><span class='xr-dtype'>int64</span><input id='values-82c7f468-6ad3-4867-aaaf-7ee93e4c0bab' class='xr-values-in' type='checkbox'><label for='values-82c7f468-6ad3-4867-aaaf-7ee93e4c0bab' class='xr-values'><span>0 </span><span>1 </span><span>2 </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([0, 1, 2])</pre></li><li><input id='attrs-6fae6fda-d900-4aa6-a592-a621eaccdd86' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname xr-has-index' for='attrs-6fae6fda-d900-4aa6-a592-a621eaccdd86'>y</label><span class='xr-dims'>(y)</span><span class='xr-dtype'>int64</span><input id='values-a4bf772b-b971-4122-a6ff-73be63c53c82' class='xr-values-in' type='checkbox'><label for='values-a4bf772b-b971-4122-a6ff-73be63c53c82' class='xr-values'><span>0 </span><span>1 </span><span>2 </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([0, 1, 2])</pre></li><li><input id='attrs-58f341c5-4c3a-461b-a622-1ba8c1ed104c' class='xr-varname-in' type='checkbox' ><label class='xr-varname' for='attrs-58f341c5-4c3a-461b-a622-1ba8c1ed104c'>lon</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-7c4a386d-fa96-48d0-b8fc-40654d711804' class='xr-values-in' type='checkbox'><label for='values-7c4a386d-fa96-48d0-b8fc-40654d711804' class='xr-values'><span>-99.83 </span><span>-99.32 </span><span>-99.56 </span><span>-99.27 </span><span>... </span></label><ul class='xr-attr-list'><li>standard_name : longitude</li></ul><pre class='xr-data-repr'>array([[-99.83, -99.32, -99.56],\n",
" [-99.27, -99.39, -99.91],\n",
" [-99.79, -99.23, -99.42]])</pre></li><li><input id='attrs-0cbe606b-0a2a-4fb1-b040-d131de6d62b9' class='xr-varname-in' type='checkbox' ><label class='xr-varname' for='attrs-0cbe606b-0a2a-4fb1-b040-d131de6d62b9'>lat</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-266ca79f-12c5-4460-84d0-6ca9580e4a64' class='xr-values-in' type='checkbox'><label for='values-266ca79f-12c5-4460-84d0-6ca9580e4a64' class='xr-values'><span>42.25 </span><span>42.21 </span><span>42.82 </span><span>42.91 </span><span>42.47 </span><span>... </span></label><ul class='xr-attr-list'><li>standard_name : latitude</li></ul><pre class='xr-data-repr'>array([[ 42.25, 42.21, 42.82],\n",
" [ 42.91, 42.47, 42.71],\n",
" [ 42.63, 42.59, 42.29]])</pre></li></ul></li><li><input id='section-60c42311-a1ab-40a0-b30b-3c865c6d098d' class='xr-section-in' type='checkbox' checked><label for='section-60c42311-a1ab-40a0-b30b-3c865c6d098d'>Data variables: <span>(1)</span></label><ul class='xr-var-list'><li><input id='attrs-edc64fbe-1cdc-48ee-9825-4a6c91455c54' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname' for='attrs-edc64fbe-1cdc-48ee-9825-4a6c91455c54'>foo</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-2f217e0a-6df4-4ef6-b9ba-f5898d8008bc' class='xr-values-in' type='checkbox'><label for='values-2f217e0a-6df4-4ef6-b9ba-f5898d8008bc' class='xr-values'><span>0.121 </span><span>0.5573 </span><span>0.04989 </span><span>0.9803 </span><span>... </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([[ 0.12099674, 0.5573085 , 0.04989096],\n",
" [ 0.98033112, 0.84505955, 0.77337044],\n",
" [ 0.43097088, 0.34742313, 0.59263735]])</pre></li></ul></li><li><input id='section-629963d3-e6a3-4496-b303-9df4895b3258' class='xr-section-in' type='checkbox' checked><label for='section-629963d3-e6a3-4496-b303-9df4895b3258'>Attributes: <span>(1)</span></label><ul class='xr-attr-list'><li>title : example dataset</li></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (x: 3, y: 3)\n",
"Coordinates:\n",
" * x (x) int64 0 1 2\n",
" * y (y) int64 0 1 2\n",
" lon (x, y) float64 -99.83 -99.32 -99.56 -99.27 -99.39 -99.91 -99.79 ...\n",
" lat (x, y) float64 42.25 42.21 42.82 42.91 42.47 42.71 42.63 42.59 ...\n",
"Data variables:\n",
" foo (x, y) float64 0.121 0.5573 0.04989 0.9803 0.8451 0.7734 0.431 ...\n",
"Attributes:\n",
" title: example dataset"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'><div class='xr-dataarray-cls'>xarray.DataArray</div><div class='xr-dataarray-name'>'foo'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>x</span>: 3</li><li><span class='xr-has-index'>y</span>: 3</li></ul></div><ul class='xr-sections'><li><input id='section-0d6eb0b5-53ea-45c9-b341-a11f2d923137' class='xr-dataarray-in' type='checkbox' checked><label for='section-0d6eb0b5-53ea-45c9-b341-a11f2d923137'></label><div><span>0.121 </span><span>0.5573 </span><span>0.04989 </span><span>0.9803 </span><span>0.8451 </span><span>0.7734 </span><span>0.431 </span><span>0.3474 </span><span>0.5926 </span></div><pre>array([[ 0.12099674, 0.5573085 , 0.04989096],\n",
" [ 0.98033112, 0.84505955, 0.77337044],\n",
" [ 0.43097088, 0.34742313, 0.59263735]])</pre></li><li><input id='section-096dc2b7-724f-443a-9c50-ed9278f9b15c' class='xr-section-in' type='checkbox' checked><label for='section-096dc2b7-724f-443a-9c50-ed9278f9b15c'>Coordinates: <span>(4)</span></label><ul class='xr-var-list'><li><input id='attrs-8b3077b6-b51d-46e5-893e-466c686dfffe' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname xr-has-index' for='attrs-8b3077b6-b51d-46e5-893e-466c686dfffe'>x</label><span class='xr-dims'>(x)</span><span class='xr-dtype'>int64</span><input id='values-cfee4eae-5d1f-4f9c-b78c-2c65a10427d3' class='xr-values-in' type='checkbox'><label for='values-cfee4eae-5d1f-4f9c-b78c-2c65a10427d3' class='xr-values'><span>0 </span><span>1 </span><span>2 </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([0, 1, 2])</pre></li><li><input id='attrs-b4e2ce3a-4cf0-4445-b6f9-d1d47c1968ba' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname xr-has-index' for='attrs-b4e2ce3a-4cf0-4445-b6f9-d1d47c1968ba'>y</label><span class='xr-dims'>(y)</span><span class='xr-dtype'>int64</span><input id='values-3f9c7b8a-0ed7-470b-a1a0-21b21740fa17' class='xr-values-in' type='checkbox'><label for='values-3f9c7b8a-0ed7-470b-a1a0-21b21740fa17' class='xr-values'><span>0 </span><span>1 </span><span>2 </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([0, 1, 2])</pre></li><li><input id='attrs-2a9abc92-e4d2-45fc-a85e-99d6f3d544b9' class='xr-varname-in' type='checkbox' ><label class='xr-varname' for='attrs-2a9abc92-e4d2-45fc-a85e-99d6f3d544b9'>lon</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-a26a4aa1-939a-4cf8-bff5-b99880248640' class='xr-values-in' type='checkbox'><label for='values-a26a4aa1-939a-4cf8-bff5-b99880248640' class='xr-values'><span>-99.83 </span><span>-99.32 </span><span>-99.56 </span><span>-99.27 </span><span>... </span></label><ul class='xr-attr-list'><li>standard_name : longitude</li></ul><pre class='xr-data-repr'>array([[-99.83, -99.32, -99.56],\n",
" [-99.27, -99.39, -99.91],\n",
" [-99.79, -99.23, -99.42]])</pre></li><li><input id='attrs-c1863c5a-2b01-4e46-9b0e-441e2969b308' class='xr-varname-in' type='checkbox' ><label class='xr-varname' for='attrs-c1863c5a-2b01-4e46-9b0e-441e2969b308'>lat</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-5e1a6436-9609-48fc-8e41-7da2e693dc05' class='xr-values-in' type='checkbox'><label for='values-5e1a6436-9609-48fc-8e41-7da2e693dc05' class='xr-values'><span>42.25 </span><span>42.21 </span><span>42.82 </span><span>42.91 </span><span>42.47 </span><span>... </span></label><ul class='xr-attr-list'><li>standard_name : latitude</li></ul><pre class='xr-data-repr'>array([[ 42.25, 42.21, 42.82],\n",
" [ 42.91, 42.47, 42.71],\n",
" [ 42.63, 42.59, 42.29]])</pre></li></ul></li><li><input id='section-d194a4c4-0ac2-4c4d-a1a4-46647f1e1106' class='xr-section-in' type='checkbox' ><label for='section-d194a4c4-0ac2-4c4d-a1a4-46647f1e1106'>Attributes: <span>(0)</span></label><ul class='xr-attr-list'></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'foo' (x: 3, y: 3)>\n",
"array([[ 0.120997, 0.557308, 0.049891],\n",
" [ 0.980331, 0.84506 , 0.77337 ],\n",
" [ 0.430971, 0.347423, 0.592637]])\n",
"Coordinates:\n",
" * x (x) int64 0 1 2\n",
" * y (y) int64 0 1 2\n",
" lon (x, y) float64 -99.83 -99.32 -99.56 -99.27 -99.39 -99.91 -99.79 ...\n",
" lat (x, y) float64 42.25 42.21 42.82 42.91 42.47 42.71 42.63 42.59 ..."
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.foo"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'><div class='xr-dataarray-cls'>xarray.Variable</div><div class='xr-dataarray-name'></div><ul class='xr-dim-list'><li><span>x</span>: 3</li><li><span>y</span>: 3</li></ul></div><ul class='xr-sections'><li><input id='section-a92be818-c752-49f9-8758-006aae72dc6d' class='xr-dataarray-in' type='checkbox' checked><label for='section-a92be818-c752-49f9-8758-006aae72dc6d'></label><div><span>0.121 </span><span>0.5573 </span><span>0.04989 </span><span>0.9803 </span><span>0.8451 </span><span>0.7734 </span><span>0.431 </span><span>0.3474 </span><span>0.5926 </span></div><pre>array([[ 0.12099674, 0.5573085 , 0.04989096],\n",
" [ 0.98033112, 0.84505955, 0.77337044],\n",
" [ 0.43097088, 0.34742313, 0.59263735]])</pre></li><li><input id='section-ea1e37f8-b111-4736-b287-a5cf5b2bb56a' class='xr-section-in' type='checkbox' ><label for='section-ea1e37f8-b111-4736-b287-a5cf5b2bb56a'>Attributes: <span>(0)</span></label><ul class='xr-attr-list'></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.Variable (x: 3, y: 3)>\n",
"array([[ 0.120997, 0.557308, 0.049891],\n",
" [ 0.980331, 0.84506 , 0.77337 ],\n",
" [ 0.430971, 0.347423, 0.592637]])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.foo.variable"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'><div class='xr-dataarray-cls'>xarray.IndexVariable</div><div class='xr-dataarray-name'>'x'</div><ul class='xr-dim-list'><li><span>x</span>: 3</li></ul></div><ul class='xr-sections'><li><input id='section-8ef2abce-c005-4948-b873-d202f27b46f6' class='xr-dataarray-in' type='checkbox' checked><label for='section-8ef2abce-c005-4948-b873-d202f27b46f6'></label><div><span>0 </span><span>1 </span><span>2 </span></div><pre>array([0, 1, 2])</pre></li><li><input id='section-94dfd6ca-b34e-454d-85b9-b3f6eb62ee5d' class='xr-section-in' type='checkbox' ><label for='section-94dfd6ca-b34e-454d-85b9-b3f6eb62ee5d'>Attributes: <span>(0)</span></label><ul class='xr-attr-list'></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.IndexVariable 'x' (x: 3)>\n",
"array([0, 1, 2])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.foo.x.variable"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'><div class='xr-dataarray-cls'>xarray.DataArray</div><div class='xr-dataarray-name'>'lat'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>x</span>: 3</li><li><span class='xr-has-index'>y</span>: 3</li></ul></div><ul class='xr-sections'><li><input id='section-0c1e5055-f9c5-41dd-bd9a-646ce787128e' class='xr-dataarray-in' type='checkbox' checked><label for='section-0c1e5055-f9c5-41dd-bd9a-646ce787128e'></label><div><span>42.25 </span><span>42.21 </span><span>42.82 </span><span>42.91 </span><span>42.47 </span><span>42.71 </span><span>42.63 </span><span>42.59 </span><span>42.29 </span></div><pre>array([[ 42.25, 42.21, 42.82],\n",
" [ 42.91, 42.47, 42.71],\n",
" [ 42.63, 42.59, 42.29]])</pre></li><li><input id='section-dbfa5972-9ed5-4a8a-91ee-e8ae5d372ae1' class='xr-section-in' type='checkbox' checked><label for='section-dbfa5972-9ed5-4a8a-91ee-e8ae5d372ae1'>Coordinates: <span>(4)</span></label><ul class='xr-var-list'><li><input id='attrs-42ebc799-809b-4383-97b6-c74fb16d99cc' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname xr-has-index' for='attrs-42ebc799-809b-4383-97b6-c74fb16d99cc'>x</label><span class='xr-dims'>(x)</span><span class='xr-dtype'>int64</span><input id='values-f7396c30-3ba6-42ed-abfc-09afda370d04' class='xr-values-in' type='checkbox'><label for='values-f7396c30-3ba6-42ed-abfc-09afda370d04' class='xr-values'><span>0 </span><span>1 </span><span>2 </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([0, 1, 2])</pre></li><li><input id='attrs-64d951cd-fbb2-4d26-991c-dc79c7f7ff46' class='xr-varname-in' type='checkbox' disabled><label class='xr-varname xr-has-index' for='attrs-64d951cd-fbb2-4d26-991c-dc79c7f7ff46'>y</label><span class='xr-dims'>(y)</span><span class='xr-dtype'>int64</span><input id='values-0a616d4e-fefc-4a0b-adb4-dc3e5b73f8d0' class='xr-values-in' type='checkbox'><label for='values-0a616d4e-fefc-4a0b-adb4-dc3e5b73f8d0' class='xr-values'><span>0 </span><span>1 </span><span>2 </span></label><ul class='xr-attr-list'></ul><pre class='xr-data-repr'>array([0, 1, 2])</pre></li><li><input id='attrs-c33ce2d1-5391-4f75-98f8-bb9351570f81' class='xr-varname-in' type='checkbox' ><label class='xr-varname' for='attrs-c33ce2d1-5391-4f75-98f8-bb9351570f81'>lon</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-b0dc454f-9935-419a-b762-22bc44455a5b' class='xr-values-in' type='checkbox'><label for='values-b0dc454f-9935-419a-b762-22bc44455a5b' class='xr-values'><span>-99.83 </span><span>-99.32 </span><span>-99.56 </span><span>-99.27 </span><span>... </span></label><ul class='xr-attr-list'><li>standard_name : longitude</li></ul><pre class='xr-data-repr'>array([[-99.83, -99.32, -99.56],\n",
" [-99.27, -99.39, -99.91],\n",
" [-99.79, -99.23, -99.42]])</pre></li><li><input id='attrs-be1d462a-0353-45e9-9153-2cb1da7e1391' class='xr-varname-in' type='checkbox' ><label class='xr-varname' for='attrs-be1d462a-0353-45e9-9153-2cb1da7e1391'>lat</label><span class='xr-dims'>(x, y)</span><span class='xr-dtype'>float64</span><input id='values-ded4580c-c813-4464-a35e-b5676f40f5eb' class='xr-values-in' type='checkbox'><label for='values-ded4580c-c813-4464-a35e-b5676f40f5eb' class='xr-values'><span>42.25 </span><span>42.21 </span><span>42.82 </span><span>42.91 </span><span>42.47 </span><span>... </span></label><ul class='xr-attr-list'><li>standard_name : latitude</li></ul><pre class='xr-data-repr'>array([[ 42.25, 42.21, 42.82],\n",
" [ 42.91, 42.47, 42.71],\n",
" [ 42.63, 42.59, 42.29]])</pre></li></ul></li><li><input id='section-26549644-8d86-4f09-89d8-0252959128ad' class='xr-section-in' type='checkbox' checked><label for='section-26549644-8d86-4f09-89d8-0252959128ad'>Attributes: <span>(1)</span></label><ul class='xr-attr-list'><li>standard_name : latitude</li></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'lat' (x: 3, y: 3)>\n",
"array([[ 42.25, 42.21, 42.82],\n",
" [ 42.91, 42.47, 42.71],\n",
" [ 42.63, 42.59, 42.29]])\n",
"Coordinates:\n",
" * x (x) int64 0 1 2\n",
" * y (y) int64 0 1 2\n",
" lon (x, y) float64 -99.83 -99.32 -99.56 -99.27 -99.39 -99.91 -99.79 ...\n",
" lat (x, y) float64 42.25 42.21 42.82 42.91 42.47 42.71 42.63 42.59 ...\n",
"Attributes:\n",
" standard_name: latitude"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.foo.lat"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'>xarray.Dataset</div><ul class='xr-sections'><li><input id='section-7f14f66f-7a84-4b71-b100-196c1a9a0f5f' class='xr-section-in' type='checkbox' disabled ><label for='section-7f14f66f-7a84-4b71-b100-196c1a9a0f5f'>Dimensions:</label></li><li><input id='section-746ca663-8da3-44b5-b4bf-6612da9a2e9e' class='xr-section-in' type='checkbox' ><label for='section-746ca663-8da3-44b5-b4bf-6612da9a2e9e'>Coordinates: <span>(0)</span></label><ul class='xr-var-list'></ul></li><li><input id='section-27f258c3-083b-4314-acb4-68728d3fbeb2' class='xr-section-in' type='checkbox' ><label for='section-27f258c3-083b-4314-acb4-68728d3fbeb2'>Data variables: <span>(0)</span></label><ul class='xr-var-list'></ul></li><li><input id='section-9e678132-7201-48a5-9ad0-8acb3984c34d' class='xr-section-in' type='checkbox' ><label for='section-9e678132-7201-48a5-9ad0-8acb3984c34d'>Attributes: <span>(0)</span></label><ul class='xr-attr-list'></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: ()\n",
"Data variables:\n",
" *empty*"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"xr.Dataset()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
".xr-wrap {\n",
" width: 540px;\n",
" font-size: 13px;\n",
" line-height: 1.5;\n",
" background-color: #fff;\n",
"}\n",
"\n",
".xr-wrap ul {\n",
" padding: 0;\n",
"}\n",
"\n",
".xr-wrap input + label {\n",
" margin-bottom: 0 !important;\n",
"}\n",
"\n",
".xr-header {\n",
" padding: 6px 0 6px 3px;\n",
" border-bottom-width: 1px;\n",
" border-bottom-style: solid;\n",
" border-bottom-color: #777;\n",
" color: #555;;\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-dataarray-cls,\n",
".xr-dataarray-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-dataarray-name {\n",
" color: #000;\n",
"}\n",
"\n",
"ul.xr-sections {\n",
" list-style: none !important;\n",
" padding: 3px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
"input.xr-section-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
"input.xr-section-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-section-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
"input.xr-section-in:disabled + label:before {\n",
" color: #777;\n",
"}\n",
"\n",
"input.xr-section-in + label > span {\n",
" display: inline-block;\n",
" margin-left: 4px;\n",
"}\n",
"\n",
"input.xr-section-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-section-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
".xr-sections summary > div {\n",
" display: inline-block;\n",
" cursor: pointer;\n",
" width: 140px;\n",
" color: #555;\n",
" font-weight: 500;\n",
" padding: 4px 0 2px 0;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" font-size: 13px !important;\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",
" text-decoration: underline;\n",
"}\n",
"\n",
"input.xr-dataarray-in {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label {\n",
" display: inline-block;\n",
" width: 15px !important;\n",
" vertical-align: top;\n",
" padding: 4px 0 2px 0 !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in + label:before {\n",
" content: '➕' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked + label:before {\n",
" content: '➖' !important;\n",
"}\n",
"\n",
"input.xr-dataarray-in:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre,\n",
"input.xr-dataarray-in ~ div {\n",
" font-size: 12px;\n",
" width: 500px;\n",
" padding: 5px 0 4px 8px !important;\n",
" margin: 0;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div > span {\n",
" display: inline-block;\n",
" margin-right: 4px;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ pre {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ pre {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in ~ div {\n",
" display: inline-block;\n",
"}\n",
"\n",
"input.xr-dataarray-in:checked ~ div {\n",
" display: none;\n",
"}\n",
"\n",
"ul.xr-var-list {\n",
" list-style: none !important;\n",
" padding: 0 !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-var-list > li {\n",
" background-color: #fcfcfc;\n",
" overflow: hidden;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) {\n",
" background-color: #efefef;\n",
"}\n",
"\n",
".xr-var-list li:hover {\n",
" background-color: rgba(3, 169, 244, .2);\n",
"}\n",
"\n",
".xr-var-list li > span {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-var-list li input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-var-list li input:enabled + label {\n",
" cursor: pointer;\n",
"}\n",
"\n",
"input.xr-varname-in + label {\n",
" display: inline-block;\n",
" width: 140px;\n",
" padding-left: 0;\n",
"}\n",
"\n",
"input.xr-varname-in + label:before {\n",
" content: ' ';\n",
" display: inline-block;\n",
" font-size: 11px;\n",
" width: 15px;\n",
" margin-left: 20px;\n",
" margin-right: 5px;\n",
" text-align: center;\n",
" color: #aaa;\n",
" text-decoration: none !important;\n",
"}\n",
"\n",
"input.xr-varname-in ~ ul {\n",
" display: none;\n",
"}\n",
"\n",
"input.xr-varname-in:checked ~ ul {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:before {\n",
" content: 'a';\n",
"}\n",
"\n",
"input.xr-varname-in:enabled + label:hover:before {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-varname-in:checked + label:before {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-dims {\n",
" width: 80px;\n",
"}\n",
"\n",
".xr-dtype {\n",
" width: 96px;\n",
" padding-right: 4px;\n",
" text-align: right;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-values {\n",
" width: 200px;\n",
" text-align: left;\n",
" color: #888;\n",
" white-space: nowrap;\n",
" font-size: 12px;\n",
"}\n",
"\n",
".xr-values > span:nth-child(odd) {\n",
" color: rgba(0, 0, 0, .65);\n",
"}\n",
"\n",
"input.xr-values-in + label:hover > span {\n",
" color: #000;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
"input.xr-values-in ~ pre {\n",
" display: none;\n",
" background-color: white;\n",
"}\n",
"\n",
"input.xr-values-in:checked ~ pre {\n",
" display: block;\n",
"}\n",
"\n",
"input.xr-values-in:checked + label > span {\n",
" color: #ccc;\n",
"}\n",
"\n",
".xr-data-repr {\n",
" font-size: 11px !important;\n",
" background-color: #fff;\n",
" padding: 4px 0 6px 40px !important;\n",
" margin: 0 !important;\n",
"}\n",
"\n",
".xr-attr-list {\n",
" list-style: none !important;\n",
" background-color: #fff;\n",
" padding: 0 0 6px 40px !important;\n",
" color: #555;\n",
"}\n",
"\n",
".xr-attr-list li,\n",
".xr-attr-list li:hover {\n",
" background-color: #fff;\n",
"}\n",
"</style><div class='xr-wrap'><div class='xr-header'><div class='xr-dataarray-cls'>xarray.DataArray</div><div class='xr-dataarray-name'></div></div><ul class='xr-sections'><li><input id='section-97512db6-e0d9-4560-9f07-ee1e78cfd08d' class='xr-dataarray-in' type='checkbox' checked><label for='section-97512db6-e0d9-4560-9f07-ee1e78cfd08d'></label><div><span>1 </span></div><pre>array(1)</pre></li><li><input id='section-c9639b53-e3cd-43da-9a23-8bf6c0fb7bb4' class='xr-section-in' type='checkbox' ><label for='section-c9639b53-e3cd-43da-9a23-8bf6c0fb7bb4'>Coordinates: <span>(0)</span></label><ul class='xr-var-list'></ul></li><li><input id='section-c70264a0-e761-4565-814b-7ea22e2f3ec5' class='xr-section-in' type='checkbox' ><label for='section-c70264a0-e761-4565-814b-7ea22e2f3ec5'>Attributes: <span>(0)</span></label><ul class='xr-attr-list'></ul></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray ()>\n",
"array(1)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"xr.DataArray(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:xarray_dev_py36]",
"language": "python",
"name": "conda-env-xarray_dev_py36-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.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment