# mesh2node v3.2.3 **Mercurial revision 5786:5c8b45563631 | 2026-08-04** --- ## Description `mesh2node` performs **nearest-neighbor interpolation** of simulation outputs from a full mesh onto another grid's nodes. It is useful for extracting data from a high-resolution mesh to specific points or nodes defined in a separate grid file. --- ## Usage ```bash mesh2node [OPTIONS] file ``` --- ## Options | Option | Description | | -------------- | -------------------------------------------------------------- | | `-h`, `--help` | Display this help message and exit. | | `-m ` | **Mesh file**: Path to the input mesh file (required). | | `-n ` | **Node file**: Path to the input node file (required). | | `-s ` | **Mask value**: Value to use for masked (invalid) data points. | > **Deprecated Options** > > > | Option | Description | > | ----------- | ---------------------------------------------------------------------------------------------------- | > | `-z ` | Pre-set zone to limit the interpolation area. **This option is deprecated and no longer supported.** | > --- ## Examples ### **Basic Interpolation** Interpolate data from `input.s2r` using `mesh.nc` and `nodes.nc`: ```bash mesh2node -m mesh.nc -n nodes.nc input.s2r ``` ### **Interpolate with Custom Mask Value** Use a mask value of `-999.9` for invalid points: ```bash mesh2node -m mesh.nc -n nodes.nc -s -999.9 input.s2r ``` ### **Interpolate Vector Data (V2R Format)** Interpolate vector data (e.g., velocity components) from `input.v2r`: ```bash mesh2node -m mesh.nc -n nodes.nc input.v2r ``` ### **Interpolate Complex Data (S2C Format)** Interpolate complex harmonic constants (e.g., tidal elevation) from `input.s2c`: ```bash mesh2node -m mesh.nc -n nodes.nc input.s2c ``` ### **Interpolate Complex Vector Data (V2C Format)** Interpolate complex vector data (e.g., tidal currents) from `input.v2c`: ```bash mesh2node -m mesh.nc -n nodes.nc input.v2c ``` --- ## Environment Variables `mesh2node` does not rely on specific environment variables. However, ensure your system has sufficient resources (memory, CPU) for large mesh or node files. --- ## Notes 1. **Input Files:** - The **mesh file** (`-m`) and **node file** (`-n`) are **required** for interpolation. - Supported input file formats: `.s2r`, `.s2c`, `.v2r`, `.v2c`. 2. **Output:** - The output file is automatically named as `.extraction`. - For example, if the input file is `data.s2r`, the output will be `data.s2r.extraction`. 3. **Masking:** - The `-s` option sets the value for masked (invalid) data points. The default mask value is `999.9`. - Masked values are assigned to nodes that fall outside the mesh or cannot be interpolated. 4. **Interpolation Method:** - Uses **linear interpolation** within the mesh elements to estimate values at the target nodes. - If a node falls outside the mesh, the mask value is assigned. 5. **Performance:** - For large meshes or node files, ensure sufficient memory is available. - The tool is optimized for **nearest-neighbor interpolation** and may not be suitable for high-order interpolation schemes. --- ## See Also - [NetCDF Tools](https://www.unidata.ucar.edu/software/netcdf/) (for handling mesh and node files) - [Mog2D Simulation Tools](https://www.poc.obs-mip.fr/) (for related simulation outputs)