Skip to content

Commit ed8bfd5

Browse files
committed
set roll_coords=True
1 parent abfb00b commit ed8bfd5

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

custom-index.ipynb

+15-32
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
{
142142
"data": {
143143
"text/plain": [
144-
"<__main__.KDTreeIndex at 0x7f4606b8b8b0>"
144+
"<__main__.KDTreeIndex at 0x7f020877eee0>"
145145
]
146146
},
147147
"execution_count": 5,
@@ -216,10 +216,10 @@
216216
"data": {
217217
"text/plain": [
218218
"Indexes:\n",
219-
"lat: <__main__.KDTreeIndex object at 0x7f4606b8b8b0>\n",
220-
"lon: <__main__.KDTreeIndex object at 0x7f4606b8b8b0>\n",
221-
"x: <xarray.core.indexes.PandasIndex object at 0x7f4606b8aea0>\n",
222-
"y: <xarray.core.indexes.PandasIndex object at 0x7f45fd3ddc20>"
219+
"lat: <__main__.KDTreeIndex object at 0x7f020877eee0>\n",
220+
"lon: <__main__.KDTreeIndex object at 0x7f020877eee0>\n",
221+
"x: <xarray.core.indexes.PandasIndex object at 0x7f01bf793400>\n",
222+
"y: <xarray.core.indexes.PandasIndex object at 0x7f01b5f0d180>"
223223
]
224224
},
225225
"execution_count": 7,
@@ -318,8 +318,8 @@
318318
"data": {
319319
"text/plain": [
320320
"Indexes:\n",
321-
"x: <xarray.core.indexes.PandasIndex object at 0x7f4606b25590>\n",
322-
"y: <xarray.core.indexes.PandasIndex object at 0x7f4606b25220>"
321+
"x: <xarray.core.indexes.PandasIndex object at 0x7f01bf793720>\n",
322+
"y: <xarray.core.indexes.PandasIndex object at 0x7f01bf793540>"
323323
]
324324
},
325325
"execution_count": 10,
@@ -348,27 +348,10 @@
348348
"outputs": [
349349
{
350350
"data": {
351-
"text/html": [
352-
"<pre>&lt;xarray.DataArray (points: 3)&gt;\n",
353-
"0.1097 -0.397 -0.7046\n",
354-
"Coordinates:\n",
355-
" lat (points) float64 0.7 10.2 17.6\n",
356-
" lon (points) float64 8.9 3.1 9.1\n",
357-
" x (points) int64 89 31 91\n",
358-
" y (points) int64 907 1002 1076\n",
359-
" distance (points) float64 0.04993 0.02385 0.06931\n",
360-
"Dimensions without coordinates: points</pre>"
361-
],
362351
"text/plain": [
363-
"<xarray.DataArray (points: 3)>\n",
364-
"0.1097 -0.397 -0.7046\n",
365-
"Coordinates:\n",
366-
" lat (points) float64 0.7 10.2 17.6\n",
367-
" lon (points) float64 8.9 3.1 9.1\n",
368-
" x (points) int64 89 31 91\n",
369-
" y (points) int64 907 1002 1076\n",
370-
" distance (points) float64 0.04993 0.02385 0.06931\n",
371-
"Dimensions without coordinates: points"
352+
"Indexes:\n",
353+
"x: <xarray.core.indexes.PandasIndex object at 0x7f020878bc20>\n",
354+
"y: <xarray.core.indexes.PandasIndex object at 0x7f01bf793c70>"
372355
]
373356
},
374357
"execution_count": 11,
@@ -377,8 +360,8 @@
377360
}
378361
],
379362
"source": [
380-
"rolled = new_arr.roll(x=5, y=10)\n",
381-
"rolled.sel(indexers) # for easier comparison"
363+
"rolled = new_arr.roll(x=5, y=10, roll_coords=True)\n",
364+
"rolled.xindexes"
382365
]
383366
},
384367
{
@@ -399,9 +382,9 @@
399382
"data": {
400383
"text/plain": [
401384
"Indexes:\n",
402-
"z: <xarray.core.indexes.PandasMultiIndex object at 0x7f45fd3e39e0>\n",
403-
"x: <xarray.core.indexes.PandasMultiIndex object at 0x7f45fd3e39e0>\n",
404-
"y: <xarray.core.indexes.PandasMultiIndex object at 0x7f45fd3e39e0>"
385+
"z: <xarray.core.indexes.PandasMultiIndex object at 0x7f01b6048c80>\n",
386+
"x: <xarray.core.indexes.PandasMultiIndex object at 0x7f01b6048c80>\n",
387+
"y: <xarray.core.indexes.PandasMultiIndex object at 0x7f01b6048c80>"
405388
]
406389
},
407390
"execution_count": 12,

0 commit comments

Comments
 (0)