Created
October 1, 2024 11:39
-
-
Save Cadair/4a03750868e044ac4bdd6f3a04ed7abc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "2da6de9b-d8f9-439e-93ac-2f66f060c4cc", | |
"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", | |
"html[data-theme=dark],\n", | |
"body[data-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 0 20px 0 20px;\n", | |
"}\n", | |
"\n", | |
".xr-section-item {\n", | |
" display: contents;\n", | |
"}\n", | |
"\n", | |
".xr-section-item input {\n", | |
" display: inline-block;\n", | |
" opacity: 0;\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:focus + label {\n", | |
" border: 2px solid var(--xr-font-color0);\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-index-preview {\n", | |
" grid-column: 2 / 5;\n", | |
" color: var(--xr-font-color2);\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", | |
".xr-index-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", | |
".xr-index-data-in:checked ~ .xr-index-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-index-name div,\n", | |
".xr-index-data,\n", | |
".xr-attrs {\n", | |
" padding-left: 25px !important;\n", | |
"}\n", | |
"\n", | |
".xr-attrs,\n", | |
".xr-var-attrs,\n", | |
".xr-var-data,\n", | |
".xr-index-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", | |
".xr-no-icon {\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'><xarray.DataArray 'pos.eq.ra' (array_2: 105)> Size: 840B\n", | |
"array([51.74010318, 51.73270331, 51.72530343, 51.71790356, 51.71050369,\n", | |
" 51.70310382, 51.69570395, 51.68830408, 51.68090421, 51.67350434,\n", | |
" 51.66610447, 51.6587046 , 51.65130472, 51.64390485, 51.63650498,\n", | |
" 51.62910511, 51.62170524, 51.61430537, 51.6069055 , 51.59950563,\n", | |
" 51.59210576, 51.58470589, 51.57730601, 51.56990614, 51.56250627,\n", | |
" 51.5551064 , 51.54770653, 51.54030666, 51.53290679, 51.52550692,\n", | |
" 51.51810705, 51.51070717, 51.5033073 , 51.49590743, 51.48850756,\n", | |
" 51.48110769, 51.47370782, 51.46630795, 51.45890808, 51.45150821,\n", | |
" 51.44410834, 51.43670846, 51.42930859, 51.42190872, 51.41450885,\n", | |
" 51.40710898, 51.39970911, 51.39230924, 51.38490937, 51.3775095 ,\n", | |
" 51.37010963, 51.36270975, 51.35530988, 51.34791001, 51.34051014,\n", | |
" 51.33311027, 51.3257104 , 51.31831053, 51.31091066, 51.30351079,\n", | |
" 51.29611091, 51.28871104, 51.28131117, 51.2739113 , 51.26651143,\n", | |
" 51.25911156, 51.25171169, 51.24431182, 51.23691195, 51.22951208,\n", | |
" 51.2221122 , 51.21471233, 51.20731246, 51.19991259, 51.19251272,\n", | |
" 51.18511285, 51.17771298, 51.17031311, 51.16291324, 51.15551337,\n", | |
" 51.14811349, 51.14071362, 51.13331375, 51.12591388, 51.11851401,\n", | |
" 51.11111414, 51.10371427, 51.0963144 , 51.08891453, 51.08151466,\n", | |
" 51.07411478, 51.06671491, 51.05931504, 51.05191517, 51.0445153 ,\n", | |
" 51.03711543, 51.02971556, 51.02231569, 51.01491582, 51.00751594,\n", | |
" 51.00011607, 50.9927162 , 50.98531633, 50.97791646, 50.97051659])\n", | |
"Coordinates:\n", | |
" pos.eq.ra (array_2) float64 840B 51.74 51.73 ... 50.98 50.97\n", | |
" pos.eq.dec (array_2) float64 840B 30.3 30.3 30.3 ... 30.3 30.3\n", | |
" spect.dopplerVeloc.opt (array_2) float64 840B 2.528e+03 ... 2.528e+03\n", | |
"Dimensions without coordinates: array_2</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'pos.eq.ra'</div><ul class='xr-dim-list'><li><span>array_2</span>: 105</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-658f29b9-063e-4838-a544-37f1bbe9b5d1' class='xr-array-in' type='checkbox' checked><label for='section-658f29b9-063e-4838-a544-37f1bbe9b5d1' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>51.74 51.73 51.73 51.72 51.71 51.7 ... 51.0 50.99 50.99 50.98 50.97</span></div><div class='xr-array-data'><pre>array([51.74010318, 51.73270331, 51.72530343, 51.71790356, 51.71050369,\n", | |
" 51.70310382, 51.69570395, 51.68830408, 51.68090421, 51.67350434,\n", | |
" 51.66610447, 51.6587046 , 51.65130472, 51.64390485, 51.63650498,\n", | |
" 51.62910511, 51.62170524, 51.61430537, 51.6069055 , 51.59950563,\n", | |
" 51.59210576, 51.58470589, 51.57730601, 51.56990614, 51.56250627,\n", | |
" 51.5551064 , 51.54770653, 51.54030666, 51.53290679, 51.52550692,\n", | |
" 51.51810705, 51.51070717, 51.5033073 , 51.49590743, 51.48850756,\n", | |
" 51.48110769, 51.47370782, 51.46630795, 51.45890808, 51.45150821,\n", | |
" 51.44410834, 51.43670846, 51.42930859, 51.42190872, 51.41450885,\n", | |
" 51.40710898, 51.39970911, 51.39230924, 51.38490937, 51.3775095 ,\n", | |
" 51.37010963, 51.36270975, 51.35530988, 51.34791001, 51.34051014,\n", | |
" 51.33311027, 51.3257104 , 51.31831053, 51.31091066, 51.30351079,\n", | |
" 51.29611091, 51.28871104, 51.28131117, 51.2739113 , 51.26651143,\n", | |
" 51.25911156, 51.25171169, 51.24431182, 51.23691195, 51.22951208,\n", | |
" 51.2221122 , 51.21471233, 51.20731246, 51.19991259, 51.19251272,\n", | |
" 51.18511285, 51.17771298, 51.17031311, 51.16291324, 51.15551337,\n", | |
" 51.14811349, 51.14071362, 51.13331375, 51.12591388, 51.11851401,\n", | |
" 51.11111414, 51.10371427, 51.0963144 , 51.08891453, 51.08151466,\n", | |
" 51.07411478, 51.06671491, 51.05931504, 51.05191517, 51.0445153 ,\n", | |
" 51.03711543, 51.02971556, 51.02231569, 51.01491582, 51.00751594,\n", | |
" 51.00011607, 50.9927162 , 50.98531633, 50.97791646, 50.97051659])</pre></div></div></li><li class='xr-section-item'><input id='section-c0bf5051-a075-4057-953b-0bd0adbc771b' class='xr-section-summary-in' type='checkbox' checked><label for='section-c0bf5051-a075-4057-953b-0bd0adbc771b' class='xr-section-summary' >Coordinates: <span>(3)</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>pos.eq.ra</span></div><div class='xr-var-dims'>(array_2)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>51.74 51.73 51.73 ... 50.98 50.97</div><input id='attrs-4f0875f7-803e-43c6-a237-751a6dc0377e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-4f0875f7-803e-43c6-a237-751a6dc0377e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-439d08fe-b711-40ad-a80f-c25ff2a60c0b' class='xr-var-data-in' type='checkbox'><label for='data-439d08fe-b711-40ad-a80f-c25ff2a60c0b' 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'></dl></div><div class='xr-var-data'><pre>array([51.74010318, 51.73270331, 51.72530343, 51.71790356, 51.71050369,\n", | |
" 51.70310382, 51.69570395, 51.68830408, 51.68090421, 51.67350434,\n", | |
" 51.66610447, 51.6587046 , 51.65130472, 51.64390485, 51.63650498,\n", | |
" 51.62910511, 51.62170524, 51.61430537, 51.6069055 , 51.59950563,\n", | |
" 51.59210576, 51.58470589, 51.57730601, 51.56990614, 51.56250627,\n", | |
" 51.5551064 , 51.54770653, 51.54030666, 51.53290679, 51.52550692,\n", | |
" 51.51810705, 51.51070717, 51.5033073 , 51.49590743, 51.48850756,\n", | |
" 51.48110769, 51.47370782, 51.46630795, 51.45890808, 51.45150821,\n", | |
" 51.44410834, 51.43670846, 51.42930859, 51.42190872, 51.41450885,\n", | |
" 51.40710898, 51.39970911, 51.39230924, 51.38490937, 51.3775095 ,\n", | |
" 51.37010963, 51.36270975, 51.35530988, 51.34791001, 51.34051014,\n", | |
" 51.33311027, 51.3257104 , 51.31831053, 51.31091066, 51.30351079,\n", | |
" 51.29611091, 51.28871104, 51.28131117, 51.2739113 , 51.26651143,\n", | |
" 51.25911156, 51.25171169, 51.24431182, 51.23691195, 51.22951208,\n", | |
" 51.2221122 , 51.21471233, 51.20731246, 51.19991259, 51.19251272,\n", | |
" 51.18511285, 51.17771298, 51.17031311, 51.16291324, 51.15551337,\n", | |
" 51.14811349, 51.14071362, 51.13331375, 51.12591388, 51.11851401,\n", | |
" 51.11111414, 51.10371427, 51.0963144 , 51.08891453, 51.08151466,\n", | |
" 51.07411478, 51.06671491, 51.05931504, 51.05191517, 51.0445153 ,\n", | |
" 51.03711543, 51.02971556, 51.02231569, 51.01491582, 51.00751594,\n", | |
" 51.00011607, 50.9927162 , 50.98531633, 50.97791646, 50.97051659])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>pos.eq.dec</span></div><div class='xr-var-dims'>(array_2)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>30.3 30.3 30.3 ... 30.3 30.3 30.3</div><input id='attrs-0363179e-f6f9-48f0-b599-f45638009c0b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0363179e-f6f9-48f0-b599-f45638009c0b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2de398b3-d484-495e-9120-b786da627a33' class='xr-var-data-in' type='checkbox'><label for='data-2de398b3-d484-495e-9120-b786da627a33' 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'></dl></div><div class='xr-var-data'><pre>array([30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469,\n", | |
" 30.30194469, 30.30194469, 30.30194469, 30.30194469, 30.30194469])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>spect.dopplerVeloc.opt</span></div><div class='xr-var-dims'>(array_2)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>2.528e+03 2.528e+03 ... 2.528e+03</div><input id='attrs-f6627e80-3366-4ec5-b1a8-4fbbc0b4c9b7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-f6627e80-3366-4ec5-b1a8-4fbbc0b4c9b7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-69304199-6d9b-4255-b8c2-418e684b51b6' class='xr-var-data-in' type='checkbox'><label for='data-69304199-6d9b-4255-b8c2-418e684b51b6' 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'></dl></div><div class='xr-var-data'><pre>array([2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695, 2528.19489695, 2528.19489695, 2528.19489695,\n", | |
" 2528.19489695])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-3ab740b4-a63d-4b69-8e99-79b9c4529189' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-3ab740b4-a63d-4b69-8e99-79b9c4529189' class='xr-section-summary' title='Expand/collapse section'>Indexes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-899c57b2-d850-402d-91cb-ad69460146c0' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-899c57b2-d850-402d-91cb-ad69460146c0' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>" | |
], | |
"text/plain": [ | |
"<xarray.DataArray 'pos.eq.ra' (array_2: 105)> Size: 840B\n", | |
"array([51.74010318, 51.73270331, 51.72530343, 51.71790356, 51.71050369,\n", | |
" 51.70310382, 51.69570395, 51.68830408, 51.68090421, 51.67350434,\n", | |
" 51.66610447, 51.6587046 , 51.65130472, 51.64390485, 51.63650498,\n", | |
" 51.62910511, 51.62170524, 51.61430537, 51.6069055 , 51.59950563,\n", | |
" 51.59210576, 51.58470589, 51.57730601, 51.56990614, 51.56250627,\n", | |
" 51.5551064 , 51.54770653, 51.54030666, 51.53290679, 51.52550692,\n", | |
" 51.51810705, 51.51070717, 51.5033073 , 51.49590743, 51.48850756,\n", | |
" 51.48110769, 51.47370782, 51.46630795, 51.45890808, 51.45150821,\n", | |
" 51.44410834, 51.43670846, 51.42930859, 51.42190872, 51.41450885,\n", | |
" 51.40710898, 51.39970911, 51.39230924, 51.38490937, 51.3775095 ,\n", | |
" 51.37010963, 51.36270975, 51.35530988, 51.34791001, 51.34051014,\n", | |
" 51.33311027, 51.3257104 , 51.31831053, 51.31091066, 51.30351079,\n", | |
" 51.29611091, 51.28871104, 51.28131117, 51.2739113 , 51.26651143,\n", | |
" 51.25911156, 51.25171169, 51.24431182, 51.23691195, 51.22951208,\n", | |
" 51.2221122 , 51.21471233, 51.20731246, 51.19991259, 51.19251272,\n", | |
" 51.18511285, 51.17771298, 51.17031311, 51.16291324, 51.15551337,\n", | |
" 51.14811349, 51.14071362, 51.13331375, 51.12591388, 51.11851401,\n", | |
" 51.11111414, 51.10371427, 51.0963144 , 51.08891453, 51.08151466,\n", | |
" 51.07411478, 51.06671491, 51.05931504, 51.05191517, 51.0445153 ,\n", | |
" 51.03711543, 51.02971556, 51.02231569, 51.01491582, 51.00751594,\n", | |
" 51.00011607, 50.9927162 , 50.98531633, 50.97791646, 50.97051659])\n", | |
"Coordinates:\n", | |
" pos.eq.ra (array_2) float64 840B 51.74 51.73 ... 50.98 50.97\n", | |
" pos.eq.dec (array_2) float64 840B 30.3 30.3 30.3 ... 30.3 30.3\n", | |
" spect.dopplerVeloc.opt (array_2) float64 840B 2.528e+03 ... 2.528e+03\n", | |
"Dimensions without coordinates: array_2" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"import xarray as xr\n", | |
"from xarray.indexes import CoordinateTransformIndex\n", | |
"import numpy as np\n", | |
"from astropy.wcs import WCS\n", | |
"from astropy.io import fits\n", | |
"from astropy.utils.data import get_pkg_data_filename\n", | |
"\n", | |
"\n", | |
"class APE14CoordinateTransform(xr.CoordinateTransform):\n", | |
"\n", | |
" def __init__(\n", | |
" self,\n", | |
" wcs,\n", | |
" ):\n", | |
"\n", | |
" pixel_axis_names = [pan or f\"array_{i}\" for i, pan in enumerate(wcs.pixel_axis_names)]\n", | |
" dim_size = {name: size for (name, size) in zip(pixel_axis_names, wcs.array_shape)}\n", | |
"\n", | |
" world_axis_names = [wan or wphy or f\"world_{i}\" for i, (wan, wphy) in enumerate(zip(wcs.world_axis_names, wcs.world_axis_physical_types))]\n", | |
"\n", | |
" super().__init__(world_axis_names, dim_size, dtype=np.dtype(float))\n", | |
"\n", | |
" self.wcs = wcs\n", | |
"\n", | |
" def forward(self, dim_positions):\n", | |
"\n", | |
" pixel = [dim_positions[dim] for dim in self.dims]\n", | |
"\n", | |
" world = self.wcs.array_index_to_world_values(*pixel)\n", | |
"\n", | |
" results = {}\n", | |
" for name, w in zip(self.coord_names, world):\n", | |
" results[name] = w\n", | |
"\n", | |
" return results\n", | |
"\n", | |
" def reverse(self, coord_labels):\n", | |
"\n", | |
" world = [coord_labels[dim] for dim in self.coord_names]\n", | |
"\n", | |
" pixel = self.wcs.world_to_array_index_values(*world)\n", | |
"\n", | |
" results = {}\n", | |
" for name, p in zip(self.dims, pixel):\n", | |
" results[name] = p\n", | |
"\n", | |
" return results\n", | |
"\n", | |
"\n", | |
"filename = get_pkg_data_filename('l1448/l1448_13co.fits')\n", | |
"hdu = fits.open(filename)[0]\n", | |
"wcs = WCS(hdu.header)\n", | |
"data = hdu.data\n", | |
"\n", | |
"transform = APE14CoordinateTransform(wcs)\n", | |
"index = CoordinateTransformIndex(transform)\n", | |
"coords = xr.Coordinates(coords=index.create_variables())\n", | |
"\n", | |
"ds = xr.Dataset({'primary': (transform.dims, data)}, coords=coords)\n", | |
"\n", | |
"ds['pos.eq.ra'][0, 0, :]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"id": "a2b9ad75-93e0-414d-b4b0-6477bde13513", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"ename": "IndexError", | |
"evalue": "out of bounds index", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/IPython/core/formatters.py:711\u001b[0m, in \u001b[0;36mPlainTextFormatter.__call__\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 704\u001b[0m stream \u001b[38;5;241m=\u001b[39m StringIO()\n\u001b[1;32m 705\u001b[0m printer \u001b[38;5;241m=\u001b[39m pretty\u001b[38;5;241m.\u001b[39mRepresentationPrinter(stream, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mverbose,\n\u001b[1;32m 706\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_width, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnewline,\n\u001b[1;32m 707\u001b[0m max_seq_length\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_seq_length,\n\u001b[1;32m 708\u001b[0m singleton_pprinters\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msingleton_printers,\n\u001b[1;32m 709\u001b[0m type_pprinters\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_printers,\n\u001b[1;32m 710\u001b[0m deferred_pprinters\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdeferred_printers)\n\u001b[0;32m--> 711\u001b[0m \u001b[43mprinter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpretty\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 712\u001b[0m printer\u001b[38;5;241m.\u001b[39mflush()\n\u001b[1;32m 713\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m stream\u001b[38;5;241m.\u001b[39mgetvalue()\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/IPython/lib/pretty.py:411\u001b[0m, in \u001b[0;36mRepresentationPrinter.pretty\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 408\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m meth(obj, \u001b[38;5;28mself\u001b[39m, cycle)\n\u001b[1;32m 409\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mobject\u001b[39m \\\n\u001b[1;32m 410\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mcallable\u001b[39m(\u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__dict__\u001b[39m\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m__repr__\u001b[39m\u001b[38;5;124m'\u001b[39m)):\n\u001b[0;32m--> 411\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_repr_pprint\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcycle\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 413\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _default_pprint(obj, \u001b[38;5;28mself\u001b[39m, cycle)\n\u001b[1;32m 414\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/IPython/lib/pretty.py:779\u001b[0m, in \u001b[0;36m_repr_pprint\u001b[0;34m(obj, p, cycle)\u001b[0m\n\u001b[1;32m 777\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"A pprint that just redirects to the normal repr function.\"\"\"\u001b[39;00m\n\u001b[1;32m 778\u001b[0m \u001b[38;5;66;03m# Find newlines and replace them with p.break_()\u001b[39;00m\n\u001b[0;32m--> 779\u001b[0m output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mrepr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 780\u001b[0m lines \u001b[38;5;241m=\u001b[39m output\u001b[38;5;241m.\u001b[39msplitlines()\n\u001b[1;32m 781\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m p\u001b[38;5;241m.\u001b[39mgroup():\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/dataset.py:2592\u001b[0m, in \u001b[0;36mDataset.__repr__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 2591\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__repr__\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mstr\u001b[39m:\n\u001b[0;32m-> 2592\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mformatting\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdataset_repr\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/reprlib.py:21\u001b[0m, in \u001b[0;36mrecursive_repr.<locals>.decorating_function.<locals>.wrapper\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 19\u001b[0m repr_running\u001b[38;5;241m.\u001b[39madd(key)\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 21\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43muser_function\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 22\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m 23\u001b[0m repr_running\u001b[38;5;241m.\u001b[39mdiscard(key)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting.py:748\u001b[0m, in \u001b[0;36mdataset_repr\u001b[0;34m(ds)\u001b[0m\n\u001b[1;32m 745\u001b[0m summary\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdims_start\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m(\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdims_values\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m)\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 747\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ds\u001b[38;5;241m.\u001b[39mcoords:\n\u001b[0;32m--> 748\u001b[0m summary\u001b[38;5;241m.\u001b[39mappend(\u001b[43mcoords_repr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mds\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcoords\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcol_width\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcol_width\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_rows\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_rows\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 750\u001b[0m unindexed_dims_str \u001b[38;5;241m=\u001b[39m unindexed_dims_repr(ds\u001b[38;5;241m.\u001b[39mdims, ds\u001b[38;5;241m.\u001b[39mcoords, max_rows\u001b[38;5;241m=\u001b[39mmax_rows)\n\u001b[1;32m 751\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m unindexed_dims_str:\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting.py:439\u001b[0m, in \u001b[0;36mcoords_repr\u001b[0;34m(coords, col_width, max_rows)\u001b[0m\n\u001b[1;32m 437\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m col_width \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 438\u001b[0m col_width \u001b[38;5;241m=\u001b[39m _calculate_col_width(coords)\n\u001b[0;32m--> 439\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_mapping_repr\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 440\u001b[0m \u001b[43m \u001b[49m\u001b[43mcoords\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 441\u001b[0m \u001b[43m \u001b[49m\u001b[43mtitle\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mCoordinates\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 442\u001b[0m \u001b[43m \u001b[49m\u001b[43msummarizer\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msummarize_variable\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 443\u001b[0m \u001b[43m \u001b[49m\u001b[43mexpand_option_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdisplay_expand_coords\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 444\u001b[0m \u001b[43m \u001b[49m\u001b[43mcol_width\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcol_width\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 445\u001b[0m \u001b[43m \u001b[49m\u001b[43mindexes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcoords\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mxindexes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 446\u001b[0m \u001b[43m \u001b[49m\u001b[43mmax_rows\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_rows\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 447\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting.py:413\u001b[0m, in \u001b[0;36m_mapping_repr\u001b[0;34m(mapping, title, summarizer, expand_option_name, col_width, max_rows, indexes)\u001b[0m\n\u001b[1;32m 407\u001b[0m summary \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 408\u001b[0m summarizer(k, mapping[k], col_width, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39msummarizer_kwargs[k])\n\u001b[1;32m 409\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m k \u001b[38;5;129;01min\u001b[39;00m keys[\u001b[38;5;241m-\u001b[39mlast_rows:]\n\u001b[1;32m 410\u001b[0m ]\n\u001b[1;32m 411\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 412\u001b[0m summary \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m--> 413\u001b[0m \u001b[43msummarizer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mv\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcol_width\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[43msummarizer_kwargs\u001b[49m\u001b[43m[\u001b[49m\u001b[43mk\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 414\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m mapping\u001b[38;5;241m.\u001b[39mitems()\n\u001b[1;32m 415\u001b[0m ]\n\u001b[1;32m 416\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 417\u001b[0m summary \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m [EMPTY_REPR]\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting.py:349\u001b[0m, in \u001b[0;36msummarize_variable\u001b[0;34m(name, var, col_width, max_width, is_index)\u001b[0m\n\u001b[1;32m 346\u001b[0m front_str \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfirst_col\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;132;01m{\u001b[39;00mdims_str\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;132;01m{\u001b[39;00mvariable\u001b[38;5;241m.\u001b[39mdtype\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;132;01m{\u001b[39;00mnbytes_str\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 348\u001b[0m values_width \u001b[38;5;241m=\u001b[39m max_width \u001b[38;5;241m-\u001b[39m \u001b[38;5;28mlen\u001b[39m(front_str)\n\u001b[0;32m--> 349\u001b[0m values_str \u001b[38;5;241m=\u001b[39m \u001b[43minline_variable_array_repr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalues_width\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 351\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m front_str \u001b[38;5;241m+\u001b[39m values_str\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting.py:305\u001b[0m, in \u001b[0;36minline_variable_array_repr\u001b[0;34m(var, max_width)\u001b[0m\n\u001b[1;32m 303\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Build a one-line summary of a variable's data.\"\"\"\u001b[39;00m\n\u001b[1;32m 304\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(var\u001b[38;5;241m.\u001b[39m_data, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_repr_inline_\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m--> 305\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mvar\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_data\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_repr_inline_\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmax_width\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 306\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m var\u001b[38;5;241m.\u001b[39m_in_memory:\n\u001b[1;32m 307\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m format_array_flat(var, max_width)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:2069\u001b[0m, in \u001b[0;36mCoordinateTransformIndexingAdapter._repr_inline_\u001b[0;34m(self, max_width)\u001b[0m\n\u001b[1;32m 2066\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Good to see some labels even for a lazy coordinate.\"\"\"\u001b[39;00m\n\u001b[1;32m 2067\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mformatting\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m format_array_flat\n\u001b[0;32m-> 2069\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m format_array_flat(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_array_subset\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m, max_width)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:2059\u001b[0m, in \u001b[0;36mCoordinateTransformIndexingAdapter._get_array_subset\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 2057\u001b[0m pos \u001b[38;5;241m=\u001b[39m threshold \u001b[38;5;241m/\u001b[39m\u001b[38;5;241m/\u001b[39m \u001b[38;5;241m2\u001b[39m\n\u001b[1;32m 2058\u001b[0m indices \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mconcatenate([np\u001b[38;5;241m.\u001b[39marange(\u001b[38;5;241m0\u001b[39m, pos), np\u001b[38;5;241m.\u001b[39marange(\u001b[38;5;241m-\u001b[39mpos, \u001b[38;5;241m0\u001b[39m)])\n\u001b[0;32m-> 2059\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvindex\u001b[49m\u001b[43m[\u001b[49m\u001b[43mVectorizedIndexer\u001b[49m\u001b[43m(\u001b[49m\u001b[43m(\u001b[49m\u001b[43mindices\u001b[49m\u001b[43m,\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mndim\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 2060\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2061\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:369\u001b[0m, in \u001b[0;36mIndexCallable.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 368\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__getitem__\u001b[39m(\u001b[38;5;28mself\u001b[39m, key: Any) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Any:\n\u001b[0;32m--> 369\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:2024\u001b[0m, in \u001b[0;36mCoordinateTransformIndexingAdapter._vindex_get\u001b[0;34m(self, indexer)\u001b[0m\n\u001b[1;32m 2020\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, (dim, pos) \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(\n\u001b[1;32m 2021\u001b[0m \u001b[38;5;28mzip\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_dims, array_indexer\u001b[38;5;241m.\u001b[39mtuple, strict\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m 2022\u001b[0m ):\n\u001b[1;32m 2023\u001b[0m pos \u001b[38;5;241m=\u001b[39m _posify_indices(pos, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape[i])\n\u001b[0;32m-> 2024\u001b[0m \u001b[43m_check_bounds\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpos\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mshape\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2025\u001b[0m dim_positions[dim] \u001b[38;5;241m=\u001b[39m pos\n\u001b[1;32m 2027\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_transform\u001b[38;5;241m.\u001b[39mforward(dim_positions)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:1319\u001b[0m, in \u001b[0;36m_check_bounds\u001b[0;34m(indices, size)\u001b[0m\n\u001b[1;32m 1317\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Check if the given indices are all within the array boundaries.\"\"\"\u001b[39;00m\n\u001b[1;32m 1318\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m np\u001b[38;5;241m.\u001b[39many((indices \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m0\u001b[39m) \u001b[38;5;241m|\u001b[39m (indices \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m size)):\n\u001b[0;32m-> 1319\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mout of bounds index\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", | |
"\u001b[0;31mIndexError\u001b[0m: out of bounds index" | |
] | |
}, | |
{ | |
"ename": "IndexError", | |
"evalue": "out of bounds index", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/IPython/core/formatters.py:347\u001b[0m, in \u001b[0;36mBaseFormatter.__call__\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 345\u001b[0m method \u001b[38;5;241m=\u001b[39m get_real_method(obj, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprint_method)\n\u001b[1;32m 346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m method \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[0;32m--> 347\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmethod\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 348\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 349\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/dataset.py:2597\u001b[0m, in \u001b[0;36mDataset._repr_html_\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 2595\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m OPTIONS[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdisplay_style\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 2596\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m<pre>\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mescape(\u001b[38;5;28mrepr\u001b[39m(\u001b[38;5;28mself\u001b[39m))\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m</pre>\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m-> 2597\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mformatting_html\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdataset_repr\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting_html.py:342\u001b[0m, in \u001b[0;36mdataset_repr\u001b[0;34m(ds)\u001b[0m\n\u001b[1;32m 336\u001b[0m obj_type \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxarray.\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(ds)\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 338\u001b[0m header_components \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m<div class=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mxr-obj-type\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m>\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mescape(obj_type)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m</div>\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 340\u001b[0m sections \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 341\u001b[0m dim_section(ds),\n\u001b[0;32m--> 342\u001b[0m \u001b[43mcoord_section\u001b[49m\u001b[43m(\u001b[49m\u001b[43mds\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcoords\u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 343\u001b[0m datavar_section(ds\u001b[38;5;241m.\u001b[39mdata_vars),\n\u001b[1;32m 344\u001b[0m index_section(_get_indexes_dict(ds\u001b[38;5;241m.\u001b[39mxindexes)),\n\u001b[1;32m 345\u001b[0m attr_section(ds\u001b[38;5;241m.\u001b[39mattrs),\n\u001b[1;32m 346\u001b[0m ]\n\u001b[1;32m 348\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _obj_repr(ds, header_components, sections)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting_html.py:205\u001b[0m, in \u001b[0;36m_mapping_section\u001b[0;34m(mapping, name, details_func, max_items_collapse, expand_option_name, enabled)\u001b[0m\n\u001b[1;32m 198\u001b[0m expanded \u001b[38;5;241m=\u001b[39m _get_boolean_with_default(\n\u001b[1;32m 199\u001b[0m expand_option_name, n_items \u001b[38;5;241m<\u001b[39m max_items_collapse\n\u001b[1;32m 200\u001b[0m )\n\u001b[1;32m 201\u001b[0m collapsed \u001b[38;5;241m=\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m expanded\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m collapsible_section(\n\u001b[1;32m 204\u001b[0m name,\n\u001b[0;32m--> 205\u001b[0m details\u001b[38;5;241m=\u001b[39m\u001b[43mdetails_func\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmapping\u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 206\u001b[0m n_items\u001b[38;5;241m=\u001b[39mn_items,\n\u001b[1;32m 207\u001b[0m enabled\u001b[38;5;241m=\u001b[39menabled,\n\u001b[1;32m 208\u001b[0m collapsed\u001b[38;5;241m=\u001b[39mcollapsed,\n\u001b[1;32m 209\u001b[0m )\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting_html.py:121\u001b[0m, in \u001b[0;36msummarize_coords\u001b[0;34m(variables)\u001b[0m\n\u001b[1;32m 119\u001b[0m li_items \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 120\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m variables\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m--> 121\u001b[0m li_content \u001b[38;5;241m=\u001b[39m \u001b[43msummarize_variable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mv\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mis_index\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mk\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mxindexes\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 122\u001b[0m li_items\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m<li class=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mxr-var-item\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m>\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mli_content\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m</li>\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 124\u001b[0m vars_li \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(li_items)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting_html.py:94\u001b[0m, in \u001b[0;36msummarize_variable\u001b[0;34m(name, var, is_index, dtype)\u001b[0m\n\u001b[1;32m 91\u001b[0m data_id \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata-\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(uuid\u001b[38;5;241m.\u001b[39muuid4())\n\u001b[1;32m 92\u001b[0m disabled \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(var\u001b[38;5;241m.\u001b[39mattrs) \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdisabled\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 94\u001b[0m preview \u001b[38;5;241m=\u001b[39m escape(\u001b[43minline_variable_array_repr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m35\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 95\u001b[0m attrs_ul \u001b[38;5;241m=\u001b[39m summarize_attrs(var\u001b[38;5;241m.\u001b[39mattrs)\n\u001b[1;32m 96\u001b[0m data_repr \u001b[38;5;241m=\u001b[39m short_data_repr_html(variable)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/formatting.py:305\u001b[0m, in \u001b[0;36minline_variable_array_repr\u001b[0;34m(var, max_width)\u001b[0m\n\u001b[1;32m 303\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Build a one-line summary of a variable's data.\"\"\"\u001b[39;00m\n\u001b[1;32m 304\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(var\u001b[38;5;241m.\u001b[39m_data, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_repr_inline_\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m--> 305\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mvar\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_data\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_repr_inline_\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmax_width\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 306\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m var\u001b[38;5;241m.\u001b[39m_in_memory:\n\u001b[1;32m 307\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m format_array_flat(var, max_width)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:2069\u001b[0m, in \u001b[0;36mCoordinateTransformIndexingAdapter._repr_inline_\u001b[0;34m(self, max_width)\u001b[0m\n\u001b[1;32m 2066\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Good to see some labels even for a lazy coordinate.\"\"\"\u001b[39;00m\n\u001b[1;32m 2067\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mformatting\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m format_array_flat\n\u001b[0;32m-> 2069\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m format_array_flat(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_array_subset\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m, max_width)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:2059\u001b[0m, in \u001b[0;36mCoordinateTransformIndexingAdapter._get_array_subset\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 2057\u001b[0m pos \u001b[38;5;241m=\u001b[39m threshold \u001b[38;5;241m/\u001b[39m\u001b[38;5;241m/\u001b[39m \u001b[38;5;241m2\u001b[39m\n\u001b[1;32m 2058\u001b[0m indices \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mconcatenate([np\u001b[38;5;241m.\u001b[39marange(\u001b[38;5;241m0\u001b[39m, pos), np\u001b[38;5;241m.\u001b[39marange(\u001b[38;5;241m-\u001b[39mpos, \u001b[38;5;241m0\u001b[39m)])\n\u001b[0;32m-> 2059\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvindex\u001b[49m\u001b[43m[\u001b[49m\u001b[43mVectorizedIndexer\u001b[49m\u001b[43m(\u001b[49m\u001b[43m(\u001b[49m\u001b[43mindices\u001b[49m\u001b[43m,\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mndim\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 2060\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2061\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:369\u001b[0m, in \u001b[0;36mIndexCallable.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 368\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__getitem__\u001b[39m(\u001b[38;5;28mself\u001b[39m, key: Any) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Any:\n\u001b[0;32m--> 369\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:2024\u001b[0m, in \u001b[0;36mCoordinateTransformIndexingAdapter._vindex_get\u001b[0;34m(self, indexer)\u001b[0m\n\u001b[1;32m 2020\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, (dim, pos) \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(\n\u001b[1;32m 2021\u001b[0m \u001b[38;5;28mzip\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_dims, array_indexer\u001b[38;5;241m.\u001b[39mtuple, strict\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m 2022\u001b[0m ):\n\u001b[1;32m 2023\u001b[0m pos \u001b[38;5;241m=\u001b[39m _posify_indices(pos, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape[i])\n\u001b[0;32m-> 2024\u001b[0m \u001b[43m_check_bounds\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpos\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mshape\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2025\u001b[0m dim_positions[dim] \u001b[38;5;241m=\u001b[39m pos\n\u001b[1;32m 2027\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_transform\u001b[38;5;241m.\u001b[39mforward(dim_positions)\n", | |
"File \u001b[0;32m/opt/coiled/env/lib/python3.12/site-packages/xarray/core/indexing.py:1319\u001b[0m, in \u001b[0;36m_check_bounds\u001b[0;34m(indices, size)\u001b[0m\n\u001b[1;32m 1317\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Check if the given indices are all within the array boundaries.\"\"\"\u001b[39;00m\n\u001b[1;32m 1318\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m np\u001b[38;5;241m.\u001b[39many((indices \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m0\u001b[39m) \u001b[38;5;241m|\u001b[39m (indices \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m size)):\n\u001b[0;32m-> 1319\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mout of bounds index\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", | |
"\u001b[0;31mIndexError\u001b[0m: out of bounds index" | |
] | |
} | |
], | |
"source": [ | |
"ds" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "395f247c-bd3d-4c57-bd2d-20bdd3c68ce7", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.12.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of
you should do
so the coordinates of the Dataset have an attached index (enabling those coordinates to be used with
ds.sel(...)
,xr.align(ds)
, etc.).