-
Notifications
You must be signed in to change notification settings - Fork 97
Support speed and NMEA heading from Simrad .raw files #1703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 22 commits
9b07a20
2428db7
50c263c
d9100c1
dac72c6
c1d018b
12507ef
8369a30
1ac96c6
b64dcdb
de5216a
e20981b
3f833fb
fb1daf6
6d74d01
e32484b
77c0b84
c4a43b5
8a3ffce
0683848
a6bc7b4
b3f2069
7c371cb
a3c3640
8cf2c5c
cb3b393
fb4e896
15fe469
be9b96a
ce85731
b12424f
ff04434
c512947
611cdd2
f90da53
493d46d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -329,11 +329,15 @@ def set_platform(self) -> xr.Dataset: | |
| time2 = np.array(time2) if time2 is not None else [np.nan] | ||
| time3 = self.parser_obj.mru1.get("timestamp", None) | ||
| time3 = np.array(time3) if time3 is not None else [np.nan] | ||
| time10, msg_type_heading, heading_nmea = self._extract_NMEA_heading() | ||
| time11, msg_type_sog, sog_nmea = self._extract_NMEA_speed() | ||
|
|
||
| # Handle potential nan timestamp for time1, time2, and time3 | ||
| # Handle potential nan timestamps | ||
| time1 = self._nan_timestamp_handler(time1) | ||
| time2 = self._nan_timestamp_handler(time2) | ||
| time3 = self._nan_timestamp_handler(time3) | ||
| time10 = self._nan_timestamp_handler(time10) | ||
| time11 = self._nan_timestamp_handler(time11) | ||
|
|
||
| # Set MRU1 lat lon attributes | ||
| latitude_mru1_attrs = self._varattrs["platform_var_default"]["latitude"].copy() | ||
|
|
@@ -351,6 +355,26 @@ def set_platform(self) -> xr.Dataset: | |
| } | ||
| ), | ||
|
|
||
| # If there is no heading data from an MRU but there is from the NMEA data, use that instead | ||
| if "heading" in self.parser_obj.mru0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know of any cases where there is heading received from both MRU and NMEA? I'm wondering if you can just save those as separate variables.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And I guess the same applies to the NMEA speed sentences
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see many vessel-based systems setup to receive both MRU0 datagrams and heading (from a separate gyrocompass via the HDT message), although I found none in the echopype test dataset and is why I added one 😄 My thinking was that from the user's point of view they shouldn't need to (initially) think too much about where the heading came from and just have it be in a For the NMEA speed, many vessels have it in both RMC and VTG messages, but then some vessels don't have RMC and come don't have VTG and that's a detail that user's don't really need to worry about if they both end up in a |
||
| hdg_data = ( | ||
| ["time2"], | ||
| np.array(self.parser_obj.mru0.get("heading", [np.nan])), | ||
| self._varattrs["platform_var_default"]["heading"], | ||
| ) | ||
| elif len(heading_nmea) > 0: | ||
| hdg_data = ( | ||
| ["time10"], | ||
| heading_nmea, | ||
| self._varattrs["platform_var_default"]["heading"], | ||
| ) | ||
| else: | ||
| hdg_data = ( | ||
| ["time2"], | ||
| [np.nan], | ||
| self._varattrs["platform_var_default"]["heading"], | ||
| ) | ||
|
|
||
| # Assemble variables into a dataset: variables filled with nan if do not exist | ||
| platform_dict = {"platform_name": "", "platform_type": "", "platform_code_ICES": ""} | ||
| ds = xr.Dataset( | ||
|
|
@@ -456,17 +480,7 @@ def set_platform(self) -> xr.Dataset: | |
| "standard_name": "sound_frequency", | ||
| }, | ||
| ), | ||
| "heading": ( | ||
| ["time2"], | ||
| np.array(self.parser_obj.mru0.get("heading", [np.nan])), | ||
| { | ||
| "long_name": "Platform heading (true)", | ||
| "standard_name": "platform_orientation", | ||
| "units": "degrees_north", | ||
| "valid_min": 0.0, | ||
| "valid_max": 360.0, | ||
| }, | ||
| ), | ||
| "heading": hdg_data, | ||
| "latitude_mru1": ( | ||
| ["time3"], | ||
| np.array(self.parser_obj.mru1.get("latitude", [np.nan])), | ||
|
|
@@ -477,6 +491,11 @@ def set_platform(self) -> xr.Dataset: | |
| np.array(self.parser_obj.mru1.get("longitude", [np.nan])), | ||
| longitude_mru1_attrs, | ||
| ), | ||
| "speed_over_ground": ( | ||
| ["time11"], | ||
| np.array(sog_nmea), | ||
| self._varattrs["platform_var_default"]["speed_over_ground"], | ||
| ), | ||
| }, | ||
| coords={ | ||
| "channel": ( | ||
|
|
@@ -515,6 +534,22 @@ def set_platform(self) -> xr.Dataset: | |
| "orientation data from the Kongsberg Maritime Binary Datagram.", | ||
| }, | ||
| ), | ||
| "time10": ( | ||
| ["time10"], | ||
| time10, | ||
| { | ||
| **self._varattrs["platform_coord_default"]["time1"], | ||
| "comment": "Time coordinate corresponding to NMEA heading data.", | ||
| }, | ||
| ), | ||
| "time11": ( | ||
| ["time11"], | ||
| time11, | ||
| { | ||
| **self._varattrs["platform_coord_default"]["time1"], | ||
| "comment": "Time coordinate corresponding to NMEA speed data.", | ||
| }, | ||
| ), | ||
| }, | ||
| ) | ||
| ds = ds.assign_attrs(platform_dict) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.