def __init__(self, *args, **kwargs): if kwargs.get('value') is None and kwargs.get('data') is None: msg = 'Without a "data" object, "value" is required.' raise ValueError(msg) self._bounds = None self._name_bounds = None self._name_bounds_tuple = None self.name_bounds_dimension = kwargs.pop('name_bounds_dimension', OCGIS_BOUNDS) bounds = kwargs.pop('bounds', None) # used for creating name_bounds as well as the name of the bounds dimension in netCDF self.name_bounds = kwargs.pop('name_bounds', None) self.name_bounds_tuple = kwargs.pop('name_bounds_tuple', None) self.axis = kwargs.pop('axis', None) # if True, bounds were interpolated. if False, they were loaded from source data. used in conforming units. self._has_interpolated_bounds = False AbstractSourcedVariable.__init__(self, kwargs.pop('data', None), kwargs.pop('src_idx', None)) AbstractUidValueDimension.__init__(self, *args, **kwargs) # setting bounds requires checking the data type of value set in a superclass. self.bounds = bounds # conform any units if they provided. check they are not equivalent first if self.conform_units_to is not None: if not self.conform_units_to.equals(self.cfunits): self.cfunits_conform(self.conform_units_to)
def cfunits_conform(self, *args, **kwargs): # Get the from units before conforming the value. The units are changed in the value conform. from_units = kwargs.get('from_units') or self.cfunits # Store the original units to use for bounds conversion. self._original_units = self.cfunits # Conform the value. AbstractSourcedVariable.cfunits_conform(self, *args, **kwargs) # Conform the units if self._bounds is not None: self._bounds = get_conformed_units(self._bounds, from_units, args[0])
def __init__(self,*args,**kwds): bounds = kwds.pop('bounds',None) self.name_bounds = kwds.pop('name_bounds',None) self._axis = kwds.pop('axis',None) AbstractSourcedVariable.__init__(self,kwds.pop('data',None),src_idx=kwds.pop('src_idx',None),value=kwds.get('value')) AbstractUidValueDimension.__init__(self,*args,**kwds) ## setting bounds requires checking the data type of value set in a ## superclass. self.bounds = bounds if self._axis is None: self._axis = 'undefined'
def __init__(self,*args,**kwds): bounds = kwds.pop('bounds',None) self.name_bounds = kwds.pop('name_bounds',None) self._axis = kwds.pop('axis',None) ## if True, an attempt will be made to interpolate bounds if None are ## provided. self._interpolate_bounds = kwds.pop('interpolate_bounds',False) ## if True, bounds were interpolated. if False, they were loaded from ## source data self._has_interpolated_bounds = False AbstractSourcedVariable.__init__(self, kwds.pop('data',None), src_idx=kwds.pop('src_idx',None), value=kwds.get('value'), dtype=kwds.get('dtype')) AbstractUidValueDimension.__init__(self,*args,**kwds) ## setting bounds requires checking the data type of value set in a ## superclass. self.bounds = bounds if self._axis is None: self._axis = 'undefined'
def __init__(self, *args, **kwargs): self._name_value = None self.name_value = kwargs.pop('name_value', None) AbstractSourcedVariable.__init__(self, *args, **kwargs)
def _set_value_(self, value): value = get_none_or_array(value, self._ndims, masked=False) AbstractSourcedVariable._set_value_(self, value)