Grid Tools
The grid suite (code/grid/) contains 76 command-line utilities for creating, filtering, interpolating, differencing, contouring, projecting, and exporting 2D bathymetric and backscatter grids (.r4, .8bit, .sun), 3D oceanographic/sound-velocity fields, and hydrodynamic model meshes.
1. Core Gridding, Accumulation & Surface Fitting
Tools for constructing 2D digital elevation models (.r4) from multibeam .merged files, ASCII XYZ soundings, or finite-element meshes:
| Tool | Description |
|---|---|
weigh_grid | Primary OMG inverse-distance / beam-footprint weighted gridding engine for .merged and ASCII XYZ data. |
addWG | Combines intermediate .r4_weights and .r4_weight_depth accumulator files from multiple weigh_grid runs. |
updateArray | Recomputes a normalized .r4 depth grid from .r4_weights and .r4_weight_depth accumulators. |
addDTM | Merges or splices multiple .r4 digital terrain models together. |
surface | Fits a continuous minimum-curvature / adjustable-tension biharmonic spline surface (Smith & Wessel, 1990) to XYZ triples. |
make_blank | Creates an initialized blank .r4 or .8bit mapsheet with specified projection and bounds. |
make_bases | Generates script commands and base mapsheets for tiling a survey area into sub-grids. |
edhead | Views and interactively edits the 1024-byte JHC_header of .r4 and .8bit grid files. |
2. Grid Filtering, Interpolation & Gap Filling
Tools for smoothing, cleaning, interpolating across holidays, and repairing .r4 and .8bit arrays:
| Tool | Description |
|---|---|
r4filter | Applies spatial convolution, mean, median, or Gaussian smoothing filters to .r4 grids. |
r4interp | Interpolates across unpopulated nodata gaps in an .r4 grid using radial/directional search. |
fillGap | Fills small holiday gaps in .r4 or .8bit grids by local neighborhood interpolation. |
fixarray | Cleans spikes, remaps nodata values, scales, or clips .r4 floating-point grids. |
maskarray | Masks an .r4 or .8bit grid using a polygon or companion mask raster. |
patchWORLD | Patches higher-resolution .r4 grids into a background regional or global bathymetric grid. |
3. Grid Differencing, Quality Control & Shoal Detection
Tools for comparing surfaces, evaluating multibeam sounding residuals, and hydrographic shoal/cost analysis:
| Tool | Description |
|---|---|
differ | Computes the cell-by-cell vertical difference between two .r4 bathymetric grids (including cross-projection regridding). |
diff8bit | Computes pixel-by-pixel differences between two .8bit greyscale grids. |
subtractSurface | Subtracts a bilinearly interpolated .r4 reference surface from every beam in .merged survey lines and stores residuals in-place. |
DTMreject | Flags outlying beams in .merged files that deviate beyond a threshold from a reference .r4 DTM. |
showError | Creates an 8-bit hit-count raster mapping the spatial density of rejected/flagged beams across a survey sheet. |
correlate | Computes spatial cross-correlation between two grids to diagnose horizontal positioning offsets. |
findShoals | Extracts hydrographic shoal soundings and local depth minima from .r4 grids. |
calcCost | Computes survey cost/efficiency or terrain ruggedness metrics over a bathymetric grid. |
4. Terrain Morphology, Profiles & Sub-Bottom Horizons
Tools for watershed delineation, downslope flow routing, cross-section extraction, and seismic/sub-bottom horizon picking:
| Tool | Description |
|---|---|
defineDownSlope | Computes steepest-descent downslope flow vectors and gradient paths across an .r4 bathymetric surface. |
defineWatershed | Delineates drainage basins and watershed catchments on a bathymetric or topographic .r4 grid. |
extractProfile | Extracts depth/elevation cross-sections from an .r4 grid along user-defined waypoints. |
plotProfile | Formats and plots extracted bathymetric or sub-bottom profiles as 8-bit raster images. |
findHorizon | Tracks and extracts sub-bottom acoustic reflector horizons from profile rasters. |
makeStrat | Builds synthetic or interpolated stratigraphic layer grids between acoustic horizons. |
5. Contouring & Vector Overlay Tools
Tools for generating, sorting, embedding, and exporting bathymetric contours:
| Tool | Description |
|---|---|
contgrid | Extracts unsorted binary (bin_vect) or ASCII contour line segments from an .r4 grid. |
sortCont | Chains unsorted bin_vect contour segments into continuous polylines grouped by contour level. |
embedCont | Burns vector contour lines into an 8-bit sun-illuminated or colour-coded raster image. |
getdxf | Converts CAD .dxf vector polylines and contours into OMG vector format orεδΉ. |
6. 8-Bit Raster, Sun-Illumination & Image Compositing
Tools for converting floating-point grids into 8-bit display rasters and compositing sun-illuminated imagery:
| Tool | Description |
|---|---|
r4to8bit | Scales a 32-bit floating-point .r4 grid into an 8-bit unsigned raster (.8bit). |
8bittor4 | Rescales an 8-bit unsigned raster back into a 32-bit floating-point .r4 grid. |
add8bit | Composites or blends two 8-bit raster images together. |
addSUN | Combines a colour-coded depth image with an 8-bit sun-illuminated shaded-relief image. |
addGain | Applies brightness/contrast gain adjustments to 8-bit imagery. |
addstamp | Stamps an annotation, logo, or scale bar onto an 8-bit raster image. |
mix_ci | Blends colour index (bathymetry) and intensity (backscatter/sun-illumination) rasters into a composite image. |
7. Format Import & Export Converters
Tools for importing external DEMs, satellite altimetry, and sonar telemetry into OMG .r4/.8bit formats and exporting to GIS packages:
| Tool | Description |
|---|---|
ASCIItoJHC | Converts gridded ASCII depth/elevation tables into OMG JHC_header (.r4 / .8bit) format. |
r4toASCII | Exports an .r4 or .8bit grid to 3-column ASCII XYZ (lon lat z or x y z) or matrix text. |
r4toESRI | Exports an .r4 or .8bit grid to ESRI Binary Grid (.flt + .hdr + _prj.adf) or ESRI ASCII Grid (.asc). |
r4toGRASS | Exports an .r4 grid to GRASS GIS raster format (.grass_head + .grass_data). |
r4to16bit | Converts a 32-bit .r4 grid into a 16-bit integer binary array. |
tifftor4 | Reads TIFF image metadata via libtiff and initializes a corresponding .r4 grid header. |
SWtoJHC | Imports Sandwell & Smith predicted satellite-altimetry bathymetry grids into .r4 format. |
SatAlt_to_JHC | Converts global satellite altimetry gravity/bathymetry grids into OMG .r4 mapsheets. |
USGS_30sec_to_JHC | Converts USGS 30-arc-second global DEM tiles (GTOPO30 / SRTM30) into .r4 grids. |
gtopo2ascii | Extracts ASCII XYZ subsets from GTOPO30 16-bit big-endian elevation tiles. |
read_dem | Converts USGS ASCII 7.5-minute/1-degree DEMs or SDTS .tar archives to 16-bit binary .bsq rasters. |
readUSGS_DEM | Converts USGS ASCII/SDTS DEMs to .bsq and dumps positive land elevations as thedata XYZ points for weigh_grid. |
jplto8bit | Converts JPL AIRSAR / SIR-C radar imagery into OMG .8bit format. |
locateSAR | Georeferences and resamples synthetic aperture radar (SAR) imagery onto an OMG mapsheet. |
selectcb | Extracts, filters, and Mercator-projects soundings from URI SeaBeam binary files or ASCII lists. |
sm2000toOMG | Performs digital beamforming and bottom detection on raw Kongsberg Mesotech SM2000 I/Q stave data. |
8. Coordinate Projections, Synthetic Data & System Diagnostics
Tools for transforming coordinates, generating synthetic multibeam pings, and testing system I/O:
| Tool | Description |
|---|---|
convertutm | Batch-converts ASCII coordinate files between Geographic (Lat/Lon), UTM, and New Brunswick Stereographic. |
project | Projects 3-column ASCII lat lon z files into Mercator (x, y, z) coordinates. |
testutm | Interactive calculator for forward/inverse UTM, NB Stereographic, and Mercator coordinate conversions across 6 ellipsoids. |
locate_fix | Computes pixel row/column coordinates for navigation fixes on a projected mapsheet. |
pickrot | Computes rotated local bounding-box coordinates for skewed survey sheets. |
calcXYZ | Computes 3D (X, Y, Z) coordinates from range/azimuth/elevation observations. |
makeSynPing | Ray-traces synthetic multibeam swaths over an .r4 bathymetric surface using an .svp sound velocity profile. |
synSurface | Inspects and prepares .r4 grids for synthetic swath generation. |
testmmap | Diagnostic test utility for creating memory-mapped (mmap) 8-bit JHC_header rasters. |
9. 3D Oceanographic Models, MVP Sections & Tidal Currents
Tools for processing Moving Vessel Profiler (MVP) casts, 3D ocean circulation models (QUODDY, POM), and ADCP current grids:
| Tool | Description |
|---|---|
readQUODDY | Reads Dartmouth QUODDY finite-element meshes (.nod, .ele, .bat), harmonic tides/currents, and interpolates .r4 grids. |
makemesh | Generates finite-element or regular grid mesh wireframes for visualization. |
showModelMesh | Exports an ASCII .mesh.llz wireframe from curvilinear model .lat.r4, .lon.r4, and .mask.r4 grids. |
extractNodeProf | Extracts vertical water-column profiles at curvilinear 3D ocean model nodes. |
convert3D_TSZ_to_SV | Converts 3D model temperature, salinity, and depth (T, S, Z) fields into 3D sound velocity (SV) grids. |
extractSVTS | Extracts time series of sound velocity profiles from 4D ocean model outputs. |
extractVertSection | Slices vertical 2D cross-sections through 3D oceanographic model grids. |
convertSectionUVtoRadTan | Rotates horizontal (U, V) current velocity components into along-section and across-section components. |
plotADCPgridcurrents | Grids and plots vector current arrows from acoustic Doppler current profiler (ADCP) observations. |
combineSeaCast | Combines multiple SeaCast / CTD / MVP water-column casts into a unified profile dataset. |
cutMVPLocationSections | Segments Moving Vessel Profiler (MVP) tow-yo cast locations into cross-channel sections. |
ExtractMVP_EK60_Peaks | Extracts acoustic scattering horizon peaks from co-located MVP and Simrad EK60 split-beam echosounder data. |
Table of contents
- 8bittor4
- make_blank
- add8bit
- weigh_grid
- addDTM
- r4to8bit
- addGain
- addstamp
- addSUN
- addWG
- ASCIItoJHC
- calcCost
- calcXYZ
- combineSeaCast
- contgrid
- convert3D_TSZ_to_SV
- convertSectionUVtoRadTan
- convertutm
- correlate
- cutMVPLocationSections
- defineDownSlope
- defineWatershed
- diff8bit
- differ
- DTMreject
- edhead
- embedCont
- ExtractMVP_EK60_Peaks
- extractNodeProf
- extractProfile
- extractSVTS
- extractVertSection
- fillGap
- findHorizon
- findShoals
- fixarray
- getdxf
- gtopo2ascii
- SWtoJHC
- SatAlt_to_JHC
- USGS_30sec_to_JHC
- jplto8bit
- locateSAR
- locate_fix
- makeStrat
- makeSynPing
- make_bases
- makemesh
- maskarray
- mix_ci
- patchWORLD
- pickrot
- plotADCPgridcurrents
- plotProfile
- project
- r4filter
- r4interp
- r4to16bit
- r4toASCII
- r4toESRI
- r4toGRASS
- readQUODDY
- readUSGS_DEM
- read_dem
- selectcb
- showError
- showModelMesh
- sm2000toOMG
- sortCont
- subtractSurface
- surface
- synSurface
- testmmap
- testutm
- tifftor4
- updateArray