diff --git a/da/analysis/siteseries.py b/da/analysis/siteseries.py index bdee911f8ce2b198aff3ddd844b0146c21b1c2f5..8e1ef48a4f4b70239be67349a296f856d7512f97 100755 --- a/da/analysis/siteseries.py +++ b/da/analysis/siteseries.py @@ -164,9 +164,11 @@ def timehistograms_new(fig,infile): f.close() pydates = np.array([dt.datetime(1970,1,1)+dt.timedelta(seconds=int(d)) for d in date]) - sampled = (simulated.mask == False) - if len(sampled.nonzero()[0]) < 2: + sampled = (np.ma.getmask(simulated) == False) + + if len(sampled.nonzero()[0]) < 2: + logging.warning("Too few simulated values found, continuing...") return fig simulated = simulated.compress(sampled) @@ -349,7 +351,11 @@ def timevssite_new(fig,infile): f.close() pydates = np.array([dt.datetime(1970,1,1)+dt.timedelta(seconds=int(d)) for d in date]) - sampled = (simulated.mask == False) + sampled = (np.ma.getmask(simulated) == False) + + if len(sampled.nonzero()[0]) < 2: + logging.warning("Too few simulated values found, continuing...") + return fig simulated = simulated.compress(sampled) obs = obs.compress(sampled) @@ -549,9 +555,10 @@ def residuals_new(fig,infile): f.close() pydates = np.array([dt.datetime(1970,1,1)+dt.timedelta(seconds=int(d)) for d in date]) - sampled = (simulated.mask == False) + sampled = (np.ma.getmask(simulated) == False) - if len(sampled.nonzero()[0]) < 2: + if len(sampled.nonzero()[0]) < 2: + logging.warning("Too few simulated values found, continuing...") return fig simulated = simulated.compress(sampled)