示例#1
0
文件: metrics.py 项目: sativa/ggcmi
    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
示例#2
0
文件: metrics.py 项目: RDCEP/ggcmi
    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
示例#3
0
文件: metrics.py 项目: sativa/ggcmi
    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
示例#4
0
文件: metrics.py 项目: RDCEP/ggcmi
    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
示例#5
0
文件: metrics.py 项目: sativa/ggcmi
 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
示例#6
0
文件: metrics.py 项目: RDCEP/ggcmi
 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