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

read missing value as np.nan

parent 3f5f5767
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,8 @@ import os, warnings ...@@ -36,6 +36,8 @@ import os, warnings
import numpy as np import numpy as np
import pandas as pd import pandas as pd
missing_value = -888888.0
def _plot_box(m, lat, lon, label="", **kwargs): def _plot_box(m, lat, lon, label="", **kwargs):
""""Draw bounding box """"Draw bounding box
...@@ -571,8 +573,16 @@ class ObsSeq(object): ...@@ -571,8 +573,16 @@ class ObsSeq(object):
if "kind" in line: # find obs kind if "kind" in line: # find obs kind
line_kind = i + 1 line_kind = i + 1
# read values like 'observations', 'truth', 'prior ensemble mean'
for k, key in enumerate(self.keys_for_values): for k, key in enumerate(self.keys_for_values):
out[key] = float(lines[1+k].strip())
v = float(lines[1+k].strip()) # value in obs_seq file
if v == missing_value: # e.g. -888888.0
out[key] = np.nan
else:
out[key] = v
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment