Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# pygnssutils

### RELEASE 1.2.1

FIXES:

1. Restore (nested) pynmeagps dependency in pyproject.toml. Fixes #136
1. Fix blank meteorology output file error. Fixes #138

CHANGES:

1. Updates to rinex conversion to support RINEX version 4.02 in addition to 3.05.

### RELEASE 1.2.0

CHANGES:
Expand Down
10 changes: 3 additions & 7 deletions examples/process_rxmsfrbx_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
raw NAV subframes from a UBX RXM-SFRBX data log using
the pygnssutils.RawNav utility class.

This collates the following subframes for each SV4
This collates the following subframes for each SV
into a single RawNav object.

- subframe 1: clock corrections, sv health, etc.
Expand Down Expand Up @@ -42,7 +42,7 @@
SFR2 = 2
SFR3 = 4
SFR4 = 8
TARGET_SFR = SFR1 | SFR2 | SFR3 # | SFR4
TARGET_SFR = SFR1 | SFR2 | SFR3 # | SFR4


def main(**kwargs):
Expand All @@ -67,9 +67,7 @@ def main(**kwargs):
tot += 1

sfrdata = RawNav.process_rxm_sfrbx(parsed)
if sfrdata.get("gnss", "") != GPS or sfrdata.get("sigid", "") not in (
"1C",
):
if sfrdata.get("gnss", "") != GPS or sfrdata.get("sigid", "") not in ("1C","2L"):
continue

gnss = sfrdata["gnss"]
Expand Down Expand Up @@ -98,8 +96,6 @@ def main(**kwargs):
if nav.sfracq & 0b111 == TARGET_SFR:
frame = navs.pop((gnss, svid))
print(f"{str(frame)}\n")
# if frame.svid == 19:
# print(f"{frame.gnss}{frame.svid=:02d}, {frame.tow=}, {frame.iodc=}")
lnavs[svid] = lnavs.get(svid, 0) + 1
sfr += 1
except RINEXProcessingError:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies = [
"pyserial>=3.5",
"pyspartn>=1.0.8",
"pyubx2>=1.3.0",
"pynmeagps>=1.1.4",
"pysbf2>=1.0.4",
"pyubxutils>=1.0.6",
"pyqgc>=0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/pygnssutils/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
:license: BSD 3-Clause
"""

__version__ = "1.2.0"
__version__ = "1.2.1"
26 changes: 20 additions & 6 deletions src/pygnssutils/rinex_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
MET,
NAV,
OBS,
RINEX4,
RINEX_CANCELLED,
RINEX_ERROR,
RINEX_NORECS,
Expand All @@ -51,8 +52,11 @@
)
from pygnssutils.rinex_helpers import (
format_comments,
format_doi,
format_filename,
format_licenseofuse,
format_runby,
format_stationinfo,
format_version,
)

Expand Down Expand Up @@ -154,6 +158,9 @@ def __init__(
NAV: {MAX: EPOCHMIN, MIN: EPOCHMAX, CUR: EPOCHMIN, FRQ: 0},
MET: {MAX: EPOCHMIN, MIN: EPOCHMAX, CUR: EPOCHMIN, FRQ: 0},
}
self._doi = kwargs.get("doi", "")
self._license = kwargs.get("license", "")
self._station = kwargs.get("station", "")
self.verbosity = int(verbosity)
self.logtofile = logtofile

Expand Down Expand Up @@ -266,7 +273,7 @@ def process_input_data(
for raw, parsed in gnr:
if stopevent is not None:
if stopevent.is_set():
raise RINEXProcessingError("Cancelled")
raise KeyboardInterrupt("Terminated by user")
if raw is not None:
self._tot += 1
self._progress = int(round(100 * self._tot / self._msgcount, 0))
Expand Down Expand Up @@ -294,10 +301,10 @@ def process_input_data(
self.process_output_data(rinextypes)
res = RINEX_OK

# except (TypeError, ValueError, AttributeError) as err:
# self.logger.error(err)
# res = RINEX_ERROR
except (RINEXProcessingError, KeyboardInterrupt):
except RINEXProcessingError as err:
self.logger.error(f"Processing error {err}")
res = RINEX_ERROR
except KeyboardInterrupt:
self.logger.warning("Terminated by user")
res = RINEX_CANCELLED

Expand Down Expand Up @@ -332,11 +339,18 @@ def format_header_common(self, rinextype: Literal["O", "N", "M"]) -> str:
:rtype: str
"""

return (
hdr = (
format_version(self._rinex_version, rinextype, self._gnssfilter)
+ format_runby()
+ format_comments(self.user_comments)
)
if self._rinex_version >= RINEX4:
hdr += (
format_doi(self._doi)
+ format_licenseofuse(self._license)
+ format_stationinfo(self._station)
)
return hdr

def output(self, data: str | Any | NoneType, rinextype: Literal["O", "N", "M"]):
"""
Expand Down
28 changes: 27 additions & 1 deletion src/pygnssutils/rinex_conv_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
RINEX_OK,
RINEXTYPE,
RINEXVER_DEFAULT,
RINEXVERSIONS,
)
from pygnssutils.rinex_helpers import listify

Expand Down Expand Up @@ -64,8 +65,9 @@ def main():
"-R",
"--rinexver",
required=False,
help="RINEX Version e.g. '3.05'",
help="RINEX Version",
type=str,
choices=RINEXVERSIONS,
default=RINEXVER_DEFAULT,
)
ap.add_argument(
Expand Down Expand Up @@ -153,6 +155,27 @@ def main():
type=str,
default="",
)
ap.add_argument(
"--doi",
required=False,
help="Digital Object Identifier (RINEX 4 only)",
type=str,
default="",
)
ap.add_argument(
"--license",
required=False,
help="License of Use (RINEX 4 only)",
type=str,
default="",
)
ap.add_argument(
"--station",
required=False,
help="Station Information (RINEX 4 only)",
type=str,
default="",
)
ap.add_argument(
"--comments",
required=False,
Expand Down Expand Up @@ -191,6 +214,9 @@ def main():
protfilter=int(
kwargs.pop("protfilter", NMEA_PROTOCOL | UBX_PROTOCOL | RTCM3_PROTOCOL)
),
doi=kwargs.pop("doi", ""),
license=kwargs.pop("license", ""),
station=kwargs.pop("station", ""),
**kwargs,
)
res = rc.process_input(
Expand Down
11 changes: 7 additions & 4 deletions src/pygnssutils/rinex_conv_met.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from pyrtcm import RTCMMessage
from pyubx2 import UBXMessage

from pygnssutils.exceptions import RINEXProcessingError
from pygnssutils.globals import VERBOSITY_MEDIUM
from pygnssutils.rinex_globals import BDS, COLWIDTH, EPOCHMIN, MET
from pygnssutils.rinex_helpers import (
Expand Down Expand Up @@ -205,7 +206,7 @@ def convert_nmea_mwd(self, data: NMEAMessage):
try:
# NB: NMEA MWD sentence has no timestamp, so epoch must be
# obtained from another NMEA RMC message in the same data stream
epoch = self.__app.current_epoch
epoch = self.__app.get_current_epoch(MET)
if epoch == EPOCHMIN: # epoch not yet established
return
winddir = data.dirM
Expand All @@ -228,7 +229,8 @@ def convert_nmea_mwd(self, data: NMEAMessage):
self._sensortypes[obscode].get("count", 0) + 1
)
except (AttributeError, TypeError) as err:
print(f"something went wrong {err}")
raise RINEXProcessingError(err) from err
# print(f"something went wrong {err}")

def convert_nmea_xdr(self, data: NMEAMessage):
"""
Expand All @@ -248,7 +250,7 @@ def geta(att: str, i: int):
try:
# NB: NMEA XDR sentence has no timestamp, so epoch must be
# obtained from another NMEA RMC message in the same data stream
epoch = self.__app.current_epoch
epoch = self.__app.get_current_epoch(MET)
if epoch == EPOCHMIN: # epoch not yet established
return
self._metdata[epoch] = self._metdata.get(epoch, {})
Expand Down Expand Up @@ -282,7 +284,8 @@ def geta(att: str, i: int):
break

except (AttributeError, TypeError) as err:
print(f"something went wrong {err}")
raise RINEXProcessingError(err) from err
# print(f"something went wrong {err}")

def get_nmea_epoch(self, data: NMEAMessage):
"""
Expand Down
Loading