Repository navigation
is there a neat way to reduce entire dataset dimension size x and y without changing datatype for variables? #6465
Answered
by
keewis
oswald1234
asked this question in
Q&A
|
I'm trying to reduce my xarray dataset dimension (x and y) by one, e.g. 257x257 to 256x256. This code is what I have tried:
When I run this code, all variables change the data type to float64 (probably because where() statement converts to "nan" while selecting data). Is there a better way of doing this without changing the data type of all the variables to float64? |
Answered by
keewis
Apr 10, 2022
Replies: 1 comment
|
this really depends on what value you want to drop, but you could use cube.isel(x=slice(None, -1), y=slice(None, -1)) |
0 replies
Answer selected by
oswald1234
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this really depends on what value you want to drop, but you could use
iselwith the appropriateslice, e.g. to drop the last element: