Skip to content

Commit

Permalink
Enable Helmert transformation in sp3_difference & svs mask
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneDu-GA committed Sep 24, 2024
1 parent c16aba1 commit 4e5b333
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions gnssanalysis/gn_diffaux.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
"""
Expand All @@ -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)
Expand All @@ -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:
"""
Expand All @@ -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()

Expand Down

0 comments on commit 4e5b333

Please sign in to comment.