Skip to content

Commit

Permalink
Calculate mean speed when populating the database tab
Browse files Browse the repository at this point in the history
  • Loading branch information
eriffon committed Jan 22, 2025
1 parent 85e7809 commit 1cd677d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions hyo2/ssm2/app/gui/soundspeedmanager/widgets/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,10 +797,10 @@ def __lt__(self, other):
# prepare the table
self.ssp_list.setSortingEnabled(False)
self.ssp_list.clear()
self.ssp_list.setColumnCount(24)
self.ssp_list.setColumnCount(25)
self.ssp_list.setHorizontalHeaderLabels(['id', 'time', 'location',
'sensor', 'probe',
'ss@min depth', 'min depth', 'max depth', 'max depth[no ext]',
'sensor', 'probe', 'ss@min depth', 'mean speed',
'min depth', 'max depth', 'max depth[no ext]',
'original path', 'institution',
'survey', 'vessel', 'sn',
'processing time', 'processing info', 'surveylines', 'comments',
Expand All @@ -817,7 +817,7 @@ def __lt__(self, other):
processed = True
tokens = ssp_[11].split(";")
# Re-arrange index to match the new items and labels
ssp = ssp_[0:5] + ssp_[20:24] + ssp_[5:20]
ssp = ssp_[0:5] + ssp_[20:25] + ssp_[5:20]
if Dicts.proc_user_infos['PLOTTED'] not in tokens:
processed = False

Expand Down
17 changes: 13 additions & 4 deletions hyo2/ssm2/lib/db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def list_profiles(self):
if probe_type not in Dicts.probe_types.values():
probe_type = Dicts.probe_types['Future']

# special handling for surface sound speed, min depth, max depth
# special handling for surface sound speed, mean sound speed, min depth, max depth
try:
min_depth = str()
for row_min in sql_min:
Expand All @@ -679,6 +679,14 @@ def list_profiles(self):
logger.warning("profile %s: %s -> skipping" % (e, row['pk']))
continue

try:
mean_ss = str()
ssp = self.profile_by_pk(row['pk'])
mean_ss = '%0.2f' % ssp.cur.proc_speed_mean
except Exception as e:
logger.warning("profile %s: %s -> skipping" % (e, row['pk']))
continue

try:
max_depth = str()
for row_max in sql_max:
Expand Down Expand Up @@ -726,9 +734,10 @@ def list_profiles(self):
row['conductivity_uom'], # 18
row['salinity_uom'], # 19
ss_at_min_depth, # 20
min_depth, # 21
max_depth, # 22
max_raw_depth, # 23
mean_ss, # 21
min_depth, # 22
max_depth, # 23
max_raw_depth, # 24
))
return ssp_list

Expand Down

0 comments on commit 1cd677d

Please sign in to comment.