diff --git a/echolab2/instruments/EK80.py b/echolab2/instruments/EK80.py index 012f7e8..ccc680d 100644 --- a/echolab2/instruments/EK80.py +++ b/echolab2/instruments/EK80.py @@ -4264,12 +4264,15 @@ def get_attribute_from_raw(self, raw_data, param_name, return_indices=None): # For now we assume that just like with gain, we use the pulse_duration table even # though there is also a pulse_duration_fm table. match_idx = np.where(config_obj['pulse_duration'] == raw_data.pulse_duration[idx])[0] - new_data[idx] = param_data[match_idx][0] + if(len(param_data[match_idx]) != 0): + new_data[idx] = param_data[match_idx][0] + else: + new_data[idx] = 0.0 else: if param_data.ndim == 1: new_data[idx] = param_data[config_obj['pulse_duration'] == raw_data.pulse_duration[idx]][0] else: - new_data[idx] = param_data[idx, config_obj['pulse_duration'] == raw_data.pulse_duration[idx]][0] + new_data[idx] = param_data[idx, config_obj['pulse_duration'] == raw_data.pulse_duration[idx]][0] param_data = new_data @@ -4309,8 +4312,10 @@ def get_attribute_from_raw(self, raw_data, param_name, return_indices=None): # for FM data without BB cal even though the 'pulse_duration_fm' table exists. # https://www.echoview.com/products-services/news/echoview-bug-fix-correction-to-transducer-gain-calculations-in-simrad-ek80-wideband-data match_idx = np.where(config_obj['pulse_duration'] == raw_data.pulse_duration[idx])[0] - gain = param_data[match_idx][0] - + if(len(param_data[match_idx]) != 0): + gain = param_data[match_idx][0] + else: + gain = 0.0 new_data[idx] = gain + (20 * np.log10(frequency[idx] / config_obj['transducer_frequency'])) else: # CW gain is obtained from the gain table that is indexed by pulse duration