Example #1
0
    def __init__(self, variables=None, realization=None, temporal=None, level=None, spatial=None, meta=None, uid=None,
                 name=None, regrid_destination=False, attrs=None, name_uid=NAME_UID_FIELD):

        if spatial is None:
            msg = 'At least "spatial" is required.'
            raise ValueError(msg)

        Attributes.__init__(self, attrs=attrs)

        self.name_uid = name_uid
        self.realization = realization
        self.temporal = temporal
        self.uid = uid
        self.level = level
        self.spatial = spatial
        self.meta = meta or {}
        self.regrid_destination = regrid_destination
        # holds raw values for aggregated datasets.
        self._raw = None
        # add variables - dimensions are needed first for shape checking
        self.variables = variables
        self._name = name

        # flag used in regridding operations. this should be updated by the driver.
        self._should_regrid = False
        # flag used in regridding to indicate if a coordinate system was assigned by the user in the driver.
        self._has_assigned_coordinate_system = False

        # set default names for the dimensions
        self._set_default_names_uids_()
Example #2
0
    def __init__(self, value=None, units=None, dtype=None, name=None, conform_units_to=None,
                 alias=None, attrs=None):
        self.name = name
        self.alias = alias or self.name

        Attributes.__init__(self, attrs=attrs)

        # if the units value is not None, then convert to string. cfunits.Units may be easily handled this way without
        # checking for the module presence.
        self.units = str(units) if units is not None else None
        self.conform_units_to = conform_units_to
        self.value = value

        # Default to the value data types and fill values ignoring the provided values.
        if value is None:
            self._dtype = dtype
        else:
            self._dtype = None
Example #3
0
    def __init__(self, value=None, units=None, dtype=None, name=None, alias=None, attrs=None, conform_units_to=None):
        if conform_units_to is not None and units is None:
            msg = '"units" are required when "conform_units_to" is not None.'
            raise ValueError(msg)

        self._value = None
        self._units = None
        self._conform_units_to = None

        Attributes.__init__(self, attrs=attrs)

        self.name = name
        self.alias = alias or self.name
        self.units = units
        self.conform_units_to = conform_units_to
        self.value = value

        # Default to the value data type ignoring the provided values.
        if value is None:
            self._dtype = dtype
        else:
            self._dtype = None