interpolator-cdf v3.2.3¶
Mercurial revision 5770:c90c3015e72d | 2026-05-22
Description¶
interpolator-cdf performs 2D interpolation from a NetCDF input file onto a list of specified positions. It extracts values from the input file at the given coordinates and outputs the interpolated results.
Usage¶
interpolator-cdf [OPTIONS] -i position_file input_file
Options¶
Option |
Description |
|---|---|
|
Display help and exit. |
|
Required. Path to the position file. This file must contain the number of stations followed by their coordinates (longitude, latitude, depth, and quality for each station). |
|
Name of the variable to use for interpolation (e.g., |
Deprecated Options¶
Option |
Description |
|---|---|
|
Deprecated. Root name for output files. |
|
Deprecated. Time sampling in seconds (default: |
Examples¶
Basic Interpolation¶
Interpolate the elevation variable from input.nc at positions specified in positions.txt:
interpolator-cdf -i positions.txt -v elevation input.nc
Interpolate a Custom Variable¶
Interpolate the temperature variable from data.nc at positions specified in stations.txt:
interpolator-cdf -i stations.txt -v temperature data.nc
Position File Format¶
The position file must follow this format:
First line: Number of stations (
nst).Subsequent lines: For each station, provide:
Year (integer)
Day of the year (float)
Longitude (float)
Latitude (float)
Depth (float)
Quality (float)
Optional: A comment or station name (ignored).
Example (positions.txt):
3
2020 15.5 2.34 48.85 0.0 1.0 Station1
2020 20.0 -1.23 45.67 5.0 0.9 Station2
2020 25.0 0.56 42.34 10.0 0.8 Station3
Environment Variables¶
This tool does not rely on specific environment variables. However, ensure your system has the necessary libraries to read NetCDF files.
Notes¶
Input File Requirements:
Must be a valid NetCDF file.
The variable specified with
-vmust exist in the input file.
Output:
The tool prints interpolated values to standard output in the following format:
Interpolation Method:
Uses 2D interpolation to estimate values at the specified coordinates.
If the input file contains multiple time frames, the tool interpolates values for each frame and then performs a 1D temporal interpolation to match the exact time specified in the position file.
Mask Handling:
The tool accounts for masked values in the input data (e.g., land areas in ocean models).
Performance:
For large datasets, ensure sufficient memory is available, as the tool loads the entire grid into memory.