From 4e5b333e256fb21a095bb974a33a757688b9983d Mon Sep 17 00:00:00 2001 From: Eugene Du Date: Tue, 24 Sep 2024 00:45:16 +0000 Subject: [PATCH] Enable Helmert transformation in sp3_difference & svs mask --- gnssanalysis/gn_diffaux.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/gnssanalysis/gn_diffaux.py b/gnssanalysis/gn_diffaux.py index 0f05c5c..3ed84a0 100644 --- a/gnssanalysis/gn_diffaux.py +++ b/gnssanalysis/gn_diffaux.py @@ -1,6 +1,6 @@ import logging as _logging from pathlib import Path as _Path -from typing import Union +from typing import Literal, Union import numpy as _np import pandas as _pd @@ -708,6 +708,8 @@ def format_index( def sp3_difference( base_sp3_file: _Path, test_sp3_file: _Path, + svs: list[str], + orb_hlm_mode: Literal[None, "ECF", "ECI"] = None, clk_norm_types: list = [], ) -> _pd.DataFrame: """ @@ -716,22 +718,29 @@ def sp3_difference( :param _Path base_sp3_file: Path of the baseline SP3 file :param _Path test_sp3_file: Path of the test SP3 file - :param clk_norm_types list: Clock normalizations to apply. Available options include 'epoch', 'daily', 'sv', + :param list[str] svs: List of satellites to process + :param str orb_hlm_mode: Helmert transformation to apply to orbits. Can be None, "ECF", or "ECI". + :param list clk_norm_types: Normalizations to apply to clocks. Available options include 'epoch', 'daily', 'sv', any satellite PRN, or any combination of them, defaults to empty list :return _pd.DataFrame: The Pandas DataFrame containing orbit and clock differences """ base_sp3_df = _gn_io.sp3.read_sp3(str(base_sp3_file)) + mask = base_sp3_df.index.get_level_values('PRN').isin(svs) + base_sp3_df = base_sp3_df[mask] + test_sp3_df = _gn_io.sp3.read_sp3(str(test_sp3_file)) + mask = test_sp3_df.index.get_level_values('PRN').isin(svs) + test_sp3_df = test_sp3_df[mask] common_indices = base_sp3_df.index.intersection(test_sp3_df.index) diff_est_df = test_sp3_df.loc[common_indices, "EST"] - base_sp3_df.loc[common_indices, "EST"] diff_xyz_df = diff_est_df.drop(columns=["CLK"]) * 1e3 - diff_rac_df = _gn_io.sp3.diff_sp3_rac(base_sp3_df, test_sp3_df, hlm_mode=None) # TODO: hlm_mode + diff_rac_df = _gn_io.sp3.diff_sp3_rac(base_sp3_df, test_sp3_df, hlm_mode=orb_hlm_mode) # TODO Eugene: compare orbits by constellation diff_rac_df.columns = diff_rac_df.columns.droplevel(0) diff_rac_df = diff_rac_df * 1e3 - diff_clk_df = compare_clk(test_sp3_df, base_sp3_df, norm_types=clk_norm_types) + diff_clk_df = compare_clk(test_sp3_df, base_sp3_df, norm_types=clk_norm_types) # TODO Eugene: compare clocks by constellation diff_clk_df = diff_clk_df.stack(dropna=False).to_frame(name="Clock") * 1e3 diff_sp3_df = diff_xyz_df.join(diff_rac_df) @@ -747,6 +756,7 @@ def sp3_difference( def clk_difference( base_clk_file: _Path, test_clk_file: _Path, + svs: list[str], clk_norm_types: list = [], ) -> _pd.DataFrame: """ @@ -755,14 +765,20 @@ def clk_difference( :param _Path base_clk_file: Path of the baseline CLK file :param _Path test_clk_file: Path of the test CLK file - :param clk_norm_types list: Clock normalizations to apply. Available options include 'epoch', 'daily', 'sv', + :param list[str] svs: List of satellites to process + :param list clk_norm_types: Normalizations to apply to clocks. Available options include 'epoch', 'daily', 'sv', any satellite PRN, or any combination of them, defaults to empty list :return _pd.DataFrame: The Pandas DataFrame containing clock differences """ base_clk_df = _gn_io.clk.read_clk(base_clk_file) + mask = base_clk_df.index.get_level_values('CODE').isin(svs) + base_clk_df = base_clk_df[mask] + test_clk_df = _gn_io.clk.read_clk(test_clk_file) + mask = test_clk_df.index.get_level_values('CODE').isin(svs) + test_clk_df = test_clk_df[mask] - diff_clk_df = compare_clk(test_clk_df, base_clk_df, norm_types=clk_norm_types) + diff_clk_df = compare_clk(test_clk_df, base_clk_df, norm_types=clk_norm_types) # TODO Eugene: compare clocks by constellation diff_clk_df = diff_clk_df.stack(dropna=False).to_frame(name="Clock") * 1e9 diff_clk_df["|Clock|"] = diff_clk_df.abs()