From 357c5a64b3680bf1e3748131051b2023786c6662 Mon Sep 17 00:00:00 2001 From: lkugler <lukas.kugler@gmail.com> Date: Wed, 29 Dec 2021 16:25:07 +0100 Subject: [PATCH] update obsseq --- dartwrf/obsseq.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dartwrf/obsseq.py b/dartwrf/obsseq.py index 182bf7d..aa1c193 100755 --- a/dartwrf/obsseq.py +++ b/dartwrf/obsseq.py @@ -185,17 +185,23 @@ class ObsRecord(pd.DataFrame): print("index y from", j, 'to', j + win_obs) print("obs indices box=", i_obs_grid[i : i + win_obs, j : j + win_obs]) - # average the subset - # metadata are assumed to be equal + # select the subset of pd.DataFrame obs_box = self.iloc[i_obs_box] + # average the subset + # metadata are assumed to be equal obs_mean = obs_box.iloc[0] - # despite its name, 'observations' is a single value + + # average spread and other values for key in obs_box: if key in ['loc3d', 'kind', 'metadata', 'time']: pass - elif 'spread' in key: # mean of std deviations + elif 'spread' in key: + # stdev of mean of values = sqrt(mean of variances) obs_mean.at[key] = np.sqrt((obs_box[key]**2).mean()) + elif key == 'variance': + # variance of mean = sum(variances)/n^2 + obs_mean.at[key] = obs_box[key].sum()/obs_box[key].size**2 else: obs_mean.at[key] = obs_box[key].mean() -- GitLab