From 4a04270ff46dd1baade7ed6ff5a40bcd638b13e4 Mon Sep 17 00:00:00 2001 From: lkugler <lukas.kugler@gmail.com> Date: Wed, 5 Jan 2022 14:18:17 +0100 Subject: [PATCH] fix --- dartwrf/assim_synth_obs.py | 12 +++++++----- dartwrf/obsseq.py | 5 ++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dartwrf/assim_synth_obs.py b/dartwrf/assim_synth_obs.py index 1860692..c07d847 100755 --- a/dartwrf/assim_synth_obs.py +++ b/dartwrf/assim_synth_obs.py @@ -434,9 +434,8 @@ def is_assim_error_parametrized(obscfg): else: return False -def get_parametrized_error(obscfg, df_obs): - """Calculate the parametrized error for an ObsRecord - This can be all observations or just a subset of all +def get_parametrized_error(obscfg): + """Calculate the parametrized error for an ObsConfig (one obs type) Args obscfg () @@ -449,6 +448,8 @@ def get_parametrized_error(obscfg, df_obs): # run obs operator (through filter program) # creates obs_seq.final containing truth & prior Hx run_Hx(time, obscfg) + osf = obsseq.ObsSeq(cluster.dartrundir + "/obs_seq.final") + df_obs = osf.df if hasattr(exp, "superob_km"): print("superobbing to", exp.superob_km, "km") @@ -554,8 +555,7 @@ if __name__ == "__main__": mask_kind = oso.df.kind == kind if is_assim_error_parametrized(obscfg): - - assim_err = get_parametrized_error(obscfg, oso.df[mask_kind]) + assim_err = get_parametrized_error(obscfg) oso.df[mask_kind] = assim_err**2 else: @@ -566,6 +566,8 @@ if __name__ == "__main__": print(" 3) assimilate ") archive_osq_out(time) + + set_DART_nml() assimilate() archive_filteroutput(time) diff --git a/dartwrf/obsseq.py b/dartwrf/obsseq.py index aa1c193..e7db51d 100755 --- a/dartwrf/obsseq.py +++ b/dartwrf/obsseq.py @@ -379,7 +379,7 @@ class ObsSeq(object): x, y, z, z_coord = lines[line_loc].split() out["loc3d"] = float(x), float(y), float(z), int(z_coord) out["kind"] = int(lines[line_kind].strip()) - out["metadata"] = lines[line_kind + 1 : -3] + out["metadata"] = lines[line_kind + 1 : -2] out["time"] = tuple(lines[-2].split()) out["variance"] = float(lines[-1].strip()) return out @@ -406,8 +406,7 @@ class ObsSeq(object): return list_of_obsdict def to_pandas(self): - """Create xr.Dataset containing observations - Variables = observation types + """Create pd.DataFrame with rows=observations """ obs_dict_list = self.obs_to_dict() -- GitLab