Skip to content

Commit

Permalink
NPI-3655 add unit test and minimal test data for offline sat removal,…
Browse files Browse the repository at this point in the history
… based on PR review
  • Loading branch information
treefern committed Dec 20, 2024
1 parent 5194875 commit c58b413
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_datasets/sp3_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,34 @@
PR02 5096.267067 9515.396007 -23066.803522 -23.760149
EOF
"""

# Original filename IGS0DEMULT_20243181800_02D_05M_ORB.SP3
# Modified using utility script, header manually updated to match.
sp3_test_data_partially_offline_sat = b"""#dP2024 11 13 18 0 0.0000000 3 ORBIT IGS20 HLM IGS
## 2340 324000.00000000 300.00000000 60627 0.7500000000000
+ 3 G02G03G19 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 4 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
%c M cc GPS ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%f 1.2500000 1.025000000 0.00000000000 0.000000000000000
%f 0.0000000 0.000000000 0.00000000000 0.000000000000000
%i 0 0 0 0 0 0 0 0 0
%i 0 0 0 0 0 0 0 0 0
/*
/* NOTE: This is a highly modified file for testing only.
/* It was originally derived from an IGS product, but
/* should not be taken as authoritative.
* 2024 11 13 18 0 0.00000000
PG02 -22358.852114 -13824.987069 -4481.658280 -315.353433 8 9 10
PG03 -12211.683721 -14412.444793 18550.880326 598.854905 9 9 9
PG19 -16358.034086 16602.996553 12179.863169 562.338315 8 10 8
* 2024 11 13 18 5 0.00000000
PG02 -22143.724430 -13804.799870 -5406.496217 -315.350875 3 9 9
PG03 -12184.752097 -15116.241903 18008.487790 598.858009 8 8 10
PG19 0.000000 0.000000 0.000000 999999.999999
* 2024 11 13 18 10 0.00000000
PG02 -21896.123567 -13775.172104 -6321.083787 -315.348317 5 9 9
PG03 -12170.453519 -15798.978021 17431.310591 598.861113 8 8 10
PG19 0.000000 0.000000 0.000000 999999.999999
EOF
"""
17 changes: 17 additions & 0 deletions tests/test_sp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
sp3_test_data_igs_benchmark_null_clock as input_data,
# second dataset is a truncated version of file COD0OPSFIN_20242010000_01D_05M_ORB.SP3:
sp3_test_data_truncated_cod_final as input_data2,
sp3_test_data_partially_offline_sat as offline_sat_test_data,
)


Expand Down Expand Up @@ -180,6 +181,22 @@ def test_velinterpolation(self, mock_file):
self.assertIsNotNone(r)
self.assertIsNotNone(r2)

@patch("builtins.open", new_callable=mock_open, read_data=offline_sat_test_data)
def test_sp3_offline_sat_removal(self, mock_file):
sp3_df = sp3.read_sp3("mock_path", pOnly=False)
self.assertEqual(
sp3_df.index.get_level_values(1).unique().array,
["G02", "G03", "G19"],
"Should be three SVs in test file before removing offline ones",
)

sp3_df = sp3.remove_offline_sats(sp3_df)
self.assertEqual(
sp3_df.index.get_level_values(1).unique().array,
["G02", "G03"],
"Should be two SVs after removing offline ones",
)


class TestMergeSP3(TestCase):
def setUp(self):
Expand Down

0 comments on commit c58b413

Please sign in to comment.