Comments (5)
Have you tried aggregate
?, as in
aggregate(tile_proxy, tt, mean, na.rm = TRUE)
from stars.
Maybe it will be even better to use the exact = TRUE
argument to engage exactextractr (it is very fast for summarizing values)?
Edit: I checked the source of the aggregate()
and basically exact_extract()
is not used, so you need to test {terra}
as backend.
from stars.
No luck with aggregate - similar behaviour to st_apply - slowly consumes RAM/virtual memory until crashing.
I'll look into terra and exact_extract
from stars.
exactextractr::exact_extract
works well, crunching through the test set in under a minute while using minimal RAM
library(exactextractr)
a <- raster::raster(tifname)
g <- exact_extract(a, tt, "mean")
# should work with either terra or raster loaders
a <- terra::rast(tifname)
g <- exact_extract(a, tt, "mean")
terra::extract had the same ram problem as the stars approach:
a <- terra::rast(tifname)
g <- terra::extract(a, tt, mean, na.rm = TRUE)
raster::extract didn't appear to have a RAM problem, but took a really long time - I gave up after over an hour.
a <- raster::raster(tifname)
g <- raster::extract(a, tt, mean, na.rm = TRUE)
from stars.
If you are interested in the highest efficiency, I think the best option will be to use exact_extract()
with SpatRaster, it should be faster than for RasterLayer. See these benchmarks:
- https://github.com/isciences/exactextractr?tab=readme-ov-file#performance
- https://kadyb.github.io/raster-benchmark/report.html#Zonal_statistics
from stars.
Related Issues (20)
- Exporting s3 methods from namespace HOT 3
- Reading local Zarr files into stars HOT 13
- netcdf CF 1-8 conform data is missing meta data HOT 1
- Behaviour of `aggregate.stars` when multiple overlaps occur in the same raster pixel HOT 6
- Pixels in the border get weird values with `st_rasterize()` HOT 5
- Enhancement Request: Direct Access to Band Values Using Band Names in stars Object HOT 2
- Non `udunits` confirm units break the read in of netcdf files HOT 5
- st_rasterize Error in rep_len HOT 4
- Unexpected behavior: st_transform a raster and transforming back, it is not identical unless applying st_warp HOT 7
- Three different stars object descriptions from the same file HOT 4
- Proposal: Record time dimension in stars objects using CFtime package HOT 6
- Issues with particular file: North American Land Cover (NALC) Dataset HOT 5
- Additional nest in dimension while reading HDF5 file and terra workaround solution HOT 7
- GDAL Access window out of range on read-in of stars_proxy HOT 2
- aggregate.stars mean by time (by = "2 days") HOT 2
- netcdf dimensions get messed up if they are out of order and if axis attributes are available HOT 12
- starsdata not available, stars fails revdeps. HOT 7
- issue using `st_cells()` on a cropped image HOT 3
- An error occurred while using the st_get_dimension_values function to obtain the time HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stars.