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

fetchSoilGrids: add grid argument for downloading COG subsets for extent #329

Merged
merged 4 commits into from
Dec 21, 2023

Conversation

brownag
Copy link
Member

@brownag brownag commented Dec 20, 2023

Will close #202

As complement to point-based query already provided, provides an option to download the source grids for arbitrary extent.

For example:

library(terra)
library(soilDB)

x <- fetchSDA_spatial("CA630", by.col =  "areasymbol", geom.src = "sapolygon")
#> Using 1 chunks...
#> Chunk #1 completed (n = 1; 0.9 secs)
#> Done in 1.5 secs; mean/chunk: 0.9 secs; mean/symbol: 1.54 secs.
x <- crop(vect(x), ext(x) / 6)

res <- fetchSoilGrids(
  x,
  grid = TRUE,
  filename = "sg_test.tif",
  depth_intervals = "5-15",
  variables = c("bdod", "cec", "nitrogen", "cfvo"),
  summary_type = "Q0.5",
  verbose = TRUE
)
#> 0...10...20...30...40...50...60...70...80...90...100 - done.
#> 0...10...20...30...40...50...60...70...80...90...100 - done.
#> 0...10...20...30...40...50...60...70...80...90...100 - done.
#> 0...10...20...30...40...50...60...70...80...90...100 - done.

plot(res)

@brownag brownag marked this pull request as ready for review December 20, 2023 22:55
@brownag brownag merged commit 521b740 into master Dec 21, 2023
5 checks passed
@brownag brownag deleted the for202 branch January 9, 2024 18:41
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

Successfully merging this pull request may close these issues.

fetchSoilGrids -- can we automate download of arbitrary extent grids?
1 participant