Skip to content

Commit

Permalink
type anno corrections
Browse files Browse the repository at this point in the history
ci

mypy install prereq
  • Loading branch information
scivision committed Jul 26, 2021
1 parent 679fe28 commit 3c8fe42
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.9]
python-version: [3.7, 3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Batch converts NAV and OBS GPS RINEX (including Hatanaka compressed OBS) data in
[xarray.Dataset](http://xarray.pydata.org/en/stable/api.html#dataset)
for easy use in analysis and plotting.
This gives remarkable speed vs. legacy iterative methods, and allows for HPC / out-of-core operations on massive amounts of GNSS data.
GeoRinex works in Python ≥ 3.6 and has over 125 unit tests driven by Pytest.
GeoRinex has over 125 unit tests driven by Pytest.

Pure compiled language RINEX processors such as within Fortran NAPEOS give perhaps 2x faster performance than this Python program--that's pretty good for a scripted language like Python!
However, the initial goal of this Python program was to be for one-time offline conversion of ASCII (and compressed ASCII) RINEX to HDF5/NetCDF4,
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ lint =
flake8-builtins
flake8-blind-except
mypy
types-python-dateutil
plot =
matplotlib
seaborn
Expand Down
8 changes: 1 addition & 7 deletions src/georinex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ def load(
if tlim[1] < tlim[0]:
raise ValueError("stop time must be after start time")

try:
info = rinexinfo(rinexfn)
except RuntimeError:
logging.error(
f"could not read {rinexfn} header. It may not be a known type of RINEX file."
)
return None
info = rinexinfo(rinexfn)

if info["rinextype"] == "nav":
return rinexnav(rinexfn, outfn, use=use, tlim=tlim, overwrite=overwrite)
Expand Down
4 changes: 3 additions & 1 deletion src/georinex/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def get_locations(files: list[Path]) -> pandas.DataFrame:
if isinstance(files[0], io.StringIO):
locs = pandas.DataFrame(index=["0"], columns=["lat", "lon", "interval"])
elif isinstance(files[0], Path):
locs = pandas.DataFrame(index=[file.name for file in files], columns=["lat", "lon", "interval"])
locs = pandas.DataFrame(
index=[file.name for file in files], columns=["lat", "lon", "interval"]
)
else:
raise TypeError("Expecting pathlib.Path")

Expand Down
4 changes: 3 additions & 1 deletion src/georinex/keplerian.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import numpy as np


def keplerian2ecef(sv: xarray.DataArray) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
def keplerian2ecef(
sv: xarray.Dataset,
) -> tuple[xarray.DataArray, xarray.DataArray, xarray.DataArray]:
"""
based on:
https://ascelibrary.org/doi/pdf/10.1061/9780784411506.ap03
Expand Down
2 changes: 1 addition & 1 deletion src/georinex/obs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def obsheader2(
hdr["Nobs"] = len(hdr["fields"])

if isinstance(meas, (tuple, list, np.ndarray)):
ind = np.zeros(len(hdr["fields"]), dtype=bool)
ind: T.Any = np.zeros(len(hdr["fields"]), dtype=bool)
for m in meas:
for i, field in enumerate(hdr["fields"]):
if field.startswith(m):
Expand Down
2 changes: 1 addition & 1 deletion src/georinex/obs3.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def obsheader3(f: T.TextIO, use: list[str] = None, meas: list[str] = None) -> di

# perhaps this could be done more efficiently, but it's probably low impact on overall program.
# simple set and frozenset operations do NOT preserve order, which would completely mess up reading!
sysind = {}
sysind: dict[str, T.Any] = {}
if isinstance(meas, (tuple, list, np.ndarray)):
for sk in fields: # iterate over each system
# ind = np.isin(fields[sk], meas) # boolean vector
Expand Down
1 change: 1 addition & 0 deletions src/georinex/tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_convenience():


def test_time():
pytest.importorskip("unlzw3")
subprocess.check_call(["georinex_time", str(R)])


Expand Down
2 changes: 1 addition & 1 deletion src/georinex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def rinexheader(fn: T.TextIO | Path) -> dict[str, T.Any]:
return hdr


def _tlim(tlim: tuple[str, str] | tuple[datetime, datetime] = None) -> tuple[datetime, datetime]:
def _tlim(tlim: tuple[datetime, datetime] = None) -> tuple[datetime, datetime]:
if tlim is None:
pass
elif len(tlim) == 2 and isinstance(tlim[0], datetime):
Expand Down

0 comments on commit 3c8fe42

Please sign in to comment.