Skip to content

Commit

Permalink
Handle (ignore) observation epochs containing event flags (#226)
Browse files Browse the repository at this point in the history
* Fix meteorological is_new_epoch version check

* Verify that epochs have a minimum number of fields

When parsing an epoch we want to ensure that we can at least read the
date and time fields. This function will end up consuming non-epoch
lines occasionally and we want to be sure that we bail early with an
error rather than either barreling ahead and triggering an "invalid
Gregorian date" panic or (even worse) assuming the bad parse is
valid.

* epoch: Add formatting checks to cargo tests

Use the "format" function instead of the "format!" macro to verify that the
module produces correctly-formatted epoch strings.

* Make EpochFlag processing the responsibility of the observation module

Epoch flags are only used by observations, so it does not make sense to
have their processing done within the epoch module. Moves processing and
testing of the parsing and formatting of the flags over to the
observation module.

* Split parsing of normal observations and events into dedicated functions

We don't yet actually *do* anything with events, but we can at least
return an Error to prevent the rest of the system from trying to
treat them as normal observations.

* Handle observations without significant epoch

Event flags 2 - 5 allow the epoch fields to be left blank if they are
not "significant".

* Move Epoch Flag to Observation RINEX dedicated section
* add one comment

---------

Signed-off-by: Jason Gerecke <[email protected]>
Signed-off-by: Guillaume W. Bres <[email protected]>
Co-authored-by: Guillaume W. Bres <[email protected]>
  • Loading branch information
jigpu and gwbres authored Mar 31, 2024
1 parent 7f5079b commit e05eb6b
Show file tree
Hide file tree
Showing 14 changed files with 322 additions and 170 deletions.
2 changes: 1 addition & 1 deletion rinex/src/algorithm/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum Error {
#[error("constellation parsing error")]
ConstellationParing(#[from] gnss::constellation::ParsingError),
#[error("failed to parse epoch flag")]
EpochFlagParsing(#[from] crate::epoch::flag::Error),
EpochFlagParsing(#[from] crate::observation::flag::Error),
#[error("failed to parse constellation")]
ConstellationParsing,
#[error("invalid nav item")]
Expand Down
2 changes: 1 addition & 1 deletion rinex/src/clock/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub(crate) fn parse_epoch(
const OFFSET: usize = "yyyy mm dd hh mm sssssssssss".len();

let (epoch, rem) = rem.split_at(OFFSET);
let (epoch, _) = epoch::parse_utc(epoch.trim())?;
let epoch = epoch::parse_utc(epoch.trim())?;

// nb of data fields
let (_n, rem) = rem.split_at(4);
Expand Down
Loading

0 comments on commit e05eb6b

Please sign in to comment.