Select on non-dimension coordinate #10913
Unanswered
SBouchard01
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The problem
I have a coordinate that has 3 sub-coordinates I want to apply selections to. I don't want to use
MultiIndexobjects, as I'm usingstackandunstacklater on, and I don't want those coordinates to unstack and addNaNall over my array. Here is an example of what the DataArray would look like :The constraint is that
valuesis of shape(time, space)so I can't have x, y and z as dimension coordinates.I want to select slices of
vwith conditions on x, y and z, butv.sel(x=slice(0.1, 0.3), y=slice(2.5, 2.7), z=slice(4.2, 4.4))does not work as x, y and z are not dimensions coordinates:Note
This is a simple example, so I'm using time and space, in reality those would be indices related to each value in the last dimension of the array, hence the impossibility to increase the array dimensions
What I have tried
MultiIndexobjects do not work as expected, and as I said earlier I don't want those to unstack later.sel(dict):Tip
Notice that I call
.selon each coordinate separately, otherwise I get the following error:I'm interested to know if there is a workaround that could allow me to use
.selonvwithout having a MultiIndex object in the coordinatesBeta Was this translation helpful? Give feedback.
All reactions