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
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]
def getQuantiles(self): return Util.clean(self._file.variables["quantiles"])
def getOffsets(self): return Util.clean(self._file.variables["offset"])
def getThresholds(self): return Util.clean(self._file.variables["thresholds"])
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
def getDates(self): return Util.clean(self._file.variables["date"])
def getEns(self): return Util.clean(self._file.variables["ens"])
def getFcst(self): return Util.clean(self._file.variables["fcst"])
def getObs(self): return Util.clean(self._file.variables["obs"])
def getScores(self, metric): temp = Util.clean(self._file.variables[metric]) return temp
def getScores(self, metric): metric = self._toPvarComps(metric) temp = Util.clean(self._file.variables[metric]) return temp