indexing via any coordinate label values #4585
-
Giving this So, the indexing docs say a lot that indexing by label values is a good and supported way of indexing. In this example: I have assigned lat/lon coordinates to the corresponding x/y dimensions that came "natively" from the dem.data.sel(lat=slice(80, -80))
[...]
ValueError: dimensions or multi-index levels ['lat'] do not exist Am I wrong to assume that assigning new coordinates is usually motivated by either:
but I don't find a single clear mentioning how to continue working with the new coordinates after assigning them? If |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
At the moment, since lon and x coordinates share the same dimension, x, you can swap_dims so that lon becomes the dimension: |
Beta Was this translation helpful? Give feedback.
At the moment, since lon and x coordinates share the same dimension, x, you can swap_dims so that lon becomes the dimension:
dem.swap_dims({'x': 'lon'}).sel(lat=slice(80, -80))
I believe there is an ongoing effort to refactor index
#475 (comment)