Skip to content
Snippets Groups Projects
Commit ae7ce4a2 authored by Lan Dam's avatar Lan Dam
Browse files

perform finalize only once after data loaded

parent 93b79182
No related branches found
No related tags found
1 merge request!142perform finalize only once after data loaded
......@@ -318,20 +318,6 @@ class GeneralData():
execute_db(f'UPDATE PersistentData SET FieldValue="{self.tmp_dir}" '
f'WHERE FieldName="tempDataDirectory"')
def check_not_found_soh_channels(self):
# FROM data_type_model.Data_Type_Model.check_not_found_soh_channels
all_chans_meet_req = (
list(self.soh_data[self.selected_key].keys()) +
list(self.mass_pos_data[self.selected_key].keys()) +
list(self.log_data[self.selected_key].keys()))
not_found_chans = [c for c in self.req_soh_chans
if c not in all_chans_meet_req]
if not_found_chans != []:
msg = (f"No data found for the following channels: "
f"{', '.join( not_found_chans)}")
self.processing_log.append((msg, LogType.WARNING))
def sort_all_data(self):
"""
FROM data_type_model.Data_Type_Model.sort_all_data
......@@ -341,51 +327,51 @@ class GeneralData():
because it is created from log data which is sorted in
prepare_soh_data_from_log_data()
"""
sort_data(self.waveform_data[self.selected_key])
sort_data(self.mass_pos_data[self.selected_key])
try:
sort_data(self.soh_data[self.selected_key])
except KeyError:
# Reftek's SOH trace doesn't have startTmEpoch and
# actually soh_data consists of only one trace
pass
for key in self.keys:
sort_data(self.waveform_data[key])
sort_data(self.mass_pos_data[key])
try:
sort_data(self.soh_data[key])
except KeyError:
# Reftek's SOH trace doesn't have startTmEpoch and
# actually soh_data consists of only one trace
pass
def combine_all_data(self):
combine_data(self.selected_key, self.waveform_data, self.gap_minimum)
combine_data(self.selected_key, self.mass_pos_data, self.gap_minimum)
try:
combine_data(self.selected_key, self.soh_data, self.gap_minimum)
except KeyError:
# Reftek's SOH trace doesn't have startTmEpoch and
# actually soh_data consists of only one trace
pass
for key in self.keys:
combine_data(key, self.waveform_data, self.gap_minimum)
combine_data(key, self.mass_pos_data, self.gap_minimum)
try:
combine_data(key, self.soh_data, self.gap_minimum)
except KeyError:
# Reftek's SOH trace doesn't have startTmEpoch and
# actually soh_data consists of only one trace
pass
def retrieve_gaps_from_data_dicts(self):
"""
Getting gaps from each data_dicts then squash all related gaps
"""
self.gaps[self.selected_key] = []
retrieve_gaps_from_data_dict(
self.selected_key, self.soh_data, self.gaps)
retrieve_gaps_from_data_dict(
self.selected_key, self.mass_pos_data, self.gaps)
retrieve_gaps_from_data_dict(
self.selected_key, self.waveform_data, self.gaps)
for key in self.keys:
self.gaps[key] = []
retrieve_gaps_from_data_dict(key, self.soh_data, self.gaps)
retrieve_gaps_from_data_dict(key, self.mass_pos_data, self.gaps)
retrieve_gaps_from_data_dict(key, self.waveform_data, self.gaps)
self.gaps[self.selected_key] = squash_gaps(
self.gaps[self.selected_key])
self.gaps[key] = squash_gaps(self.gaps[key])
def retrieve_data_time_from_data_dicts(self):
"""
Going through each data_dict to update the data_time to be
[min of startTimeEpoch, max of endTimeEpoch] for each station.
"""
retrieve_data_time_from_data_dict(
self.selected_key, self.soh_data, self.data_time)
retrieve_data_time_from_data_dict(
self.selected_key, self.mass_pos_data, self.data_time)
retrieve_data_time_from_data_dict(
self.selected_key, self.waveform_data, self.data_time)
for key in self.keys:
retrieve_data_time_from_data_dict(
key, self.soh_data, self.data_time)
retrieve_data_time_from_data_dict(
key, self.mass_pos_data, self.data_time)
retrieve_data_time_from_data_dict(
key, self.waveform_data, self.data_time)
def fill_empty_data(self):
"""
......@@ -406,12 +392,13 @@ class GeneralData():
Applying convert_factor to avoid using flags to prevent double
applying convert factor when plotting
"""
apply_convert_factor_to_data_dict(
self.selected_key, self.soh_data, self.data_type)
apply_convert_factor_to_data_dict(
self.selected_key, self.mass_pos_data, self.data_type)
apply_convert_factor_to_data_dict(
self.selected_key, self.waveform_data, self.data_type)
for key in self.keys:
apply_convert_factor_to_data_dict(
key, self.soh_data, self.data_type)
apply_convert_factor_to_data_dict(
key, self.mass_pos_data, self.data_type)
apply_convert_factor_to_data_dict(
key, self.waveform_data, self.data_type)
def reset_all_selected_data(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment