Skip to content

Commit

Permalink
review: answering comments
Browse files Browse the repository at this point in the history
  • Loading branch information
seballgeyer committed Jul 24, 2024
1 parent 1631d32 commit fe81af2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-cicd-units.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
19 changes: 9 additions & 10 deletions gnssanalysis/gn_io/sp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ def sp3_clock_nodata_to_nan(sp3_df: _pd.DataFrame) -> None:

def mapparm(old: Tuple[float, float], new: Tuple[float, float]) -> Tuple[float, float]:
"""
Maps values from the old range to the new range.
Evaluate the offset and scale factor needed to map values from the old range to the new range.
:param Tuple[float, float] old: The old range of values.
:param Tuple[float, float] new: The new range of values.
:param Tuple[float, float] old: The range of values to be mapped from.
:param Tuple[float, float] new: The range of values to be mapped to.
:return Tuple[float, float]: The offset and scale factor for the mapping.
"""
oldlen = old[1] - old[0]
newlen = new[1] - new[0]
off = (old[1] * new[0] - old[0] * new[1]) / oldlen
scl = newlen / oldlen
return off, scl
old_range = old[1] - old[0]
new_range = new[1] - new[0]
offset = (old[1] * new[0] - old[0] * new[1]) / old_range
scale_factor = new_range / old_range
return offset, scale_factor


def _process_sp3_block(
Expand Down Expand Up @@ -139,7 +139,7 @@ def read_sp3(sp3_path: str, pOnly: bool = True, nodata_to_nan: bool = True) -> _
:param str sp3_path: The path to the SP3 file.
:param bool pOnly: If True, only P* values (positions) are included in the DataFrame. Defaults to True.
:param book nodata_to_nan: If True, converts 0.000000 (indicating nodata) to NaN in the SP3 POS column
:param bool nodata_to_nan: If True, converts 0.000000 (indicating nodata) to NaN in the SP3 POS column
and converts 999999* (indicating nodata) to NaN in the SP3 CLK column. Defaults to True.
:return pandas.DataFrame: The SP3 data as a DataFrame.
:raise FileNotFoundError: If the SP3 file specified by sp3_path does not exist.
Expand All @@ -160,7 +160,6 @@ def read_sp3(sp3_path: str, pOnly: bool = True, nodata_to_nan: bool = True) -> _
fline_b = header.find(b"%f") + 2 # TODO add to header parser
fline = header[fline_b : fline_b + 24].strip().split(b" ")
base_xyzc = _np.asarray([float(fline[0])] * 3 + [float(fline[1])]) # exponent base
# Compile the regular expression pattern
date_lines, data_blocks = _split_sp3_content(content)
sp3_df = _pd.concat([_process_sp3_block(date, data) for date, data in zip(date_lines, data_blocks)])
sp3_df = _reformat_df(sp3_df)
Expand Down

0 comments on commit fe81af2

Please sign in to comment.