es_sfgtools.pride_tools package

class es_sfgtools.pride_tools.PrideCLIConfig(*, sample_frequency: float = 1, system: str = 'GREC23J', frequency: list = ['G12', 'R12', 'E15', 'C26', 'J12'], loose_edit: bool = True, cutoff_elevation: int = 7, interval: float | None = None, high_ion: bool | None = None, tides: str = 'SOP', local_pdp3_path: str | None = None, override: bool = False, override_products_download: bool = False, pride_configfile_path: Path | None = None)

Bases: BaseModel

PrideCLIConfig is a configuration class for setting up and generating commands to run the pdp3 GNSS processing tool. .. attribute:: system

The GNSS system(s) to use. Default is “GREC23J” which is “GPS/GLONASS/Galileo/BDS/BDS-2/BDS-3/QZSS”.

type:

str

frequency

The GNSS frequencies to use. Default is [“G12”, “R12”, “E15”, “C26”, “J12”]. Refer to Table 5-4 in PRIDE-PPP-AR v.3.0 manual for more options.

Type:

list

loose_edit

Disable strict editing mode, which should be used when high dynamic data quality is poor. Default is True.

Type:

bool

cutoff_elevation

The elevation cutoff angle in degrees (0-60 degrees). Default is 7.

Type:

int

interval

Processing interval, values range from 0.02s to 30s. If this item is not specified and the configuration file is specified, the processing interval in the configuration file will be read, otherwise, the sampling rate of the observation file is used by default.

Type:

float

high_ion

Use 2nd ionospheric delay model with CODE’s GIM product. When this option is not entered, no higher-order ionospheric correction is performed. Default is False.

Type:

bool

tides

Enter one or more of “S” “O” “P”, e.g SO for solid, ocean, and polar tides. Default is “SOP”, which uses all tides.

Type:

str

local_pdp3_path

The path to the local pdp3 binary. Default is None.

Type:

str

generate_pdp_command(site

str, local_file_path: str) -> List[str]: Generate the command to run pdp3 with the given parameters.

site (str): The site identifier for the GNSS data. local_file_path (str): The local file path to the GNSS data.

Returns:

The command to run pdp3 with the specified configuration.

Return type:

List[str]

cutoff_elevation: int
frequency: list
generate_pdp_command(site: str, local_file_path: str) List[str]

Generate the command to run pdp3 with the given parameters

high_ion: bool | None
interval: float | None
local_pdp3_path: str | None
loose_edit: bool
model_computed_fields = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields = {'cutoff_elevation': FieldInfo(annotation=int, required=False, default=7), 'frequency': FieldInfo(annotation=list, required=False, default=['G12', 'R12', 'E15', 'C26', 'J12']), 'high_ion': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None), 'interval': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'local_pdp3_path': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, title='Local Path to pdp3 Binary', description='Path to the local pdp3 binary. If not provided, the system PATH will be used.'), 'loose_edit': FieldInfo(annotation=bool, required=False, default=True), 'override': FieldInfo(annotation=bool, required=False, default=False), 'override_products_download': FieldInfo(annotation=bool, required=False, default=False, title='Flag to Override Existing Products Download'), 'pride_configfile_path': FieldInfo(annotation=Union[Path, NoneType], required=False, default=None, title='Path to Pride Config File', description='Path to the Pride config file. If not provided, the default config will be used.'), 'sample_frequency': FieldInfo(annotation=float, required=False, default=1), 'system': FieldInfo(annotation=str, required=False, default='GREC23J'), 'tides': FieldInfo(annotation=str, required=False, default='SOP')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

override: bool
override_products_download: bool
pride_configfile_path: Path | None
sample_frequency: float
system: str
tides: str
es_sfgtools.pride_tools.get_gnss_products(rinex_path: Path, pride_dir: Path, override: bool = False, source: Literal['all', 'wuhan', 'cligs'] = 'all', date: date | datetime | None = None, override_config: bool = True) Path | None

Generates or retrieves GNSS products for a given RINEX file or date and returns a pride config file path that catalogs the products.

Parameters:
  • rinex_path (Path) – The path to the RINEX file.

  • pride_dir (Path) – The directory where the PRIDE products are stored.

  • override (bool) – If True, the function will attempt to download the products even if they already exist.

  • source (Literal["all", "wuhan", "cligs"]) – The source from which to download the products. Defaults to “all”.

  • date (Optional[datetime.date | datetime.datetime]) – The date for which to retrieve the products. If provided, it will be used to determine the year and day of year (DOY) for the products. If rinex_path is provided, this will be ignored.

  • override_config (bool) – If True, the function will attempt to re-download the products even if a config file already exists.

Returns:

The path to the config file that catalogs the products, or None if the products could not be retrieved or generated.

Return type:

Path | None

es_sfgtools.pride_tools.get_nav_file(rinex_path: Path, override: bool = False) Path

Attempts to build a navigation file for a given RINEX file by downloading the necessary files from the IGS FTP server.

Parameters:
  • rinex_path (Path) – The path to the RINEX file.

  • override (bool) – If True, the function will attempt to download the navigation file even if it already exists.

  • mode (Literal['process','test']) – The mode in which the function is running. Test mode attempt downloads from all resources

Returns:

The path to the navigation file.

Return type:

brdm_path (Path)

Raises:

Warning – If the navigation file cannot be built or located.

Examples

>>> rinex_path = Path("data/NCB11750.23o")
>>> nav_path = get_nav_file(rinex_path)
Attempting to build nav file for data/NCB11750.23o
>>> nav_path
Path("data/BRDC00IGS_R_20231750000_01D_MN.rnx.gz")
es_sfgtools.pride_tools.kin_to_kin_position_df(source: str | Path) DataFrame | None

Create a KinPositionDataFrame from a kin file from PRIDE-PPP.

This includes WRMS residuals.

Parameters:

source (str | Path) – The path to the kin file.

Returns:

DataFrame with kinematic data and residuals, or None if the file cannot be parsed.

Return type:

pd.DataFrame | None

es_sfgtools.pride_tools.rinex_to_kin(source: str, writedir: Path, pridedir: Path, site='SIT1', pride_cli_config: PrideCLIConfig = None) Tuple[Path, Path]

Generate kinematic and residual files from a RINEX file.

This function is a wrapper for the PRIDE-PPP processing tool (pdp3).

Parameters:
  • source (str) – The source RINEX file to convert.

  • writedir (Path) – The directory to write the converted kin file.

  • pridedir (Path) – The directory where PRIDE-PPP observables are stored.

  • site (str, optional) – The site name, by default “SIT1”.

  • pride_cli_config (PrideCLIConfig, optional) – The configuration for PRIDE-PPP processing. If None, uses default settings.

Returns:

The generated kin and result files as Path objects.

Return type:

Tuple[Path, Path]

Raises:
  • FileNotFoundError – If the PRIDE-PPP binary is not found in the system path.

  • FileNotFoundError – If the source RINEX file does not exist.

Examples

>>> source = Path("/path/to/NCB12450.24o") # Example RINEX file path
>>> writedir = Path("/writedir") # Directory to write the kin file
>>> pridedir = Path("/pridedir") # Directory where PRIDE-PPP observables are stored
# Get the PRIDE configuration file path
>>> pride_configfile_path = get_gnss_products(
...     rinex_path=source,
...     pride_dir=pridedir,
...     override=False,
...     source="all"
... )
# Create a PrideCLIConfig instance with the configuration file path
>>> pride_config = PrideCLIConfig(
...     sample_frequency=1,
...     override=False,
...     pride_configfile_path=pride_configfile_path,
... )
# Run PRIDE-PPP to generate kin and res files
>>> kin_file, res_file = rinex_to_kin(
...     source=source,
...     writedir=writedir,
...     pridedir=pridedir,
...     site="NCB1",
...     pride_config=pride_config,
... )
>>> kin_file
Path("writedir/kin_2024126_ncb1.kin")
>>> res_file
Path("writedir/res_2024126_ncb1.res")

Submodules