# mgr-editing v3.2.3 **Mercurial revision 5770:c90c3015e72d | 2026-05-22** --- ## Description `mgr-editing` is a **converter** for sea-level time series data. It allows you to transform data between different formats, such as **SONEL\_HR**, **RMN**, **PAB**, and **PROFILERS**. > **Note:** The input file **must** be in **ASCII format** and can be one of the supported types (see [File Formats](#file-formats)). --- ## Usage ```bash mgr-editing FILE [OPTIONS --header="lon=lon lat=lat code=code name=name depth=depth"] ``` --- ## Options | Option | Description | | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | | `-h`, `--help` | Display help and exit. | | `-f ` | Specify the **end date** for processing. If not provided, the entire file is read. | | `-s ` | Specify the **start date** for processing. If not provided, the entire file is read. | | `-o ` | Specify the **output filename** (without extension). | | `--header="lon=lon lat=lat code=code name=name depth=depth"` | Include metadata about the `mgr` station in the output file. | | `-iF ` | Specify the **input format** (e.g., `SONEL_HR`, `YMD`, `LIST`, `RMN`, `PAB`, `PROFILERS`). | | `-oF ` | Specify the **output format**. If not provided, the output is written in a **list format with no header**. | | `-b ` | Path to the **bathymetry file**. | | `-p ` | Path to the **polygons file** (used for excluding points). | | `-m ` | Path to the **mesh file** (used for filtering points inside/outside the mesh). | | `-w ` | Specify the **tidal wave** for processing (e.g., `M2`, `S2`). | | `--range ` | Specify a **depth range** for filtering (e.g., `--range 0:1000`). | | `--delta ` | Apply a **delta correction** to the data. Use the format: `dataFile=... amplitude=... phaselag=... discretisation=...`. | | `--shore-distance ` | Filter points based on their **distance from the shore** (in meters or degrees). | | `--interior` | Exclude points **outside** the mesh or polygon. | | `--list` | Display a **list of stations** with their coordinates and exit. | --- (file-formats)= ## File Formats The following input formats are supported: | Format | Description | Example | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | | **SONEL\_HR** | Format: `YYYY-MM-DD HH:MM:SS float_value_of_slv`. No header is read. File extension: `.slv`. | `1995-08-10 11:50:00 3.050` | | **YMD** | Format: `YYYY:MM:DD HH:MM float_value_of_slv`. No header is read. | `1995:08:10 11:50 3.050` | | **LIST** | Format: `cnes_date float_value_of_slv`, where `cnes_date` is a Julian date referenced to `1950/01/01 00:00:00`. **Header not available yet.** | `24375 3.050` | | **RMN** | Format: **To be described**. | - | | **PAB** | Format: **To be described**. | - | | **PROFILERS** | Binary format: `nbin ntime YYYY MM DD HH MM SS bin1 bin2 ...` (all values are `float`). No header is read. | - | --- ## Examples ### **Convert a SONEL\_HR File to ASCII** Convert a SONEL\_HR file to a list format (default output): ```bash mgr-editing input.slv -oF ASCII -o output.mgr ``` ### **Convert a YMD File to NetCDF** Convert a YMD file to NetCDF format: ```bash mgr-editing input.yml -iF YMD -oF NETCDF -o output.nc ``` ### **Process a Subset of Data** Process data between two dates: ```bash mgr-editing input.slv -s 2000-01-01 -f 2000-12-31 -o output.mgr ``` ### **Apply a Delta Correction** Apply a delta correction to the data: ```bash mgr-editing input.slv --delta "dataFile=/path/to/delta.nc amplitude=UP_diff_a phaselag=UP_diff_G discretisation=LGP1" -o output.mgr ``` ### **Filter Points Inside a Mesh** Filter points to include only those inside a mesh: ```bash mgr-editing input.slv -m mesh.nc -o output.mgr ``` ### **Exclude Points Outside a Polygon** Exclude points outside a polygon: ```bash mgr-editing input.slv -p polygon.txt --interior -o output.mgr ``` ### **Filter by Depth Range** Filter points within a specific depth range: ```bash mgr-editing input.slv --range 0:1000 -o output.mgr ``` ### **List All Stations** Display a list of all stations with their coordinates: ```bash mgr-editing input.slv --list ``` ### **Add Metadata to Output** Include station metadata in the output file: ```bash mgr-editing input.slv --header="lon=2.3522 lat=48.8566 code=PARIS name=Paris depth=0" -o output.mgr ``` --- ## Environment Variables `mgr-editing` does not rely on specific environment variables. However, ensure your system has the necessary permissions to read input files and write to the output directory. --- ## Notes 1. **Input File Requirements:** - Must be in **ASCII format** (except for `PROFILERS`, which is binary). - Supported formats: `SONEL_HR`, `YMD`, `LIST`, `RMN`, `PAB`, `PROFILERS`. 2. **Output File:** - If no output format (`-oF`) is specified, the default is a **list format with no header**. - If no output filename (`-o`) is provided, the output filename is derived from the input filename with an appropriate extension (e.g., `.mgr`, `.nc`, `.obs`). 3. **Date Handling:** - If no start (`-s`) or end (`-f`) date is specified, the **entire file** is processed. 4. **Delta Correction:** - The `--delta` option requires a string with the following format: dataFile=<path\_to\_file> amplitude=<amplitude\_var> phaselag=<phase\_var> discretisation=<discretisation\_method> \`\`\` 5. **Mesh and Polygon Filtering:** - Use `-m` to filter points inside a mesh. - Use `-p` with `--interior` to exclude points outside a polygon. 6. **Depth Range:** - The `--range` option accepts a string in the format `min:max` (e.g., `0:1000`). 7. **Rejected Points:** - Points that do not meet the filtering criteria (e.g., outside the mesh or depth range) are saved in a file named `rejected.mgr`. --- ## See Also - [SONEL Data](https://www.sonel.org/) (for SONEL\_HR format) - [NetCDF Format](https://www.unidata.ucar.edu/software/netcdf/) - [CF Conventions](http://cfconventions.org/) (for time and coordinate standards)