Open mdsumner opened 1 year ago
4, 5 ,and 5a is covered by https://github.com/hypertidy/vaster/blob/main/R/from_xyz.R
3 we can do the basic cases with terra::project() or stars::st_warp (when the dataset has recognized geolocation arrays), when the geo arrays aren't recognized we can create with vapour::vrt(dsn, geolocation = c(xsds, ysds))
and then warp with vapour, terra, stars or elsewhere
bowtie and other complexities aren't covered by gdal
2 is trivial, and 1 has examples in the vignette here - but could be upgraded with better examples and to tie in the GDAL and python analogs
There's a huge family of these, and some very different perspectives in the R, Python, and GDAL communities. I wanted to lay out the different cases I'm aware of (and hopefully expand on this with examples and illustrations).
user specifies grid (dim, ext)
1) gridding from irregular data (griddata, gdal_grid, barycentric triang, kriging, idw, thin-plate spline, gam, akima, other smoothers)
2) literal points-in-cells (no smoothing)
3) constructing a regular grid from geolocation arrays (warping ) - this is the usual satellite-swath issue, but lots of details, bowtie, different density of coord arrays, sometimes model meshes fit here, and a mess of how the coord arrays are linked to the data (or not)
grid derived from data
4) reading from literal XYZ gridded (the GDAL XYZ driver, all points present and exactly regular)
5) deriving grid from literal XYZ gridded (all points regular, all present or enough to tell) - less limiting than GDAL XYZ
5a) alt, the points have some irregularity (but within noise level, because precisison loss etc, sp Pix and Grid conflated these a bit, and the gridded()<- precision thing is now built into raster, stars and terra in different ways)
6) detecting regular grid from degenerate rectilinear arrays (that are regular increasing/decreasing or nearly so - GHRSST an example where precision was lost)
7) detecting regular grid from curvilinear - but the intent was a regular projected grid originally, they just lost that info and stored longlat arrays (the entropy problem!)
(note those last two 6,7 are not warping, literally a human-interpretation and intervention - but warping can work this case too, just warping is literally open ended in terms of grid definition, these are cases where a grid exists but was not specified - sometimes you can guess it out though, like polar sea ice, and there are very very many examples with different details - ocean models, netcdf, grib, etc)
5 and 5a need a bit more thought just wanted to get the rough idea down