# 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 ```bash interpolator-cdf [OPTIONS] -i position_file input_file ``` --- ## Options | Option | Description | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `-h`, `--help` | Display help and exit. | | `-i ` | **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). | | `-v ` | Name of the variable to use for interpolation (e.g., `elevation`). | --- ## Deprecated Options | Option | Description | | --------------- | -------------------------------------------------------------------------------------------------------------- | | `-r ` | **Deprecated.** Root name for output files. | | `-s ` | **Deprecated.** Time sampling in seconds (default: `3600`). Use the time sampling from the input file instead. | --- ## Examples ### **Basic Interpolation** Interpolate the `elevation` variable from `input.nc` at positions specified in `positions.txt`: ```bash 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`: ```bash 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 1. **Input File Requirements:** - Must be a **valid NetCDF file**. - The variable specified with `-v` must exist in the input file. 2. **Output:** - The tool prints interpolated values to **standard output** in the following format: 3. **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. 4. **Mask Handling:** - The tool accounts for **masked values** in the input data (e.g., land areas in ocean models). 5. **Performance:** - For large datasets, ensure sufficient memory is available, as the tool loads the entire grid into memory. --- ## See Also - [NetCDF Documentation](https://www.unidata.ucar.edu/software/netcdf/) - [CF Conventions for Gridded Data](http://cfconventions.org/)