Skip to content
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

Allow SpatVect geom inputs #19

Open
mikejohnson51 opened this issue Jun 2, 2022 · 0 comments
Open

Allow SpatVect geom inputs #19

mikejohnson51 opened this issue Jun 2, 2022 · 0 comments

Comments

@mikejohnson51
Copy link
Owner

Many workflows can be done using sf only for reading the polygon data. Allowing zonal to take SpatVect objects can remove the need for sf in these cases. This will also need to be allowed in opendap.catalog

Ideal behavior:

library(terra)
library(hydrofabric)
#> ── Attaching packages ────────────────────────────────────── hydrofabric0.0.2 ──
#> ✔ nhdplusTools    0.5.2          ✔ zonal           0.0.1     
#> ✔ hyRefactor      0.4.6.9010     ✔ opendap.catalog 0.0.0.9000
#> ✔ hyRelease       0.0.0.9000     ✔ eHydRo          0.0.0.9000
#> ✔ hyAggregate     0.0.1
#> ── Conflicts ──────────────────────────────────────── hydrofabric_conflicts() ──
#> ✖ hyAggregate::flowpaths_to_linestrings() masks hyRefactor::flowpaths_to_linestrings()
#> ✖ opendap.catalog::search()               masks base::search()
#> ✖ opendap.catalog::weighting_grid()       masks zonal::weighting_grid()

# "random" CAMELS basin from s3
cats = vect('/vsis3/formulations-dev/CAMELS20/camels_13313000_23551584/spatial/hydrofabric.gpkg', "catchments")

out = dap(URL = "/vsicurl/https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/USGS_Seamless_DEM_13.vrt", 
          AOI = cats) |>
     terrain('aspect') |>
     execute_zonal( cats,  FUN = 'circular_mean',  "ID")

plot(out['aspect'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant