discussion points about "regularizing grids"
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)
-
gridding from irregular data (griddata, gdal_grid, barycentric triang, kriging, idw, thin-plate spline, gam, akima, other smoothers)
-
literal points-in-cells (no smoothing)
-
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
-
reading from literal XYZ gridded (the GDAL XYZ driver, all points present and exactly regular)
-
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)
-
detecting regular grid from degenerate rectilinear arrays (that are regular increasing/decreasing or nearly so - GHRSST an example where precision was lost)
-
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
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