From 31a4116311d8eb67ad8fda5e01333b98c0d590dd Mon Sep 17 00:00:00 2001 From: bn1131 Date: Tue, 4 Jul 2023 12:10:16 +0200 Subject: [PATCH] Weights based purely on depth for statistics calculations. Removed incorrect return statement. --- hyo2/soundspeed/profile/profile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hyo2/soundspeed/profile/profile.py b/hyo2/soundspeed/profile/profile.py index 7759ab64..4cf4fc28 100644 --- a/hyo2/soundspeed/profile/profile.py +++ b/hyo2/soundspeed/profile/profile.py @@ -89,7 +89,7 @@ def weighted_arithmetic_std(cls, values, weights): return math.sqrt(var) def weighted_harmonic_std(self): - w = self.calc_weights(self.proc.speed[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) avg = self.weighted_harmonic_mean() var = np.average((self.proc.speed[self.proc_valid] - avg) ** 2, weights=w) return math.sqrt(var) @@ -215,17 +215,17 @@ def proc_depth_median(self): @property def proc_speed_median(self): - w = self.calc_weights(self.proc.speed[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return self.weighted_median(self.proc.speed[self.proc_valid], w) @property def proc_temp_median(self): - w = self.calc_weights(self.proc.temp[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return self.weighted_median(self.proc.temp[self.proc_valid], w) @property def proc_sal_median(self): - w = self.calc_weights(self.proc.sal[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return self.weighted_median(self.proc.sal[self.proc_valid], w) @property @@ -239,12 +239,12 @@ def proc_speed_mean(self): @property def proc_temp_mean(self): - w = self.calc_weights(self.proc.temp[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return np.average(self.proc.temp[self.proc_valid], weights=w) @property def proc_sal_mean(self): - w = self.calc_weights(self.proc.sal[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return np.average(self.proc.sal[self.proc_valid], weights=w) @property @@ -258,12 +258,12 @@ def proc_speed_std(self): @property def proc_temp_std(self): - w = self.calc_weights(self.proc.temp[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return self.weighted_arithmetic_std(self.proc.temp[self.proc_valid], w) @property def proc_sal_std(self): - w = self.calc_weights(self.proc.sal[self.proc_valid]) + w = self.calc_weights(self.proc.depth[self.proc_valid]) return self.weighted_arithmetic_std(self.proc.sal[self.proc_valid], w) def _calc_water_salinity_threshold(self):