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

Enrich with several modules

scripts/enrich.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/enrich.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
--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, --lon-col, --lat-col, --decimals, and --threads are passed to every module that accepts them (--region only to coast, sea, and place). --in-format describes the original input. Other options:

OptionMeaning
--bin PATHgeoenrich binary (default: $GEOENRICH_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

Example

scripts/enrich.sh cores.parquet cores.enriched.parquet \
  --coast ./data/gshhg/gshhg-shp-2.3.7/GSHHS_shp/f \
  --depth ./data/gebco/GEBCO_2024_sub_ice.nc \
  --nearest farms.parquet --nearest-name-field farm_name

This writes one file, cores.enriched.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.enriched.csv.gz would be written as gzipped CSV.