# reduce-v2 v3.2.3 **Mercurial revision 5786:5c8b45563631 | 2026-08-04** --- ## Description `reduce-v2` is a tool used to **filter Mog2D archives** using a **Lanczos time filter**. It is developed and used by **CTOH** (Centre de Topographie des Océans et de l'Hydrosphère). The tool computes and writes **clx-formatted filtered Mog2D archives**. --- ## Usage ```bash reduce-v2 [OPTIONS] ``` --- ## Options > **Note:** If a default is not specified, the option is **mandatory**. ### **Input/Output Options** | Option | Description | | ----------------------------- | ---------------------------------------------------------- | | `-h ` | Root name for **elevation archives**. Default: `analysis`. | | `-p ` | Root name for **pressure archives**. Default: `forcing`. | | `-iF `, `-f ` | Input archive format: `clx` or `cdf`. | | `-oF ` | Output archive format: `clx` or `cdf`. | | `-i ` | Path for input archives. Default: `./`. | | `-o ` | Path for output filtered archives. Default: `./`. | --- ### **Filtering Options** | Option | Description | | ------------------ | ----------------------------------------------------------------------------------------------- | | `-w ` | Filtering window in days. Default: `20.0`. | | `-start ` | Starting month for filtering request. | | `-end ` | Ending month for filtering request. | | `-r ` | Ratio factor for archive reduction. Default: `1`. | | `-m ` | Detiding method to remove S2 signal: `analysis`, `climatology`, or `none`. Default: `analysis`. | | `--pressure-only` | Skip elevation processing. | | `--ssh-only` | Skip pressure processing. | | `-hf` | Also remove high-frequency signals with a **12.5-hour filter**. | --- ### **Advanced Options** | Option | Description | | --------------------------- | --------------------------------------------------- | | `-no_default` | Disable default values for `-h` and `-p`. | | `-pressure_factor ` | Pressure factor. Default: `1.0`. | | `-mesh ` | Path to the mesh file. | | `-ssh ` | Variable name for elevation (default: `elevation`). | | `-pressure ` | Variable name for pressure (default: `p`). | --- ### **Deprecated Options** | Option | Replacement | | ------ | ----------------- | | `-d` | Use `-m` instead. | --- ## Examples ### **Basic Filtering** Filter elevation and pressure archives from January 2000 to December 2000: ```bash reduce-v2 -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data \ -iF cdf -oF cdf ``` ### **Filter with Custom Root Names** Use custom root names for elevation and pressure archives: ```bash reduce-v2 -h custom_elevation -p custom_pressure \ -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data ``` ### **Detide with Climatology Method** Remove S2 signal using the `climatology` method: ```bash reduce-v2 -m climatology \ -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data ``` ### **High-Frequency Filtering** Remove high-frequency signals (12.5-hour filter): ```bash reduce-v2 -hf \ -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data ``` ### **Pressure-Only Filtering** Skip elevation and filter only pressure archives: ```bash reduce-v2 --pressure-only \ -p custom_pressure \ -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data ``` ### **Custom Filtering Window** Use a custom filtering window of 30 days: ```bash reduce-v2 -w 30.0 \ -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data ``` ### **Resampling** Reduce archive size with a resampling factor of 2: ```bash reduce-v2 -r 2 \ -start 01/2000 -end 12/2000 \ -i ./input_data \ -o ./output_data ``` --- ## Environment Variables `reduce-v2` uses **OpenMP** (version 201511) for parallelization. Key environment variables: | Variable | Description | | ----------------- | ----------------------------------------- | | `OMP_NUM_THREADS` | Number of threads to use. | | `OMP_SCHEDULE` | Runtime schedule type and chunk size. | | `OMP_DYNAMIC` | Enable/disable dynamic thread adjustment. | | `OMP_NESTED` | Enable/disable nested parallelism. | **Example:** ```bash OMP_NUM_THREADS=6 reduce-v2 -start 01/2000 -end 12/2000 -i ./input_data -o ./output_data ``` > **Note:** If running on a busy machine, limit threads to the number of **free CPUs** to avoid performance degradation. --- ## Notes 1. **Input Formats:** - Supported formats: `clx` (binary, deprecated) and `cdf` (NetCDF). - **NetCDF (`cdf`)** is the recommended format. 2. **Detiding Methods:** - `analysis`: Uses harmonic analysis to remove S2 signal. - `climatology`: Uses precomputed climatology (requires `S2-elevation-atlas.nc` or `S2.ele.s2c`). - `none`: No detiding is applied. 3. **High-Frequency Filtering:** - The `-hf` option applies an additional **12.5-hour filter** to remove high-frequency signals. 4. **Resampling:** - The `-r` option reduces the number of frames in the output archives by the specified factor. 5. **Output:** - Filtered archives are saved in the specified output directory (`-o`). - Output filenames include the root name, year, and month (e.g., `analysis-filtered-2000.01.nc`). 6. **Performance:** - For large datasets, ensure the output directory (`-o`) is on a **fast storage device** (e.g., SSD). - Adjust `OMP_NUM_THREADS` based on available CPU resources. --- ## See Also - [CTOH (Centre de Topographie des Océans et de l'Hydrosphère)](https://ctoh.legos.obs-mip.fr/) - [OpenMP Documentation](https://www.openmp.org/)