Exemple #1
0
    def __init__(self,*args,**kwds):
        self.name_value = kwds.pop('name_value',None)
        
        AbstractValueVariable.__init__(self,*args,**kwds)

        if self.name_value is None:
            self.name_value = self.name
Exemple #2
0
 def __init__(self,*args,**kwds):
     self.name_value = kwds.pop('name_value',None)
     self.units = kwds.pop('units',None)
     
     AbstractValueVariable.__init__(self,value=kwds.pop('value',None))
     AbstractDimension.__init__(self,*args,**kwds)
     
     if self.name_value is None:
         self.name_value = self.name
Exemple #3
0
    def cfunits_conform(self, to_units):
        """
        Convert and set value and bounds for the dimension object to new units.

        :param to_units: The destination units.
        :type to_units: :class:`cfunits.cfunits.Units`
        """

        # get the original units for bounds conversion. the "cfunits_conform" method updates the object's internal
        # "units" attribute.
        original_units = deepcopy(self.cfunits)
        # call the superclass unit conversion
        AbstractValueVariable.cfunits_conform(self, to_units)
        # if the bounds are already loaded, convert
        if self._bounds is not None:
            AbstractValueVariable.cfunits_conform(self, to_units, value=self._bounds, from_units=original_units)
        # if the bound are not set, they may be interpolated
        elif self.bounds is not None:
            # if the bounds were interpolated, then this should be set to "None" so the units conforming will use the
            # source value units spec.
            if self._has_interpolated_bounds:
                from_units = None
            else:
                from_units = original_units
            # conform the bounds value
            AbstractValueVariable.cfunits_conform(self, to_units, value=self.bounds, from_units=from_units)
Exemple #4
0
 def cfunits_conform(self,to_units):
     ## get the original units for bounds conversion. the "cfunits_conform"
     ## method updates the object's internal "units" attribute.
     original_units = deepcopy(self.cfunits)
     ## call the superclass unit conversion
     AbstractValueVariable.cfunits_conform(self,to_units)
     ## if the bounds are already loaded, convert
     if self._bounds is not None:
         AbstractValueVariable.cfunits_conform(self,to_units,value=self._bounds,from_units=original_units)
     ## if the bound are not set, they may be interpolated
     elif self.bounds is not None:
         ## if the bounds were interpolated, then this should be set to 
         ## "None" so the units conforming will use the source value units 
         ## spec.
         if self._has_interpolated_bounds:
             from_units = None
         else:
             from_units = original_units
         ## conform the bounds value
         AbstractValueVariable.cfunits_conform(self,
                                               to_units,
                                               value=self.bounds,
                                               from_units=from_units)
Exemple #5
0
 def __init__(self, *args, **kwargs):
     self.name_value = kwargs.pop('name_value', None)
     AbstractValueVariable.__init__(self, *args, **kwargs)