es_sfgtools.novatel_tools.novatel_ascii_operations module

es_sfgtools.novatel_tools.novatel_ascii_operations.novatel_ascii_2rinex(file: Path, writedir: Path = None, site: str = 'SIT1', metadata: dict | MetadataModel | Path | str = None, modulo_millis: int = 0, *kwargs) List[Path]

Convert a NovAtel ASCII file to a daily RINEX file using nova2rnxo. This function wraps the external nova2rnxo binary to convert a NovAtel ASCII observation file into a daily RINEX file. Metadata describing the site and receiver can be supplied directly or generated automatically from a site code. If metadata is a mapping or MetadataModel, it is validated and written to a JSON file in writedir. If it is a path (or string path), it is checked for existence and validated as JSON metadata. If metadata is not provided, a metadata JSON is generated using get_metadatav2 with the given site code and a random serial number. The resulting RINEX file produced by nova2rnxo is moved from a temporary working directory into writedir and its final path is returned.

Parameters:
  • file (pathlib.Path or str) – Path to the input NovAtel ASCII file to convert.

  • writedir (pathlib.Path or str, optional) – Directory where the output RINEX (and metadata JSON, if created) will be written. Defaults to the parent directory of file.

  • site (str, optional) – Four-character site code used when generating metadata automatically, required if metadata is not provided. Must be exactly 4 characters.

  • metadata (dict, MetadataModel, pathlib.Path or str, optional) –

    Site/receiver metadata. May be:
    • A dict containing metadata fields compatible with MetadataModel.

    • A MetadataModel instance.

    • A path (or string path) to a JSON file with metadata.

    If provided, it is validated against MetadataModel. If provided as a dict or MetadataModel, a JSON metadata file is written to writedir.

  • modulo_millis (int, optional) – Decimation modulo in milliseconds (e.g., 1000 for 1 Hz, 15000 for 15s intervals). If 0, no decimation is applied. Loss-of-lock indicators from skipped epochs are propagated to the next written epoch. Default is 0 (no decimation).

  • **kwargs – Currently unused; accepted for future extensibility.

Returns:

Paths to the generated daily RINEX files in writedir.

Return type:

List[pathlib.Path]

Raises:
  • AssertionError – If metadata is None and site is missing, not a string, or not exactly 4 characters long, or if metadata is not a path by the time it is passed to nova2rnxo.

  • ValueError – If the metadata dictionary, model, or JSON file fails validation against MetadataModel, or if metadata is of an unsupported type.

  • FileNotFoundError – If the provided metadata file path does not exist.

  • subprocess.CalledProcessError – If the nova2rnxo subprocess fails.

Notes

This function relies on get_nova2rnxo_binary_path() to locate a compatible nova2rnxo binary for the current system. A temporary working directory under /tmp/ is used for intermediate files and is cleaned up automatically.

es_sfgtools.novatel_tools.novatel_ascii_operations.novatel_ascii_2tile(files: List[str], gnss_obs_tdb: Path, n_procs: int = 10, verbose: bool = True) None

This function is a python wrapper for the nova2tile golang binary. Given a list of novatel ascii files, get all the rangea logs and add them to a single tdb array

Parameters:
  • files (List[str]) – List of asset entries to process

  • gnss_obs_tdb (Path) – Path to the gnss_obs tiledb array

  • n_procs (int, optional) – number of processes to use. Defaults to 10.

es_sfgtools.novatel_tools.novatel_ascii_operations.qcpin_to_novatelpin(source: str | Path, writedir: Path) Path

Convert a QCPIN JSON file to a Novatel PIN text file. :param source: Path to the QCPIN JSON file. :type source: str|Path :param writedir: Directory where the Novatel PIN text file will be saved. :type writedir: Path

Returns:

Path to the generated Novatel PIN text file.

Return type:

Path