Skip to main content

snap_global_longitudes

Function snap_global_longitudes 

Source
pub fn snap_global_longitudes(grid: GridInfo) -> GridInfo
Available on crate feature encoder only.
Expand description

Give a global grid the exact step and origin its column count implies — the port of snap_global_longitudes in xuebuild/grid.py, which explains the rule; the two must agree to the bit.

GDAL derives a GRIB grid’s longitude step from the first and last longitudes, and WAVEWATCH III writes the 0.25° grid’s last column as 359.750016°, which makes a 0.2500000111° step whose 1440 columns do not close the circle. A grid whose columns span 360° to within a thousandth of a cell is the global grid: its step becomes 360 / width and its first center is placed on that step’s grid (rounding half up) when it lies within the same tolerance of it. Exact and regional grids pass through unchanged.