def getgridobj(self, var=None): # return self._gridobj assert var in self.nc.variables gridobj = None if self._checkcache(var): gridobj = self._coordcache[var].xy else: self._coordcache[var] = cachevar() if gridobj == None: names = self.get_coord_names(var) if names["xname"] != None or names["yname"] != None: gridobj = Gridobj(self.nc, names["xname"], names["yname"]) else: gridobj = None self._coordcache[var].add_xy(gridobj) return gridobj
def getgridobj(self, var=None): #return self._gridobj assert var in self._current_variables gridobj = None if self._checkcache(var): gridobj = self._coordcache[var].xy else: self._coordcache[var] = cachevar() if gridobj is None: names = self.get_coord_names(var) if names['xname'] is not None and names['yname'] is not None: gridobj = Gridobj(self.nc, names["xname"], names["yname"]) else: gridobj = None self._coordcache[var].add_xy(gridobj) return gridobj
def getdepthvar(self, var=None, use_cache=True): #return self._depthvar assert var in self._current_variables depthvar = None if use_cache == True: if self._checkcache(var): depthvar = self._coordcache[var].z else: self._coordcache[var] = cachevar() if depthvar == None: names = self.get_coord_names(var) if names['zname'] != None: depthvar = Depthvar(self.nc, names["zname"]) else: depthvar = None if use_cache == True: self._coordcache[var].add_z(depthvar) return depthvar
def gettimevar(self, var=None, use_cache=True): #return self._timevar assert var in self._current_variables timevar = None if use_cache == True: if self._checkcache(var): timevar = self._coordcache[var].time else: self._coordcache[var] = cachevar() if timevar == None: names = self.get_coord_names(var) if names['tname'] != None: timevar = Timevar(self.nc, names["tname"]) else: timevar = None if use_cache == True: self._coordcache[var].time = timevar return timevar
def getdepthvar(self, var=None, use_cache=True): #return self._depthvar assert var in self._current_variables depthvar = None if use_cache is True: if self._checkcache(var): depthvar = self._coordcache[var].z else: self._coordcache[var] = cachevar() if depthvar is None: names = self.get_coord_names(var) if names['zname'] is not None: depthvar = Depthvar(self.nc, names["zname"]) else: depthvar = None if use_cache is True: self._coordcache[var].add_z(depthvar) return depthvar
def gettimevar(self, var=None, use_cache=True): #return self._timevar assert var in self._current_variables timevar = None if use_cache is True: if self._checkcache(var): timevar = self._coordcache[var].time else: self._coordcache[var] = cachevar() if timevar is None: names = self.get_coord_names(var) if names['tname'] is not None: timevar = Timevar(self.nc, names["tname"]) else: timevar = None if use_cache is True: self._coordcache[var].time = timevar return timevar