Skip to content

Commit

Permalink
Add missing, mandatory Beam_groupX variables (#1103)
Browse files Browse the repository at this point in the history
* Add missing, mandatory Beam_group beam_stabilisation and non_quantitative_processing, as scalars

* Add mandatory Beam_groupX sample_time_offset to replace the now redundant (for EK60/80) range_sample_offset
  • Loading branch information
emiliom authored Aug 3, 2023
1 parent 8d80c35 commit e0e84f0
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
28 changes: 28 additions & 0 deletions echopype/convert/set_groups_azfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,34 @@ 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)",
"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": (
Expand Down
19 changes: 19 additions & 0 deletions echopype/convert/set_groups_ek60.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,25 @@ def set_beam(self) -> List[xr.Dataset]:
],
},
),
"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)",
"flag_values": [0],
"flag_meanings": ["None"],
},
),
},
coords={
"channel": (
Expand Down
32 changes: 29 additions & 3 deletions echopype/convert/set_groups_ek80.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,25 @@ 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)",
"flag_values": [0],
"flag_meanings": ["None"],
},
),
},
coords={
"channel": (
Expand Down Expand Up @@ -921,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={
Expand Down
3 changes: 2 additions & 1 deletion echopype/utils/coding.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"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

PREFERRED_CHUNKS = "preferred_chunks"
Expand Down

0 comments on commit e0e84f0

Please sign in to comment.