regrid#

Regrid NetCDF data to an L2 grid aligned with an L0 mask.

The module derives a target grid from mask.nc and an L2 resolution, checks that the requested L2 cells are integer multiples of the L0 grid, interpolates the selected variable, and writes an aligned NetCDF output.

USAGE:

python regrid_to_L2.py –input in.nc –mask mask.nc –output out.nc –l2 0.05 –method nearest python regrid_to_L2.py –input in.nc –mask mask.nc –output out.nc –l2 0.10x0.10 –method bilinear python regrid_to_L2.py –input in.nc –mask mask.nc –output out.nc –l2 0.02,0.02 –method linear –var temp

nearest  -> xarray .interp(method="nearest")
linear   -> xarray .interp(method="linear")

Notes

  • Assumes regular lon/lat grids.

  • L2 must be an integer multiple of L0 in both x and y.

  • Simon Lüdke

Functions#

regrid(input, mask, output[, l2, method, var])

Regrid file(s) to an L2 grid.

regrid_file(input, mask, output, l2[, ...])

Regrid a single file to L2 grid using xarray.

regrid_xarray(ds, lon_name, lat_name, ...[, var])

Regrid an xarray Dataset using xarray interpolation.