mikejohnson51 / climateR

An R 📦 for getting point and gridded climate data by AOI
https://mikejohnson51.github.io/climateR/
MIT License
168 stars 40 forks source link

Bring intersectr netcdf traversal for unstructured grids into climateR. #46

Closed dblodgett-usgs closed 1 year ago

dblodgett-usgs commented 2 years ago

Based on some slack chat, I think it's going to be productive to contribute some of what's currently in intersectr over here.

I'll be moving a few things into https://github.com/USGS-R/ncdfgeom but the core execute intersection functions from intersectr need a good home. That stuff will be well used here.

Specifically, utils.R https://github.com/USGS-R/intersectr/blob/master/R/utils.R

And execute_intersection.R https://github.com/USGS-R/intersectr/blob/master/R/execute_intersection.R

mikejohnson51 commented 1 year ago

Hi @dblodgett-usgs, I would like to reopen this discussion now that this package is much more stable and easy to maintain. To date, the entirety of the climateR-catalog built here is used in this package and a lot of general tooling around reading NetCDF/VRT/TIF/OPeNDAP resources lives here. I am debating whether to bring zonal over here as well and your thoughts on that and intersectr would be really appreciated.

dblodgett-usgs commented 1 year ago

I did bring a couple of the key pieces of intersectr into ncdfgeom in https://github.com/DOI-USGS/ncdfgeom/pull/80

Just glancing at the call stack that leads to your read_dap_file function, I'm not quite sure how you would shoe horn the pattern I have in here (or if it would add anything to what you have?)

I get the indices for my total request here: https://github.com/DOI-USGS/intersectr/blob/main/R/execute_intersection.R#L100

Then call this for each time step: https://github.com/DOI-USGS/intersectr/blob/main/R/execute_intersection.R#L331

The rest of the execute_intersection logic is more or less already in here?

I just noticed this is declared twice... https://github.com/mikejohnson51/climateR/blob/master/R/utils.R#L272

mikejohnson51 commented 1 year ago

What are your thoughts on bringing zonal's regular grid functions over here mixed with intersectr logic for curvilinear grids?

dblodgett-usgs commented 1 year ago

I'm fine with it. intersectr (now ncdfgeom) also works on totally irregular stuff like polygons, so that's a nice to have.

mikejohnson51 commented 1 year ago

Will reopen latter when we have a strategy :)