Skip to content

VDatum

coastalmodeling_vdatum.vdatum

This module provides functions for converting vertical datums.

build_pipe(lat, lon, z, h_g, g_g, g_h, online, epoch=None)

Builds and executes a pyproj pipeline for vertical datum transformation.

This is a low-level function that constructs a PROJ pipeline string and uses it to transform coordinates.

Parameters

lat : array_like Input latitudes. lon : array_like Input longitudes. z : array_like Input vertical values. h_g : str Path or URL to the height-to-geoid grid. g_g : str PROJ pipeline string for geoid-to-geoid transformation. g_h : str Path or URL to the geoid-to-height grid. online : bool If True, enables network access for pyproj. epoch : int, optional Epoch for time-dependent transformations, by default None.

Returns

tuple A tuple containing the transformed latitudes, longitudes, and vertical values.

convert(vd_from, vd_to, lat, lon, z, epoch=None, online=True)

Converts vertical datum.

This is the main function for converting between vertical datums. It supports 'xgeoid20b', 'navd88', 'mllw', 'mlw', 'mhhw', 'mhw', 'lmsl', 'igld85', and 'lwd'.

Parameters

vd_from : str Source vertical datum. One of: 'xgeoid20b', 'navd88', 'mllw', 'mlw', 'mhhw', 'mhw', 'lmsl', 'igld85', 'lwd'. vd_to : str Target vertical datum. One of: 'xgeoid20b', 'navd88', 'mllw', 'mlw', 'mhhw', 'mhw', 'lmsl', 'igld85', 'lwd'. lat : array_like Input latitudes. lon : array_like Input longitudes. z : array_like Input vertical values. epoch : int, optional Epoch for time-dependent transformations, by default None. online : bool, optional If True (default), enables network access for pyproj to fetch grid files. If False, assumes grid files are available locally.

Returns

tuple A tuple containing the transformed latitudes, longitudes, and vertical values.

Raises

ValueError If vd_from or vd_to are not valid datums.

Notes
  • The size of lat, lon, and z must match.
  • Points outside the vertical datum conversion domain will be returned as inf.

inputs(vd_from, vd_to)

Selects the appropriate transformation grids and pipelines.

Based on the source and target vertical datums, this function returns the paths to the required grid files and the geoid-to-geoid transformation pipeline string.

Parameters

vd_from : str Source vertical datum. vd_to : str Target vertical datum.

Returns

tuple A tuple containing the height-to-geoid grid, the geoid-to-geoid pipeline, and the geoid-to-height grid.