DOI-USGS / DOI-USGS/intersectr

show how to work with zarr data sources.

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Description

This should work with the current remotes dependencies here.

`remotes::install_github("DOI-USGS/intersectr")`

```r
st4_url <- "https://usgs.osn.mghpcc.org/mdmf/gdp/stageiv_combined.zarr/"

st4_z <- rnz::open_nz(st4_url)

vars <- ncmeta::nc_vars(st4_z)

v <- vars[grepl("precipitation", vars$name),]

coord_var <- ncmeta::nc_coord_var(st4_z, v$name)

prj <- sf::st_crs(4326)

x <- rnz::get_var(st4_z, coord_var$X)
y <- rnz::get_var(st4_z, coord_var$Y)

hu <- nhdplusTools::get_huc(id = "10080007", type = "huc08", t_srs = 5070)

hu <- dplyr::select(hu, huc8)

geom <- ncdfgeom::create_cell_geometry(x, y, prj, hu, 1000)

weight <- ncdfgeom::calculate_area_intersection_weights(x = dplyr::select(geom, grid_ids), y = hu, normalize = FALSE)

intersectr::get_timerange(st4_url, coord_var$`T`)

int <- intersectr::execute_intersection(st4_url, v$name, weight, geom, coord_var$X, coord_var$Y, coord_var$`T`, "2020-10-01 00:00:00", "2020-10-02 00:00:00",
status = TRUE)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.