Repository navigation
CLI_interpolate
interpolate is registered, but is not operational in NES 1.3.5. The CLI dispatcher calls handlers with filtered keyword arguments, whereas interpolate(args) requires a Namespace. Other inconsistencies include source/output versus input_file/output_file, destination validation, missing LCC/Mercator parameter names, and API call signatures. The options below describe the parser, not a working end-to-end command.
-i and -o are required. Exactly one of --destination or --projection is required. Horizontal and vertical options must not be mixed.
| Argument | Parser description |
|---|---|
-i, --input_file
|
Path to source NetCDF file |
-o, --output_file
|
Path to output NetCDF file |
--axis |
Interpolation axis (default: horizontal) |
-d, --destination
|
Path to destination grid NetCDF file |
--projection |
Projection type to generate destination grid (e.g. regular, rotated, lcc) |
--kind |
Interpolation method for horizontal axis |
--n-neighbours |
Number of neighbors (NearestNeighbour) |
--flux |
Treat variables as fluxes (Conservative only) |
--keep-nan |
Keep NaN values after interpolation |
--fix-border |
Fix border effects (NearestNeighbour only) |
--weight-matrix-path |
Path to weight matrix file |
--only-create-wm |
Only generate weight matrix |
--to-providentia |
Format output for Providentia |
--method |
Interpolation method for vertical axis (e.g. linear) |
--extrapolate |
Allow extrapolation in vertical interpolation |
--lat_orig |
Latitude origin (regular/global) |
--lon_orig |
Longitude origin (regular/global) |
--inc_lat |
Latitude increment (regular/global) |
--inc_lon |
Longitude increment (regular/global) |
--n_lat |
Number of latitude points (regular/global) |
--n_lon |
Number of longitude points (regular/global) |
--centre_lat |
Rotated pole latitude (rotated) |
--centre_lon |
Rotated pole longitude (rotated) |
--west_boundary |
Western boundary (rotated) |
--south_boundary |
Southern boundary (rotated) |
--inc_rlat |
Latitude increment (rotated) |
--inc_rlon |
Longitude increment (rotated) |
--parent_grid_path |
Path to parent grid NetCDF (rotated_nested) |
--parent_ratio |
Parent ratio (rotated_nested) |
--i_parent_start |
Parent grid i index start (rotated_nested) |
--j_parent_start |
Parent grid j index start (rotated_nested) |
--n_rlat |
Number of lat points (rotated_nested) |
--n_rlon |
Number of lon points (rotated_nested) |
--lat_1 |
First standard parallel (LCC projection) |
--lat_2 |
Second standard parallel (LCC projection) |
--lon_0 |
Central meridian (LCC projection) |
--x_0 |
False easting (LCC projection) |
--y_0 |
False northing (LCC projection) |
--dx |
Grid spacing in x direction (LCC projection) |
--dy |
Grid spacing in y direction (LCC projection) |
--nx |
Number of grid points in x (LCC projection) |
--ny |
Number of grid points in y (LCC projection) |
--lat_ts |
Latitude of true scale (Mercator projection) |
from nes import open_netcdf
source = open_netcdf("source.nc")
source.load()
destination = open_netcdf("destination.nc")
result = source.interpolate_horizontal(destination, kind="NearestNeighbour", n_neighbours=4)
result.to_netcdf("interpolated.nc")
source.close()
destination.close()For conservative interpolation use kind="Conservative"; flux=True selects treatment of flux variables. weight_matrix_path allows creating/reusing weights, and only_create_wm=True only creates weights. keep_nan and fix_border control NaN preservation and nearest-neighbour border handling.
For vertical interpolation use source.interpolate_vertical(new_levels=[100, 500], kind="linear", extrapolate=None), with target levels in the source vertical coordinate units. The result is a new object unless overwrite=True. extrapolate=None fills outside the range with NaN; True extrapolates; False uses bottom/top values. A two-item tuple controls the two sides independently.