# topo-format v3.2.3 **Mercurial revision 5786:5c8b45563631 | 2026-08-04** --- ## Description `topo-format` is a tool designed to **predict tides for PEPS images**. It processes input files in various formats, applies transformations (scaling, offset, flipping, etc.), and saves the output in the desired format. --- ## Usage ```bash topo-format [OPTIONS] ``` --- ## Options ### **General Options** | Option | Description | | -------------- | ---------------------------------------------- | | `--help`, `-h` | Display help and exit. | | `-info` | Print mapping info of the input file and exit. | --- ### **Input/Output Options** | Option | Description | | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `-iF ` | Input format. One of: `NETCDF`, `COMODO` (equivalent to `NETCDF`), `GLOBE`, `GRD`, `ASCII`, `GIS`, `SLIM`, `GEOTIFF`, or `DTU`. | | `-oF `, `-f ` | Output format. One of: `grd`, `grd-float`, `netcdf`, `xyz`, or `gis`. | | `-iV `, `-v ` | Input variable name (only useful when input format is `NETCDF` or `COMODO`). | | `-oV ` | Output variable name. Default: `bathymetry`. | | `-o ` | Root name for the output file. Default: `out`. | --- ### **Processing Options** | Option | Description | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------- | | `-c ` | Variable name to process (multiple uses possible). | | `--cartesian-mapping ` | Cartesian grid settings in the format `[xmin:dx:xmax;ymin:dy:ymax]` (for handling poorly geo-referenced rasters). | | `--proj=` | PROJ4 option string to convert Cartesian coordinates to spherical. | | `-flip` | Flip the data north-south. | | `-zmax ` | Maximum value to constrain the output. | | `-offset ` | Add an offset to the field data (applied after scaling). | | `-scale ` | Apply a scale factor to the field data. | | `-inv` | Equivalent to `-scale -1`. | | `-add ` | File to convert hydrographic levels to mean levels by **adding** its values. | | `-substract ` | File to convert hydrographic levels to mean levels by **subtracting** its values. | | `--time ` | Date in the format `YYYY-MM-DD HH:MM:SS`. Activates saving with a time dimension. | | `-max-valid ` | Maximum depth above which the output will be masked. | | `-mask ` | Mask value to override the input mask (required for `GEOTIFF` input format). | | `-deflate` | NetCDF compression level. Default: none. Only useful for `grd`, `grd-float`, or `netcdf` output formats. | --- ## Examples ### **Convert a NetCDF File to GRD Format** ```bash topo-format -iF NETCDF -oF grd -iV elevation -o output_root input.nc ``` ### **Apply Scaling and Offset** ```bash topo-format -iF NETCDF -oF netcdf -scale 10.0 -offset 5.0 -o scaled_output input.nc ``` ### **Flip Data North-South** ```bash topo-format -iF GRD -flip -o flipped_output input.grd ``` ### **Convert Hydrographic Levels to Mean Levels** ```bash topo-format -iF NETCDF -add mean_level.nc -o adjusted_output input.nc ``` ### **Use Cartesian Mapping** ```bash topo-format -iF GEOTIFF --cartesian-mapping "[0:1:100;0:1:100]" -o cartesian_output input.tif ``` ### **Apply PROJ4 Projection** ```bash topo-format -iF GRD --proj="merc ellps=WGS84 lon_0=0E lat_ts=46N" -o projected_output input.grd ``` ### **Save Output with Time Dimension** ```bash topo-format -iF NETCDF --time "2026-08-04 12:00:00" -oF netcdf -o time_output input.nc ``` ### **Mask Output Based on Depth** ```bash topo-format -iF NETCDF -max-valid 200.0 -o masked_output input.nc ``` ### **Convert to NetCDF with Compression** ```bash topo-format -iF GRD -oF netcdf -deflate 5 -o compressed_output input.grd ``` --- ## Environment Variables `topo-format` does not rely on specific environment variables. However, if you are using **PROJ4** for coordinate transformations, ensure the `PROJ_LIB` environment variable is set to the directory containing PROJ4 data files. --- ## Notes 1. **Input Formats:** - Supported formats: `NETCDF`, `COMODO`, `GLOBE`, `GRD`, `ASCII`, `GIS`, `SLIM`, `GEOTIFF`, `DTU`. - For `NETCDF` or `COMODO` input, specify the variable name using `-iV` or `-v`. 2. **Output Formats:** - Supported formats: `grd`, `grd-float`, `netcdf`, `xyz`, `gis`. - Default output variable name: `bathymetry`. 3. **Masking:** - Use `-mask` to override the input mask (required for `GEOTIFF` input). - Use `-max-valid` to mask depths above a specified threshold. 4. **Coordinate Transformations:** - Use `--proj` to specify a PROJ4 string for converting Cartesian coordinates to spherical. - Use `--cartesian-mapping` to define a Cartesian grid for poorly geo-referenced rasters. 5. **Compression:** - Use `-deflate` to enable NetCDF compression (only for `grd`, `grd-float`, or `netcdf` output). 6. **Time Dimension:** - Use `--time` to include a time dimension in the output (format: `YYYY-MM-DD HH:MM:SS`). --- ## See Also - [PROJ4 Documentation](https://proj.org/) (for coordinate transformations) - [NetCDF Documentation](https://www.unidata.ucar.edu/software/netcdf/) (for NetCDF input/output) - [GDAL Documentation](https://gdal.org/) (for GEOTIFF and other raster formats)