-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subset stars based on attribute value #178
Comments
See section 4.2.3 of http://r-spatial.org/book/ for masking out areas based on attribute(s). There is (currently) no auto-crop based on NA edges; you can use |
Thanks for the quick response and for the pointers, I will study this further! As this is for a workflow on several rasters where the NA edges cannot be easily predicted, I think I'll have to convert forth and back to/from raster. I'm using |
See #176 for raster round tripping, but that approach might fail if the size of the returned sub-array changes randomly. |
I hope this is a sensible question; I'm yet starting with
stars
, which looks very promising to me. Maybe I still overlooked an available solution for my question.In the
raster
package one can produce a raster subset based on the cell values (for x and y dimensions at once), e.g. :rasterobj[rasterobj > 10, drop = FALSE]
It sets the non-conforming cells to
NA
.Further, if
rasterobj
has pure 'NA
' rows and/or columns at the edges, the following effectively crops these and reduces the extent:rasterobj[!is.na(rasterobj), drop = FALSE]
My case at hand is the last one. I could not find an equivalent 'subsetting' application in stars for this purpose, but maybe you can help.
I've looked into the migration table but saw no specific mention.
The text was updated successfully, but these errors were encountered: