Sidereon.GNSS.Data (Sidereon v0.10.0)

Copy Markdown View Source

Cache-first acquisition for GNSS products and DTED terrain tiles.

This module performs transport, cache IO, checksum verification, and provenance recording. Product names, archive URLs, terrain cache paths, and HGT to DTED conversion are delegated to the core NIF, so cache files produced by another binding under the same root are verified by the same relative path and data-file digest.

Numeric modules do not fetch data. Fetch first, then pass the cached file or terrain root to the reader or solver.

Quick Start

{:ok, tile_path} = Sidereon.GNSS.Data.fetch_dted(36.75, -106.25)
terrain_root = Path.dirname(Path.dirname(tile_path))
{:ok, terrain} = Sidereon.Terrain.dted(terrain_root)
{:ok, height_m} = Sidereon.Terrain.height(terrain, -106.25, 36.75)

Bulk Terrain Workflow

{:ok, report} =
  Sidereon.GNSS.Data.prefetch_dted_bbox({36.0, -107.0, 37.0, -106.0},
    cache_dir: "/tmp/sidereon-terrain"
  )

{:ok, terrain} = Sidereon.Terrain.dted("/tmp/sidereon-terrain")
{:ok, _height_m} = Sidereon.Terrain.height(terrain, -106.5, 36.5)

C and WASM consumers use the pure core derivation and conversion functions directly and provide their own transport and cache policy.

Summary

Functions

Archive hosts allowed by the core catalog.

Full archive URL for a product.

Canonical archive filename for a product.

Supported analysis-center codes.

Supported GNSS product type codes.

Day-of-year for a date.

Default GNSS cache root.

Default cache root for :gnss or :terrain.

Derive the DTED ten-degree block directory.

Derive the DTED cache relative path.

Derive the DTED tile filename.

Fetch a GNSS product and return the verified local file path.

Fetch the DTED tile covering lat_deg, lon_deg.

Fetch the newest available IONEX candidate for a target date.

Fetch SP3 products from several centers and merge the contributors.

Fetch merged SP3 and write it to a file.

GPS week number for a date.

Build a RINEX clock product.

Build an IONEX product.

Build a merged broadcast-navigation product.

Build an SP3 product.

Build an ultra-rapid OPS SP3 product.

Parse a Skadi tile id.

Populate a terrain cache from a bbox tuple or tile list.

Build a predicted IONEX product.

Prefetch all terrain tiles in an inclusive bounding box.

Prefetch an explicit list of terrain tile indices or Skadi tile ids.

Build a product specification for any supported center/product/date.

Build the rapid IONEX product for a date.

Derive a Skadi archive URL.

Derive a Skadi latitude band.

Derive a Skadi tile id.

Derive the terrain tile index covering a coordinate.

Write an SP3 product atomically.

Types

error_reason()

@type error_reason() ::
  :offline_cache_miss
  | {:not_found_on_archive, String.t()}
  | {:http_status, integer(), String.t()}
  | {:redirect_not_allowed, integer(), String.t()}
  | {:network, term()}
  | {:checksum_mismatch, String.t(), String.t()}
  | {:download_size_exceeded, non_neg_integer()}
  | {:decompress, term()}
  | {:cache_not_writable, term()}
  | {:unknown_center, String.t()}
  | {:unsupported_product, term()}
  | {:invalid_coordinate, number(), number()}
  | {:invalid_tile_index, integer(), integer()}
  | {:invalid_tile_id, String.t()}
  | {:incompatible_sources, [String.t()], term()}
  | {:no_products, [term()]}
  | {:no_coverage, String.t()}

Functions

allowed_hosts()

@spec allowed_hosts() :: [String.t()]

Archive hosts allowed by the core catalog.

archive_url(product)

@spec archive_url(Sidereon.GNSS.Data.Product.t()) ::
  {:ok, String.t()} | {:error, error_reason()}

Full archive URL for a product.

archive_url(center, product_type, date, opts \\ [])

canonical_filename(product)

@spec canonical_filename(Sidereon.GNSS.Data.Product.t()) ::
  {:ok, String.t()} | {:error, error_reason()}

Canonical archive filename for a product.

canonical_filename(center, product_type, date, opts \\ [])

centers()

@spec centers() :: [String.t()]

Supported analysis-center codes.

content_types()

@spec content_types() :: [String.t()]

Supported GNSS product type codes.

day_of_year(date)

@spec day_of_year(Date.t() | NaiveDateTime.t() | tuple()) ::
  {:ok, non_neg_integer()} | {:error, error_reason()}

Day-of-year for a date.

default_cache_dir()

@spec default_cache_dir() :: String.t()

Default GNSS cache root.

default_cache_dir(kind)

@spec default_cache_dir(:gnss | :terrain) :: String.t()

Default cache root for :gnss or :terrain.

dted_block_dir(lat_index, lon_index)

Derive the DTED ten-degree block directory.

dted_cache_relpath(lat_index, lon_index)

Derive the DTED cache relative path.

dted_tile_filename(lat_index, lon_index)

Derive the DTED tile filename.

fetch(product, opts \\ [])

@spec fetch(
  Sidereon.GNSS.Data.Product.t(),
  keyword()
) :: {:ok, String.t()} | {:error, error_reason()}

Fetch a GNSS product and return the verified local file path.

fetch_dted(lat_deg, lon_deg, opts \\ [])

Fetch the DTED tile covering lat_deg, lon_deg.

fetch_ionex(center, target, opts \\ [])

Fetch the newest available IONEX candidate for a target date.

fetch_merged_sp3(target, centers, opts \\ [])

Fetch SP3 products from several centers and merge the contributors.

fetch_merged_sp3_file(target, centers, path, opts \\ [])

Fetch merged SP3 and write it to a file.

gps_week(date)

@spec gps_week(Date.t() | NaiveDateTime.t() | tuple()) ::
  {:ok, non_neg_integer()} | {:error, error_reason()}

GPS week number for a date.

mgex_clk(center, date, opts \\ [])

Build a RINEX clock product.

mgex_ionex(center, date, opts \\ [])

Build an IONEX product.

mgex_nav(center, date, opts \\ [])

Build a merged broadcast-navigation product.

mgex_sp3(center, date, opts \\ [])

Build an SP3 product.

ops_ultra_sp3(center, target, opts \\ [])

Build an ultra-rapid OPS SP3 product.

parse_skadi_tile_id(tile_id)

Parse a Skadi tile id.

populate_terrain_cache(region, opts \\ [])

Populate a terrain cache from a bbox tuple or tile list.

predicted_ionex(center, date, opts \\ [])

Build a predicted IONEX product.

prefetch_dted_bbox(bbox, opts \\ [])

Prefetch all terrain tiles in an inclusive bounding box.

prefetch_dted_tiles(tiles, opts \\ [])

Prefetch an explicit list of terrain tile indices or Skadi tile ids.

product(center, product_type, date, opts \\ [])

@spec product(term(), term(), Date.t() | NaiveDateTime.t() | tuple(), keyword()) ::
  {:ok, Sidereon.GNSS.Data.Product.t()} | {:error, error_reason()}

Build a product specification for any supported center/product/date.

rapid_ionex(date, opts \\ [])

Build the rapid IONEX product for a date.

skadi_archive_url(lat_index, lon_index)

Derive a Skadi archive URL.

skadi_band(lat_index)

Derive a Skadi latitude band.

skadi_tile_id(lat_index, lon_index)

Derive a Skadi tile id.

terrain_tile_index(lat_deg, lon_deg)

Derive the terrain tile index covering a coordinate.

write_sp3(sp3, path, opts \\ [])

Write an SP3 product atomically.