Exemplo n.º 1
0
 def getStations(self):
     lat = Util.clean(self._file.variables["Lat"])
     lon = Util.clean(self._file.variables["Lon"])
     id = Util.clean(self._file.variables["Location"])
     elev = Util.clean(self._file.variables["Elev"])
     stations = list()
     for i in range(0, lat.shape[0]):
         station = Station.Station(id[i], lat[i], lon[i], elev[i])
         stations.append(station)
     return stations
Exemplo n.º 2
0
    def _getScore(self, metric, findex=None):
        if (findex is None):
            findex = self._findex

        if (metric in self._cache[findex]):
            return self._cache[findex][metric]

        # Load all files
        for f in range(0, self.getNumFilesWithClim()):
            if (metric not in self._cache[f]):
                file = self._files[f]
                if (metric not in file.getVariables()):
                    Util.error("Variable '" + metric + "' does not exist in " +
                               self.getFilenames()[f])
                temp = file.getScores(metric)
                dims = file.getDims(metric)
                temp = Util.clean(temp)
                for i in range(0, len(dims)):
                    I = self._getIndices(dims[i].lower(), f)
                    if (i == 0):
                        temp = temp[I, Ellipsis]
                    if (i == 1):
                        temp = temp[:, I, Ellipsis]
                    if (i == 2):
                        temp = temp[:, :, I, Ellipsis]
                self._cache[f][metric] = temp

        # Remove missing. If one configuration has a missing value, set all
        # configurations to missing This can happen when the dates are available,
        # but have missing values
        if self._removeMissingAcrossAll:
            isMissing = np.isnan(self._cache[0][metric])
            for f in range(1, self.getNumFilesWithClim()):
                isMissing = isMissing | (np.isnan(self._cache[f][metric]))
            for f in range(0, self.getNumFilesWithClim()):
                self._cache[f][metric][isMissing] = np.nan

        return self._cache[findex][metric]
Exemplo n.º 3
0
 def getQuantiles(self):
     return Util.clean(self._file.variables["quantiles"])
Exemplo n.º 4
0
 def getOffsets(self):
     return Util.clean(self._file.variables["offset"])
Exemplo n.º 5
0
 def getThresholds(self):
     return Util.clean(self._file.variables["thresholds"])
Exemplo n.º 6
0
 def getCdf(self, threshold):
     # thresholds = getThresholds()
     # I = np.where(thresholds == threshold)[0]
     # assert(len(I) == 1)
     temp = Util.clean(self._file.variables["cdf"])
     return temp
Exemplo n.º 7
0
 def getDates(self):
     return Util.clean(self._file.variables["date"])
Exemplo n.º 8
0
 def getEns(self):
     return Util.clean(self._file.variables["ens"])
Exemplo n.º 9
0
 def getFcst(self):
     return Util.clean(self._file.variables["fcst"])
Exemplo n.º 10
0
 def getObs(self):
     return Util.clean(self._file.variables["obs"])
Exemplo n.º 11
0
 def getScores(self, metric):
     temp = Util.clean(self._file.variables[metric])
     return temp
Exemplo n.º 12
0
 def getScores(self, metric):
     metric = self._toPvarComps(metric)
     temp = Util.clean(self._file.variables[metric])
     return temp