Sidereon.GNSS.Troposphere (Sidereon v3.0.0)

Copy Markdown View Source

Neutral-atmosphere (tropospheric) signal-delay corrections.

Computes the GNSS tropospheric delay over the sidereon-core crate as a Saastamoinen (1972) zenith hydrostatic and wet delay, driven by supplied surface meteorology, mapped to the line of sight by the Niell (1996) mapping functions (NMF). The zenith delays and the mapping factors are exposed separately, and a convenience entry composes the full slant delay.

This is the neutral-atmosphere signal-path delay. It is not Sidereon.Atmosphere, which is NRLMSISE-00 neutral-atmosphere mass density for drag; a different quantity.

Sign convention

The tropospheric delay is non-dispersive: it has the same sign and magnitude for code and carrier phase. The returned delays are positive meters that increase the measured pseudorange; delay_m > 0 means the signal arrived later and the pseudorange is too long by delay_m.

Units at the boundary

Elevation and latitude are degrees (_deg); height is the WGS84 ellipsoidal height in meters (_m). Surface meteorology is supplied as %{pressure_hpa: p, temperature_k: t, relative_humidity: rh} where pressure is hectopascals, temperature is kelvin, and relative humidity is a unit fraction in [0, 1] (not a percentage). A below-sea-level (negative) height is used with its sign.

Summary

Types

Complete typed refusal returned by the detailed troposphere calls.

Input failure returned by a detailed troposphere call.

Detailed troposphere result with typed input and core refusals.

Failure reason returned by checked troposphere mapping.

Functions

Niell hydrostatic and wet mapping factors at an elevation.

Detailed sibling of mapping/4 that returns complete typed refusals, including field and reason for frame-value and time-model constructor errors.

Full slant tropospheric delay in positive meters.

Detailed sibling of slant_delay/6 that returns complete typed refusals, including field and reason for frame-value and time-model constructor errors.

Zenith hydrostatic and wet tropospheric delays from supplied meteorology.

Detailed sibling of zenith_delay/3 that returns complete typed refusals.

Types

core_error_detail()

@type core_error_detail() :: %{
  family: String.t(),
  kind: String.t(),
  message: String.t(),
  field: String.t() | nil,
  reason: String.t() | nil,
  debug: String.t() | nil
}

Complete typed refusal returned by the detailed troposphere calls.

family is CoreError, FrameValueError, or TimeModelError. kind is INVALID_INPUT, FRAME_VALUE_INVALID_INPUT, or TIME_MODEL_INVALID_INPUT; frame and time-model details also retain their exact field and reason strings. The NIF map always includes field, reason, and debug; fields not used by a family are nil.

detailed_error()

@type detailed_error() ::
  {:invalid_input, core_error_detail()}
  | :bad_meteorology
  | :bad_epoch
  | {:invalid_epoch_field, atom(), term()}
  | {:value_out_of_range, atom(), term()}
  | {:invalid_argument, atom()}
  | {:arithmetic_error, atom()}
  | :nif_panicked

Input failure returned by a detailed troposphere call.

detailed_result(value)

@type detailed_result(value) :: {:ok, value} | {:error, detailed_error()}

Detailed troposphere result with typed input and core refusals.

mapping_error()

@type mapping_error() ::
  :below_mapping_elevation
  | :above_mapping_elevation
  | :outside_mapping_height
  | term()

Failure reason returned by checked troposphere mapping.

Functions

mapping(elevation_deg, lat_deg, height_m, epoch)

@spec mapping(number(), number(), number(), NaiveDateTime.t() | tuple()) ::
  {:ok, %{dry: float(), wet: float()}} | {:error, mapping_error()}

Niell hydrostatic and wet mapping factors at an elevation.

epoch is a NaiveDateTime or {{y, m, d}, {h, min, s}} tuple (the Niell seasonal term needs the day-of-year). Returns {:ok, %{dry: dry, wet: wet}} (dimensionless) or {:error, reason}. Niell mapping rejects elevations below its 3 degree validity bound with {:error, :below_mapping_elevation}.

mapping_detailed(elevation_deg, lat_deg, height_m, epoch)

@spec mapping_detailed(number(), number(), number(), NaiveDateTime.t() | tuple()) ::
  detailed_result(%{dry: float(), wet: float()})

Detailed sibling of mapping/4 that returns complete typed refusals, including field and reason for frame-value and time-model constructor errors.

The legacy mapping function keeps returning its existing error categories.

slant_delay(elevation_deg, lat_deg, lon_deg, height_m, met, epoch)

@spec slant_delay(
  number(),
  number(),
  number(),
  number(),
  map(),
  NaiveDateTime.t() | tuple()
) ::
  {:ok, float()} | {:error, term()}

Full slant tropospheric delay in positive meters.

Composes the Saastamoinen zenith delays with the Niell mapping at the given elevation. epoch sets the seasonal day-of-year. Returns {:ok, delay_m} (positive meters; zero at or below the horizon and outside the height validity range) or {:error, reason}.

slant_delay_detailed(elevation_deg, lat_deg, lon_deg, height_m, met, epoch)

@spec slant_delay_detailed(
  number(),
  number(),
  number(),
  number(),
  map(),
  NaiveDateTime.t() | tuple()
) ::
  detailed_result(float())

Detailed sibling of slant_delay/6 that returns complete typed refusals, including field and reason for frame-value and time-model constructor errors.

Successful values and the below-horizon zero retain the legacy behavior.

zenith_delay(lat_deg, height_m, met)

@spec zenith_delay(number(), number(), map()) ::
  {:ok, %{dry_m: float(), wet_m: float()}} | {:error, term()}

Zenith hydrostatic and wet tropospheric delays from supplied meteorology.

Returns {:ok, %{dry_m: dry, wet_m: wet}} (both positive meters) or {:error, reason}. The hydrostatic delay carries the gravity correction for the receiver latitude and height.

zenith_delay_detailed(lat_deg, height_m, met)

@spec zenith_delay_detailed(number(), number(), map()) ::
  detailed_result(%{dry_m: float(), wet_m: float()})

Detailed sibling of zenith_delay/3 that returns complete typed refusals.

Successful values match zenith_delay/3. Core errors retain their kind, message, and debug detail; frame-value and time-model errors retain their family, message, exact field, and reason. The original zenith_delay/3 continues to return its established error atom.