Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stamp with several modules

scripts/stamp.sh runs several modules over one input in sequence, so the result is a single file carrying the new columns of every module you selected. Each module is chained onto the previous one’s output, its columns accumulating, and the in-between files are written to a temporary directory that is removed when the script ends. Only the final output file remains.

scripts/stamp.sh [options] <input> <output>

Selecting modules

A module runs only when you give its data source, so the flags pick both the modules and their inputs. At least one module must be selected.

FlagModuleData source
--coast PATHcoastGSHHG shapefile dir or GSHHS_*_L1.shp
--depth FILEdepthGEBCO bathymetry NetCDF
--sea PATHseaIHO Sea Areas GeoJSON or shapefile
--countries FILEplaceNatural Earth countries shapefile
--nearest FILEnearestreference table of named locations

The modules run in a fixed order (coast, depth, sea, place, nearest); the order does not matter, since each adds distinct columns.

Per-module options

OptionApplies toMeaning
--municipalities FILEplaceGISCO LAU municipalities (optional)
--coast-unit km|mcoastDistance unit (default km)
--depth-positivedepthReport depth positive below sea level
--depth-on-landdepthAdd an on_land boolean column
--max-municipality-dist NplaceDrop a municipality match further than N away
--place-unit km|mplaceUnit for municipality_dist and its cutoff (default km)
--sea-name-field STRseaFeature field with the sea name (default NAME)
--nearest-name-field STRnearestReference name column (default name)
--nearest-unit km|mnearestDistance unit (default km)

Common and other options

--region, --partition, --lon-col, --lat-col, --decimals, and --threads are passed to every module that accepts them (--region and --partition only to coast, sea, and place). --threads reaches depth too, but not its grid lookup, which always runs on one thread. --in-format describes the original input. Other options:

OptionMeaning
--bin PATHseastamp binary (default: $SEASTAMP_BIN, else the one on PATH, else ./target/release or ./target/debug)
-k, --keepKeep the intermediate files (default: remove them)
-n, --dry-runPrint the commands without running them

--partition and --region are exclusive, here as in seastamp itself: a partitioned run derives a box and a projection center for each piece of the input, so there is no single region to set. Passing both is an error before any module runs.

Each step chains onto the previous one’s output, which carries the same points, so every partitioned module in a chain splits the input the same way and reports the same partition count. See auto or partition for when the flag is worth using.

Example

scripts/stamp.sh cores.parquet cores.stamped.parquet \
  --coast ./data/gshhg/gshhg-shp-2.3.7/GSHHS_shp/f \
  --depth ./data/gebco/GEBCO_2024_sub_ice_topo.nc \
  --nearest farms.parquet --nearest-name-field farm_name

This writes one file, cores.stamped.parquet, with the original columns plus dist_to_coast, bathymetry, nearest_name, and nearest_dist. The intermediate coast-only and coast+depth files are removed on exit.

The intermediate files are Parquet (lossless); the final file’s format follows its extension, so cores.stamped.csv.gz would be written as gzipped CSV.