Skip to content
Snippets Groups Projects
Commit 4a04270f authored by lkugler's avatar lkugler
Browse files

fix

parent 78196a4f
No related branches found
No related tags found
No related merge requests found
...@@ -434,9 +434,8 @@ def is_assim_error_parametrized(obscfg): ...@@ -434,9 +434,8 @@ def is_assim_error_parametrized(obscfg):
else: else:
return False return False
def get_parametrized_error(obscfg, df_obs): def get_parametrized_error(obscfg):
"""Calculate the parametrized error for an ObsRecord """Calculate the parametrized error for an ObsConfig (one obs type)
This can be all observations or just a subset of all
Args Args
obscfg () obscfg ()
...@@ -449,6 +448,8 @@ def get_parametrized_error(obscfg, df_obs): ...@@ -449,6 +448,8 @@ def get_parametrized_error(obscfg, df_obs):
# run obs operator (through filter program) # run obs operator (through filter program)
# creates obs_seq.final containing truth & prior Hx # creates obs_seq.final containing truth & prior Hx
run_Hx(time, obscfg) run_Hx(time, obscfg)
osf = obsseq.ObsSeq(cluster.dartrundir + "/obs_seq.final")
df_obs = osf.df
if hasattr(exp, "superob_km"): if hasattr(exp, "superob_km"):
print("superobbing to", exp.superob_km, "km") print("superobbing to", exp.superob_km, "km")
...@@ -554,8 +555,7 @@ if __name__ == "__main__": ...@@ -554,8 +555,7 @@ if __name__ == "__main__":
mask_kind = oso.df.kind == kind mask_kind = oso.df.kind == kind
if is_assim_error_parametrized(obscfg): if is_assim_error_parametrized(obscfg):
assim_err = get_parametrized_error(obscfg)
assim_err = get_parametrized_error(obscfg, oso.df[mask_kind])
oso.df[mask_kind] = assim_err**2 oso.df[mask_kind] = assim_err**2
else: else:
...@@ -566,6 +566,8 @@ if __name__ == "__main__": ...@@ -566,6 +566,8 @@ if __name__ == "__main__":
print(" 3) assimilate ") print(" 3) assimilate ")
archive_osq_out(time) archive_osq_out(time)
set_DART_nml()
assimilate() assimilate()
archive_filteroutput(time) archive_filteroutput(time)
......
...@@ -379,7 +379,7 @@ class ObsSeq(object): ...@@ -379,7 +379,7 @@ class ObsSeq(object):
x, y, z, z_coord = lines[line_loc].split() x, y, z, z_coord = lines[line_loc].split()
out["loc3d"] = float(x), float(y), float(z), int(z_coord) out["loc3d"] = float(x), float(y), float(z), int(z_coord)
out["kind"] = int(lines[line_kind].strip()) 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["time"] = tuple(lines[-2].split())
out["variance"] = float(lines[-1].strip()) out["variance"] = float(lines[-1].strip())
return out return out
...@@ -406,8 +406,7 @@ class ObsSeq(object): ...@@ -406,8 +406,7 @@ class ObsSeq(object):
return list_of_obsdict return list_of_obsdict
def to_pandas(self): def to_pandas(self):
"""Create xr.Dataset containing observations """Create pd.DataFrame with rows=observations
Variables = observation types
""" """
obs_dict_list = self.obs_to_dict() obs_dict_list = self.obs_to_dict()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment