Skip to content

I don't understand this .rio.clip behavior #557

Answered by snowman2
jessjaco asked this question in Q&A
Discussion options

You must be logged in to vote

This is a really great analysis into the current behavior. Here are some answers that will hopefully provide some insight. Please follow up if you have further questions or I missed something.

If I cast the dataarray before the clip, from_disk=True works. But if you'll recall the dtype of the masked array was already float64.
What am I missing?

If you use from_disk=True, you need to do it immediately after opening the raster. rio.clip falls back to from_disk=False if it cannot find the handle to the original raster. The handle is easily lost if you perform operations on the DataArray. The handle is likely being lost when you call astype after opening the raster and so it is falling back…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jessjaco
Comment options

Answer selected by jessjaco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants