Sidereon.Geoid (Sidereon v0.12.0)

Copy Markdown View Source

Geoid undulation lookup and orthometric/ellipsoidal height conversion.

The geoid undulation N is the height of the geoid (mean sea level) above the WGS84 ellipsoid in metres. GNSS yields the ellipsoidal height h; the orthometric height (height above mean sea level) is H = h - N.

Two entry points are exposed over the sidereon-core geoid module:

The built-in grid is suitable for sanity checks and metre-scale fallback, not survey work; load a real model for accuracy.

Latitude is positive north, longitude positive east. The built-in lookups and grid_undulation_rad/3 take radians; grid_undulation_deg/3 takes degrees.

Summary

Functions

Ellipsoidal height h = H + N (metres) from an orthometric height, using the embedded genuine EGM96 1-degree model. Position in radians.

Orthometric height H = h - N (metres) from an ellipsoidal height, using the embedded genuine EGM96 1-degree model. Position in radians.

Geoid undulation N (metres) at a geodetic position in radians, from the embedded genuine EGM96 1-degree global grid.

Embedded EGM96 1-degree undulations N (metres) for positions in radians.

Embedded EGM96 1-degree undulations N (metres) for positions in degrees.

Ellipsoidal height h = H + N (metres) from an orthometric height, using the built-in grid. Position in radians.

Build a geoid grid handle from its origin, spacing, dimensions, and row-major samples (metres).

Loaded-grid ellipsoidal height h = H + N (metres), position in degrees.

Loaded-grid ellipsoidal height h = H + N (metres), position in radians.

Loaded-grid orthometric height H = h - N (metres), position in degrees.

Loaded-grid orthometric height H = h - N (metres), position in radians.

Bilinearly interpolated undulation N (metres) from a loaded grid handle, at a geodetic position in degrees.

Bilinearly interpolated undulation N (metres) from a loaded grid handle, at a geodetic position in radians.

Bilinearly interpolated undulations N (metres) from a loaded grid, with positions in degrees.

Bilinearly interpolated undulations N (metres) from a loaded grid, with positions in radians.

Parse a full EGM96 WW15MGH.DAC byte buffer into a grid handle.

Parse a geoid grid in the crate's documented text format into a handle.

Orthometric height H = h - N (metres) from an ellipsoidal height, using the built-in grid. Position in radians.

Built-in coarse-grid geoid undulation N (metres) at a geodetic position in radians.

Built-in coarse-grid geoid undulations N (metres) for positions in radians.

Built-in coarse-grid geoid undulations N (metres) for positions in degrees.

Types

grid()

@type grid() :: reference()

Functions

egm96_ellipsoidal_height_m(orthometric_height_m, lat_rad, lon_rad)

@spec egm96_ellipsoidal_height_m(number(), number(), number()) :: float()

Ellipsoidal height h = H + N (metres) from an orthometric height, using the embedded genuine EGM96 1-degree model. Position in radians.

egm96_orthometric_height_m(ellipsoidal_height_m, lat_rad, lon_rad)

@spec egm96_orthometric_height_m(number(), number(), number()) :: float()

Orthometric height H = h - N (metres) from an ellipsoidal height, using the embedded genuine EGM96 1-degree model. Position in radians.

egm96_undulation(lat_rad, lon_rad)

@spec egm96_undulation(number(), number()) :: float()

Geoid undulation N (metres) at a geodetic position in radians, from the embedded genuine EGM96 1-degree global grid.

This is the recommended zero-setup default for metre-class datum work: its bilinear lookup agrees with the full 15-arcminute EGM96 grid to ~0.4 m RMS, far better than the coarse 30-degree built-in undulation/2.

egm96_undulations(points_rad)

@spec egm96_undulations([{number(), number()}]) :: [float()]

Embedded EGM96 1-degree undulations N (metres) for positions in radians.

egm96_undulations_deg(points_deg)

@spec egm96_undulations_deg([{number(), number()}]) :: [float()]

Embedded EGM96 1-degree undulations N (metres) for positions in degrees.

ellipsoidal_height_m(orthometric_height_m, lat_rad, lon_rad)

@spec ellipsoidal_height_m(number(), number(), number()) :: float()

Ellipsoidal height h = H + N (metres) from an orthometric height, using the built-in grid. Position in radians.

grid(lat_min_deg, lon_min_deg, dlat_deg, dlon_deg, n_lat, n_lon, values_m)

@spec grid(
  number(),
  number(),
  number(),
  number(),
  non_neg_integer(),
  non_neg_integer(),
  [number()]
) ::
  {:ok, grid()} | {:error, term()}

Build a geoid grid handle from its origin, spacing, dimensions, and row-major samples (metres).

values_m is a flat list of n_lat * n_lon floats. Returns {:ok, reference()} or {:error, reason}.

grid_ellipsoidal_height_deg(handle, orthometric_height_m, lat_deg, lon_deg)

@spec grid_ellipsoidal_height_deg(grid(), number(), number(), number()) :: float()

Loaded-grid ellipsoidal height h = H + N (metres), position in degrees.

grid_ellipsoidal_height_rad(handle, orthometric_height_m, lat_rad, lon_rad)

@spec grid_ellipsoidal_height_rad(grid(), number(), number(), number()) :: float()

Loaded-grid ellipsoidal height h = H + N (metres), position in radians.

grid_orthometric_height_deg(handle, ellipsoidal_height_m, lat_deg, lon_deg)

@spec grid_orthometric_height_deg(grid(), number(), number(), number()) :: float()

Loaded-grid orthometric height H = h - N (metres), position in degrees.

grid_orthometric_height_rad(handle, ellipsoidal_height_m, lat_rad, lon_rad)

@spec grid_orthometric_height_rad(grid(), number(), number(), number()) :: float()

Loaded-grid orthometric height H = h - N (metres), position in radians.

grid_undulation_deg(handle, lat_deg, lon_deg)

@spec grid_undulation_deg(grid(), number(), number()) :: float()

Bilinearly interpolated undulation N (metres) from a loaded grid handle, at a geodetic position in degrees.

grid_undulation_rad(handle, lat_rad, lon_rad)

@spec grid_undulation_rad(grid(), number(), number()) :: float()

Bilinearly interpolated undulation N (metres) from a loaded grid handle, at a geodetic position in radians.

grid_undulations_deg(handle, points_deg)

@spec grid_undulations_deg(grid(), [{number(), number()}]) :: [float()]

Bilinearly interpolated undulations N (metres) from a loaded grid, with positions in degrees.

grid_undulations_rad(handle, points_rad)

@spec grid_undulations_rad(grid(), [{number(), number()}]) :: [float()]

Bilinearly interpolated undulations N (metres) from a loaded grid, with positions in radians.

load_egm96_dac(bytes)

@spec load_egm96_dac(binary()) :: {:ok, grid()} | {:error, term()}

Parse a full EGM96 WW15MGH.DAC byte buffer into a grid handle.

load_grid(text)

@spec load_grid(binary()) :: {:ok, grid()} | {:error, term()}

Parse a geoid grid in the crate's documented text format into a handle.

The format is whitespace-delimited with # comments: a six-field header lat_min lon_min dlat dlon n_lat n_lon (degrees) followed by n_lat * n_lon undulation samples in metres, row-major (latitude ascending outer). Returns {:ok, reference()} or {:error, reason}.

orthometric_height_m(ellipsoidal_height_m, lat_rad, lon_rad)

@spec orthometric_height_m(number(), number(), number()) :: float()

Orthometric height H = h - N (metres) from an ellipsoidal height, using the built-in grid. Position in radians.

undulation(lat_rad, lon_rad)

@spec undulation(number(), number()) :: float()

Built-in coarse-grid geoid undulation N (metres) at a geodetic position in radians.

undulations(points_rad)

@spec undulations([{number(), number()}]) :: [float()]

Built-in coarse-grid geoid undulations N (metres) for positions in radians.

undulations_deg(points_deg)

@spec undulations_deg([{number(), number()}]) :: [float()]

Built-in coarse-grid geoid undulations N (metres) for positions in degrees.