From 05618e824ed2df6bb1f7cb048f2894d7aa980a68 Mon Sep 17 00:00:00 2001 From: Emilio Mayorga Date: Sun, 30 Jul 2023 21:18:34 -0700 Subject: [PATCH 1/2] Add missing, mandatory Beam_group beam_stabilisation and non_quantitative_processing, as scalars --- echopype/convert/set_groups_azfp.py | 18 ++++++++++++++++++ echopype/convert/set_groups_ek60.py | 18 ++++++++++++++++++ echopype/convert/set_groups_ek80.py | 18 ++++++++++++++++++ echopype/utils/coding.py | 2 ++ 4 files changed, 56 insertions(+) diff --git a/echopype/convert/set_groups_azfp.py b/echopype/convert/set_groups_azfp.py index 76da16019..067ceeb3c 100644 --- a/echopype/convert/set_groups_azfp.py +++ b/echopype/convert/set_groups_azfp.py @@ -382,6 +382,24 @@ def set_beam(self) -> List[xr.Dataset]: "valid_min": 0.0, }, ), + "beam_stabilisation": ( + [], + np.array(0, np.byte), + { + "long_name": "Beam stabilisation applied (or not)", + "flag_values": [0, 1], + "flag_meanings": ["not stabilised", "stabilised"], + }, + ), + "non_quantitative_processing": ( + [], + np.array(0, np.int16), + { + "long_name": "Presence or not of non-quantitative processing applied to the backscattering data (sonar specific)", # noqa + "flag_values": [0], + "flag_meanings": ["None"], + }, + ), }, coords={ "channel": ( diff --git a/echopype/convert/set_groups_ek60.py b/echopype/convert/set_groups_ek60.py index dccb0e84a..b81257c0b 100644 --- a/echopype/convert/set_groups_ek60.py +++ b/echopype/convert/set_groups_ek60.py @@ -585,6 +585,24 @@ def set_beam(self) -> List[xr.Dataset]: ["channel"], beam_params["gpt_software_version"], ), + "beam_stabilisation": ( + [], + np.array(0, np.byte), + { + "long_name": "Beam stabilisation applied (or not)", + "flag_values": [0, 1], + "flag_meanings": ["not stabilised", "stabilised"], + }, + ), + "non_quantitative_processing": ( + [], + np.array(0, np.int16), + { + "long_name": "Presence or not of non-quantitative processing applied to the backscattering data (sonar specific)", # noqa + "flag_values": [0], + "flag_meanings": ["None"], + }, + ), }, coords={ "channel": ( diff --git a/echopype/convert/set_groups_ek80.py b/echopype/convert/set_groups_ek80.py index fc71846b5..18ab19f95 100644 --- a/echopype/convert/set_groups_ek80.py +++ b/echopype/convert/set_groups_ek80.py @@ -592,6 +592,24 @@ def _assemble_ds_ping_invariant(self, params, data_type): ["channel"], beam_params["transceiver_software_version"], ), + "beam_stabilisation": ( + [], + np.array(0, np.byte), + { + "long_name": "Beam stabilisation applied (or not)", + "flag_values": [0, 1], + "flag_meanings": ["not stabilised", "stabilised"], + }, + ), + "non_quantitative_processing": ( + [], + np.array(0, np.int16), + { + "long_name": "Presence or not of non-quantitative processing applied to the backscattering data (sonar specific)", # noqa + "flag_values": [0], + "flag_meanings": ["None"], + }, + ), }, coords={ "channel": ( diff --git a/echopype/utils/coding.py b/echopype/utils/coding.py index a4a57a7cc..589a04ea1 100644 --- a/echopype/utils/coding.py +++ b/echopype/utils/coding.py @@ -44,6 +44,8 @@ "beam": np.str_, "channel_mode": np.byte, "range_sample_offset": np.int32, + "beam_stabilisation": np.byte, + "non_quantitative_processing": np.int16, } # channel name # beam name PREFERRED_CHUNKS = "preferred_chunks" From ff082ccb1913b33364d0533620ce0e9b742329f7 Mon Sep 17 00:00:00 2001 From: Emilio Mayorga Date: Mon, 31 Jul 2023 11:59:51 -0700 Subject: [PATCH 2/2] Add mandatory Beam_groupX sample_time_offset to replace the now redundant (for EK60/80) range_sample_offset --- echopype/convert/set_groups_azfp.py | 12 +++++++++++- echopype/convert/set_groups_ek60.py | 16 ++++++++++++---- echopype/convert/set_groups_ek80.py | 16 ++++++++++++---- echopype/utils/coding.py | 1 - 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/echopype/convert/set_groups_azfp.py b/echopype/convert/set_groups_azfp.py index 067ceeb3c..9faa45091 100644 --- a/echopype/convert/set_groups_azfp.py +++ b/echopype/convert/set_groups_azfp.py @@ -395,11 +395,21 @@ def set_beam(self) -> List[xr.Dataset]: [], np.array(0, np.int16), { - "long_name": "Presence or not of non-quantitative processing applied to the backscattering data (sonar specific)", # noqa + "long_name": "Presence or not of non-quantitative processing applied" + " to the backscattering data (sonar specific)", "flag_values": [0], "flag_meanings": ["None"], }, ), + "sample_time_offset": ( + [], + 0.0, + { + "long_name": "Time offset that is subtracted from the timestamp" + " of each sample", + "units": "s", + }, + ), }, coords={ "channel": ( diff --git a/echopype/convert/set_groups_ek60.py b/echopype/convert/set_groups_ek60.py index b81257c0b..7826b1aec 100644 --- a/echopype/convert/set_groups_ek60.py +++ b/echopype/convert/set_groups_ek60.py @@ -598,7 +598,8 @@ def set_beam(self) -> List[xr.Dataset]: [], np.array(0, np.int16), { - "long_name": "Presence or not of non-quantitative processing applied to the backscattering data (sonar specific)", # noqa + "long_name": "Presence or not of non-quantitative processing applied" + " to the backscattering data (sonar specific)", "flag_values": [0], "flag_meanings": ["None"], }, @@ -663,10 +664,17 @@ def set_beam(self) -> List[xr.Dataset]: "flag_meanings": ["power only", "angle only", "power and angle"], }, ), - "range_sample_offset": ( + "sample_time_offset": ( ["ping_time"], - np.array(self.parser_obj.ping_data_dict["offset"][ch], dtype=np.int32), - {"long_name": "First sample number"}, + ( + np.array(self.parser_obj.ping_data_dict["offset"][ch]) + * np.array(self.parser_obj.ping_data_dict["sample_interval"][ch]) + ), + { + "long_name": "Time offset that is subtracted from the timestamp" + " of each sample", + "units": "s", + }, ), "channel_mode": ( ["ping_time"], diff --git a/echopype/convert/set_groups_ek80.py b/echopype/convert/set_groups_ek80.py index 18ab19f95..f5eb424af 100644 --- a/echopype/convert/set_groups_ek80.py +++ b/echopype/convert/set_groups_ek80.py @@ -605,7 +605,8 @@ def _assemble_ds_ping_invariant(self, params, data_type): [], np.array(0, np.int16), { - "long_name": "Presence or not of non-quantitative processing applied to the backscattering data (sonar specific)", # noqa + "long_name": "Presence or not of non-quantitative processing applied" + " to the backscattering data (sonar specific)", "flag_values": [0], "flag_meanings": ["None"], }, @@ -939,10 +940,17 @@ def _assemble_ds_common(self, ch, range_sample_size): "flag_meanings": ["CW", "FM", "FMD"], }, ), - "range_sample_offset": ( + "sample_time_offset": ( ["ping_time"], - np.array(self.parser_obj.ping_data_dict["offset"][ch], dtype=int), - {"long_name": "First sample number"}, + ( + np.array(self.parser_obj.ping_data_dict["offset"][ch]) + * np.array(self.parser_obj.ping_data_dict["sample_interval"][ch]) + ), + { + "long_name": "Time offset that is subtracted from the timestamp" + " of each sample", + "units": "s", + }, ), }, coords={ diff --git a/echopype/utils/coding.py b/echopype/utils/coding.py index 589a04ea1..e199840ee 100644 --- a/echopype/utils/coding.py +++ b/echopype/utils/coding.py @@ -43,7 +43,6 @@ "cal_channel_id": np.str_, "beam": np.str_, "channel_mode": np.byte, - "range_sample_offset": np.int32, "beam_stabilisation": np.byte, "non_quantitative_processing": np.int16, } # channel name # beam name