Sidereon.GNSS.Bias (Sidereon v3.0.0)

Copy Markdown View Source

DCB and OSB bias products backed by the core bias parsers.

Read policy

Every Bias-SINEX and CODE DCB reader takes a :policy option, :strict (the default) or :lenient. :strict refuses a Bias-SINEX file that departs from something Bias-SINEX 1.00 states explicitly, and a version other than 1.00; :lenient reads such a file and reports each departure in notices/1 as {:departure, departure}. For CODE DCB, :lenient reads a generated title whose time-system label names no known scale, leaving the set without a time scale.

Read failures are returned as {:error, reason}. Core parser failures retain their tagged fields, for example {:departure, {:header_layout, reason}}, {:invalid_input, field, reason}, and {:unsupported_version, version}; filesystem failures are {:io, message}. See error_reason/0 for the complete public term type. String writers refuse source products containing invalid UTF-8; byte writers retain their original bytes.

Lookups

code_osb/5 and code_dsb/6 return {:ok, value_s, provenance} for an available value, where provenance is %{records: [index], overridden: [index]}: the records the value comes from and the covering records a later start overrides, as indices into records/1. Every other outcome is an error naming why no value is given:

  • {:error, :absent} - no record covers the query;
  • {:error, {:unsupported_scale, product_scale | nil, query_scale}} - the query epoch is not on the product's time scale, or the product declares no usable one;

  • {:error, {:ambiguous, [index]}} - several records apply and give different values;
  • {:error, {:carrier_frequency_required, index}}, {:error, :invalid_carrier_frequency}, {:error, {:carrier_frequency_unknown, observable}} - a conversion between nanoseconds and cycles cannot be made;
  • {:error, {:undefined_slope_reference, index}} - a sloped record with neither a start nor an end;
  • {:error, :invalid_epoch} - the query epoch cannot be converted.

Summary

Functions

Satellite code DSB obs1 - obs2 in seconds at epoch, on the time scale scale (default "GPST"); see the module documentation for the result.

Satellite code OSB in seconds for obs at epoch, on the time scale scale (default "GPST"); see the module documentation for the result.

Summary of a parsed product; see Sidereon.GNSS.Bias.Set.

Non-fatal findings about the product, in the order the reader made them.

Write a set as Bias-SINEX text, refusing source rows that are not UTF-8.

Write a set as Bias-SINEX bytes, preserving source bytes exactly.

Write a set as CODE DCB text, refusing source rows that are not UTF-8.

Write a set as CODE DCB bytes, preserving source bytes exactly.

Types

departure_error()

@type departure_error() ::
  {:header_layout, String.t()}
  | {:other_version, String.t()}
  | :missing_footer
  | {:content_after_footer, pos_integer()}
  | {:unexpected_control_line, pos_integer()}
  | {:unclosed_block, String.t(), pos_integer()}
  | {:unopened_block_end, String.t(), pos_integer()}
  | {:mismatched_block_end, String.t(), String.t(), pos_integer()}
  | {:nested_block, String.t(), String.t(), pos_integer()}
  | {:missing_block, String.t()}
  | {:unknown_block, String.t(), pos_integer()}
  | {:block_start_suffix, pos_integer()}
  | {:data_outside_block, pos_integer()}
  | {:missing_declaration, String.t()}
  | {:unsupported_bias_mode, pos_integer(), String.t()}
  | {:non_standard_time_system, pos_integer(), String.t()}
  | {:header_mode_mismatch, String.t(), String.t()}
  | {:unknown_dcb_time_system, pos_integer(), String.t()}
  | {:estimate_count_mismatch, non_neg_integer(), non_neg_integer()}
  | {:other, String.t()}

error_reason()

@type error_reason() ::
  {:invalid_input, String.t(), String.t()}
  | :invalid_epoch
  | {:unknown_observable, String.t()}
  | {:unsupported_version, String.t()}
  | :missing_dcb_metadata
  | :missing_clock_reference
  | {:missing_writer_metadata, String.t()}
  | :utf8
  | {:departure, departure_error()}
  | {:invalid_utf8, pos_integer()}
  | {:unsupported_time_system, String.t() | nil}
  | {:dcb_record_mismatch, non_neg_integer(), String.t()}
  | {:io, String.t()}
  | {:other, String.t()}
  | String.t()

lookup()

@type lookup() :: {:ok, float(), provenance()} | {:error, lookup_error() | term()}

lookup_error()

@type lookup_error() ::
  :absent
  | {:unsupported_scale, String.t() | nil, String.t()}
  | {:ambiguous, [non_neg_integer()]}
  | {:carrier_frequency_required, non_neg_integer()}
  | :invalid_carrier_frequency
  | {:carrier_frequency_unknown, String.t()}
  | {:undefined_slope_reference, non_neg_integer()}
  | :invalid_epoch
  | {:unhandled, String.t()}

policy()

@type policy() :: :strict | :lenient

provenance()

@type provenance() :: %{records: [non_neg_integer()], overridden: [non_neg_integer()]}

Functions

code_dsb(set, satellite_id, obs1, obs2, epoch, scale \\ "GPST")

@spec code_dsb(
  Sidereon.GNSS.Bias.Set.t(),
  String.t(),
  String.t(),
  String.t(),
  NaiveDateTime.t() | tuple(),
  String.t() | atom()
) :: lookup()

Satellite code DSB obs1 - obs2 in seconds at epoch, on the time scale scale (default "GPST"); see the module documentation for the result.

code_dsb!(set, satellite_id, obs1, obs2, epoch, scale \\ "GPST")

code_osb(set, satellite_id, obs, epoch, scale \\ "GPST")

@spec code_osb(
  Sidereon.GNSS.Bias.Set.t(),
  String.t(),
  String.t(),
  NaiveDateTime.t() | tuple(),
  String.t() | atom()
) :: lookup()

Satellite code OSB in seconds for obs at epoch, on the time scale scale (default "GPST"); see the module documentation for the result.

code_osb!(set, satellite_id, obs, epoch, scale \\ "GPST")

info(set)

@spec info(Sidereon.GNSS.Bias.Set.t()) :: map()

Summary of a parsed product; see Sidereon.GNSS.Bias.Set.

load_bias_sinex(path, opts \\ [])

@spec load_bias_sinex(
  Path.t(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t()} | {:error, error_reason()}

load_bias_sinex!(path, opts \\ [])

load_bias_sinex_lossy(path, opts \\ [])

@spec load_bias_sinex_lossy(
  Path.t(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t(), map()} | {:error, error_reason()}

load_code_dcb(path, opts \\ [])

@spec load_code_dcb(
  Path.t(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t()} | {:error, error_reason()}

load_code_dcb!(path, opts \\ [])

load_code_dcb_lossy(path, opts \\ [])

@spec load_code_dcb_lossy(
  Path.t(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t(), map()} | {:error, error_reason()}

notices(set)

@spec notices(Sidereon.GNSS.Bias.Set.t()) :: [atom() | tuple()]

Non-fatal findings about the product, in the order the reader made them.

Each is a tagged tuple: {:departure, departure} for a departure a :lenient read accepted, {:invalid_utf8, line}, {:repeated_declaration, line, keyword}, {:conflicting_declaration, line, keyword}, {:overlap, first, second} (indices into records/1), :dcb_time_system_assumed and {:dcb_time_system_alias, line, label}. A departure is an atom or a tuple led by its name, such as :missing_footer, {:other_version, version}, {:unknown_block, name, line}, {:non_standard_time_system, line, label} or {:estimate_count_mismatch, declared, solution_rows}.

parse_bias_sinex(bytes, opts \\ [])

@spec parse_bias_sinex(
  binary(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t()} | {:error, error_reason()}

parse_bias_sinex!(bytes, opts \\ [])

parse_bias_sinex_lossy(bytes, opts \\ [])

@spec parse_bias_sinex_lossy(
  binary(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t(), map()} | {:error, error_reason()}

parse_code_dcb(bytes, opts \\ [])

@spec parse_code_dcb(
  binary(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t()} | {:error, error_reason()}

parse_code_dcb!(bytes, opts \\ [])

parse_code_dcb_lossy(bytes, opts \\ [])

@spec parse_code_dcb_lossy(
  binary(),
  keyword()
) :: {:ok, Sidereon.GNSS.Bias.Set.t(), map()} | {:error, error_reason()}

records(set)

write_bias_sinex(set)

@spec write_bias_sinex(Sidereon.GNSS.Bias.Set.t()) ::
  {:ok, String.t()} | {:error, error_reason()}

Write a set as Bias-SINEX text, refusing source rows that are not UTF-8.

write_bias_sinex_bytes(set)

@spec write_bias_sinex_bytes(Sidereon.GNSS.Bias.Set.t()) ::
  {:ok, binary()} | {:error, error_reason()}

Write a set as Bias-SINEX bytes, preserving source bytes exactly.

write_code_dcb(set)

@spec write_code_dcb(Sidereon.GNSS.Bias.Set.t()) ::
  {:ok, String.t()} | {:error, error_reason()}

Write a set as CODE DCB text, refusing source rows that are not UTF-8.

write_code_dcb_bytes(set)

@spec write_code_dcb_bytes(Sidereon.GNSS.Bias.Set.t()) ::
  {:ok, binary()} | {:error, error_reason()}

Write a set as CODE DCB bytes, preserving source bytes exactly.