Closed glaroc closed 1 year ago
No, there is currently no method to reduce the spatial resolution of a cube. The implementation should be relatively straightforward though, because there is already aggregate_time()
, which seems to do exactly this (but in time). Happy to work on aggregate_space
for the next release. For now, maybe terra
/ stars
can do this without loading everything into memory?
Yes, an aggreate_space
function would be perfect for this!
This is now added to the GitHub version of the package. Still needs some more testing but the following should now work:
prop12 <- raster_cube(col, cube_view(dx = 250, dy = 250, ....),...) |>
apply_pixel(function(v) {v[1]==12}) |>
aggregate_space(dx = 1000, dy = 1000, method = "mean")
Wonderful ! We'll test it and let you know if we have issues!
It seems to work like charm! Thank you for putting this together so quickly.
We have a use case where we would like to take a land cover map, say at 250 meter resolution, isolate one category, and resample it at 1 km resolution to identify the proportion of 250 m pixels of that category within each 1km pixel. In other words, we would need to do something like
This is not possible, but is there another way of doing this without bringing the 250 m raster in memory ?