shorelines-distance v3.2.3¶
Mercurial revision 5786:5c8b45563631 | 2026-08-04
Description¶
shorelines-distance computes a map of distances to the nearest coast based on a custom mesh and an input shoreline. It can also pre-merge a shoreline/coastline file with an existing dataset using the -s option.
The grid can be defined using the following options:
--dx: Grid resolution in meters.--grid: Grid definition template.--mapping: Mapping template.--notebook: Notebook file to define the grid.
Usage¶
shorelines-distance [OPTIONS] input_shoreline
Options¶
General Options¶
Option |
Description |
|---|---|
|
Show help and exit. |
|
Base shoreline file to merge with. Default: |
|
Rootname for output files. Default: |
|
Output file. Default: |
Grid Definition Options¶
Option |
Description |
|---|---|
|
Grid resolution in meters to compute distances to the nearest coastline. |
|
Grid definition template: |
|
Mapping template: |
|
Notebook file to define the grid. |
|
Enable specific routines to handle polar grids. |
Extraction Options¶
Option |
Description |
|---|---|
|
Extract shorelines from the given dataset. |
|
Polygon file to define the extraction area. |
|
Frame string to define the extraction area: |
Mask Options¶
Option |
Description |
|---|---|
|
Force mask to land. |
|
Swap land and ocean masks. |
Miscellaneous Options¶
Option |
Description |
|---|---|
|
Enable debug verbose mode. |
|
NetCDF compression level. Default: |
|
Pre-set zone for grid or extraction. |
Deprecated Options¶
Option |
Description |
|---|---|
|
Decimation factor. Default: |
|
PROJ4 parameters to convert Cartesian to spherical coordinates. Default: no projection. |
Examples¶
Basic Usage¶
Compute distances to the nearest coast with a grid resolution of 100 meters:
shorelines-distance -dx 100 -r 100m-grid shoreline_file.cst
Merge with a Base Shoreline¶
Merge shoreline_file.cst with a base shoreline file and compute distances:
shorelines-distance -s /path/to/base_shoreline.cst -dx 100 -r merged-grid shoreline_file.cst
Define Grid Using Mapping Template¶
Define the grid using a mapping template:
shorelines-distance --mapping "[0:1:10;0:1:10]" -r custom-grid shoreline_file.cst
Extract Shorelines from a Dataset¶
Extract shorelines from a dataset using a polygon file:
shorelines-distance --extract -p polygon_file.shp -r extracted-shore shoreline_file.cst
Extract Shorelines Using a Frame¶
Extract shorelines using a frame string:
shorelines-distance --extract --frame "[0:10;0:10]" -r frame-extracted shoreline_file.cst
Force Land Mask¶
Force the mask to land and save the output:
shorelines-distance --land -o landmask.nc shoreline_file.cst
Swap Land and Ocean Masks¶
Swap land and ocean masks:
shorelines-distance --swap -o swapped-mask.nc shoreline_file.cst
Use a Notebook File for Grid Definition¶
Define the grid using a notebook file:
shorelines-distance --notebook grid_notebook.ipynb -r notebook-grid shoreline_file.cst
Enable Debug Mode¶
Enable debug mode for verbose output:
shorelines-distance --debug -dx 100 -r debug-grid shoreline_file.cst
Set NetCDF Compression Level¶
Set the NetCDF compression level to 4:
shorelines-distance -deflate 4 -dx 100 -r compressed-grid shoreline_file.cst
Environment Variables¶
This tool does not rely on specific environment variables. However, ensure that:
Input files (shorelines, grids, etc.) are accessible.
Output directories have write permissions.
Notes¶
Input Shoreline Formats:
Supported formats include:
BIN(0)SCAN(2)GSHHS(3)XISO(6)BOUNDARIES(7)SHP(8)NETCDF(9)XY(10)MAPINFO(11)HISTOLITT(12)POCFORMULA(15)NEI(16)BEL(18)KML(13)
Grid Handling:
If no grid definition is provided, the tool will attempt to generate one based on the input shoreline.
For polar grids, use
--polarto enable specific routines.
Extraction:
The
--extractoption requires either a polygon file (-p) or a frame string (--frame).Extracted shorelines are saved in the specified input file (default:
rootname-extraction.shp).
Masking:
Use
--landto force the mask to land.Use
--swapto invert land and ocean masks.
Performance:
For large datasets, consider using
--dxto control grid resolution and balance between accuracy and computation time.
See Also¶
GSHHS (Global Self-consistent, Hierarchical, High-resolution Shoreline Database)
PROJ4 (for coordinate projection parameters)
NetCDF (for output file format)