def tslice(self, x, t, tref): tcommon = intersect1d(t, tref) nt = len(tcommon) xs = masked_array(zeros(nt), mask=ones(nt)) for i in range(nt): tidx = where(t == tcommon[i])[0][0] xs[i] = x[tidx] return xs
def tslice(self, x, t, tref): tcommon = intersect1d(t, tref) nt = len(tcommon) xs = masked_array(zeros(nt), mask = ones(nt)) for i in range(nt): tidx = where(t == tcommon[i])[0][0] xs[i] = x[tidx] return xs
def metric(self, sim, obs, time, obsbase=None): st = time[sim < sim.mean() - sim.std()] ot = time[obs < obs.mean() - obs.std()] tc = intersect1d(ot, st) sim_extreme = self.tslice(sim, time, tc) obs_extreme = self.tslice(obs, time, tc) if sim_extreme.size: return (obs_extreme - sim_extreme).mean() else: return masked
def metric(self, sim, obs, time, obsbase = None): st = time[sim < sim.mean() - sim.std()] ot = time[obs < obs.mean() - obs.std()] tc = intersect1d(ot, st) sim_extreme = self.tslice(sim, time, tc) obs_extreme = self.tslice(obs, time, tc) if sim_extreme.size: return (obs_extreme - sim_extreme).mean() else: return masked
def metric(self, sim, obs, time, obsbase=None): st = time[sim < sim.mean() - sim.std()] ot = time[obs < obs.mean() - obs.std()] tc = intersect1d(ot, st) return double(tc.size) / ot.size if ot.size else masked
def metric(self, sim, obs, time, obsbase = None): st = time[sim < sim.mean() - sim.std()] ot = time[obs < obs.mean() - obs.std()] tc = intersect1d(ot, st) return double(tc.size) / ot.size if ot.size else masked