# convert3d v3.2.3 **Mercurial revision 5770:c90c3015e72d | 2026-05-22** --- ## Description `convert3d` is a tool designed to **add vertical levels to a 2D grid** using either an existing grid or a notebook description. It processes input files to generate 3D gridded output files, enabling the conversion of 2D data into a 3D structure. --- ## Usage ```bash /home/softs/tools/debug/src/convert3d [OPTIONS] ``` --- ## Options | Option | Description | | -------------- | ------------------------------------------------------------------------ | | `-h`, `--help` | Show this help message and exit. | | `-r ` | Root name for input files. **Default:** `archive`. | | `-d ` | Path to the directory containing input files. | | `-z ` | Build the grid based on a **pre-set zone**. | | `-g ` | Grid file to use for the conversion. | | `-s ` | Starting date in `MM/YYYY` format. | | `-e ` | Ending date in `MM/YYYY` format. | | `-o ` | Path to the directory for output files. | | `-f ` | Output file format. **Default:** `cdf` (NetCDF). | | `-i ` | Frame step for extraction (e.g., `-i 2` means pick **1 frame every 2**). | --- ## Examples ### **Basic Conversion with Default Settings** Convert files using default root name (`archive`) and output to the current directory: ```bash convert3d -d /path/to/input -o /path/to/output ``` ### **Specify Root Name and Grid File** Convert files with a custom root name and grid file: ```bash convert3d -r my_model -g grid.nc -d /path/to/input -o /path/to/output ``` ### **Convert for a Specific Time Range** Convert files for a specific time range (e.g., from January 2020 to December 2021): ```bash convert3d -d /path/to/input -s 01/2020 -e 12/2021 -o /path/to/output ``` ### **Use a Pre-Set Zone** Convert files using a pre-set zone (e.g., `zone1`): ```bash convert3d -z zone1 -d /path/to/input -o /path/to/output ``` ### **Extract Every Other Frame** Convert files while extracting every other frame (e.g., `-i 2`): ```bash convert3d -d /path/to/input -i 2 -o /path/to/output ``` ### **Specify Output Format** Convert files and save output in a specific format (e.g., `nc` for NetCDF): ```bash convert3d -d /path/to/input -f nc -o /path/to/output ``` ### **Full Example** Combine multiple options for a complete conversion: ```bash convert3d -r my_model -d /path/to/input -z zone1 -s 01/2020 -e 12/2021 -o /path/to/output -f nc -i 2 ``` --- ## Environment Variables `convert3d` does not explicitly rely on environment variables for its core functionality. However, if it interacts with external libraries or tools (e.g., NetCDF, OpenMP), ensure that the relevant environment variables for those dependencies are set correctly. --- ## Notes 1. **Input Files:** - Input files must be **compatible with the tool's expected format** (e.g., NetCDF for grid data). - If using a **pre-set zone** (`-z`), ensure the zone is properly defined in the tool's configuration. 2. **Output Files:** - Output files are saved in the directory specified by `-o`. If not provided, the current directory is used. - The output format (`-f`) defaults to `cdf` (NetCDF) if not specified. 3. **Frame Step (`-i`):** - The frame step option (`-i`) allows you to **skip frames** during conversion. For example, `-i 2` processes every other frame. 4. **Date Format:** - Dates (`-s` and `-e`) must be provided in `MM/YYYY` format. The tool processes all files within the specified range. 5. **Grid File:** - If a grid file (`-g`) is not provided, the tool attempts to use the grid associated with the pre-set zone (`-z`). 6. **Default Values:** - If `-r` (root name) is not specified, the tool defaults to `archive`. - If `-d` (input directory) is not specified, the tool defaults to the current directory (`.`). - If `-o` (output directory) is not specified, the tool defaults to the current directory (`.`). --- ## See Also - [NetCDF Documentation](https://www.unidata.ucar.edu/software/netcdf/) - [CF Conventions for Grid Data](http://cfconventions.org/)