def __init__(self, mode=None): AbstractIdentifiable.__init__(self) self._closed = False if mode is not None and isinstance(mode, str) and mode[0] in ['r','w','a','r+']: self.mode = mode else: self.mode = 'r'
def __init__(self, axes): AbstractIdentifiable.__init__(self) self.axes=Axes() for l in axes: # Add an axis member for the indicated axis try: self.axes[l] = None except KeyError as ke: raise SystemError('Unknown AxisType \'{0}\': {1}'.format(l,ke.message))
def __init__(self, value_module=None, value_class=None, **kwargs): """ @param **kwargs Additional keyword arguments are copied and the copy is passed up to AbstractIdentifiable; see documentation for that class for details """ kwc=kwargs.copy() AbstractIdentifiable.__init__(self, **kwc) self._template_attrs = {} self._value_module = value_module or 'coverage_model.parameter_values' self._value_class = value_class or 'NumericValue'
def __init__(self, value_module=None, value_class=None, **kwargs): """ @param **kwargs Additional keyword arguments are copied and the copy is passed up to AbstractIdentifiable; see documentation for that class for details """ kwc = kwargs.copy() AbstractIdentifiable.__init__(self, **kwc) self._template_attrs = {} self._value_module = value_module or 'coverage_model.parameter_values' self._value_class = value_class or 'NumericValue' self.name = None
def __init__(self, parameter_context, shape, value): """ Construct a new Parameter @param parameter_context The ParameterContext of the parameter @param shape The shape of the parameter @param value The AbstractParameterValue of the parameter """ AbstractIdentifiable.__init__(self) self.context = parameter_context self.value = value self.shape = shape
def __init__(self, contexts=None): """ Construct a new ParameterDictionary @param contexts an iterable collection of ParameterContext objects to add to the ParameterDictionary """ AbstractIdentifiable.__init__(self) self._map = OrderedDict() self.__count=-1 if not contexts is None and hasattr(contexts, '__iter__'): for pc in contexts: if isinstance(pc, ParameterContext): self.add_context(pc)
def __init__(self, contexts=None): """ Construct a new ParameterDictionary @param contexts an iterable collection of ParameterContext objects to add to the ParameterDictionary """ AbstractIdentifiable.__init__(self) self._map = OrderedDict() self.__count=0 self.temporal_parameter_name = None if not contexts is None and hasattr(contexts, '__iter__'): for pc in contexts: if isinstance(pc, ParameterContext): self.add_context(pc)
def __init__(self, name, param_type, reference_frame=None, fill_value=None, variability=None): """ Construct a new ParameterContext object @param name The local name @param param_type The concrete AbstractParameterType @param reference_frame The reference frame, often a coordinate axis identifier @param fill_value The default fill value @param variability Indicates if the parameter is a function of time, space, both, or neither """ # TODO: If additional required constructor parameters are added, make sure they're dealt with in _load AbstractIdentifiable.__init__(self) self.name = name if not isinstance(param_type, AbstractParameterType): raise SystemError('\'param_type\' must be a concrete subclass of AbstractParameterType') self.param_type = param_type # Expose the template_attrs from the param_type for k,v in self.param_type.template_attrs.iteritems(): setattr(self,k,v) self.reference_frame = reference_frame or None self.fill_value = fill_value or -999 self.variability = variability or VariabilityEnum.TEMPORAL
def __init__(self): AbstractIdentifiable.__init__(self) self.template_attrs = {}
def __init__(self, shape, crs, mutability=None): AbstractIdentifiable.__init__(self) self.shape = shape self.crs = crs self.mutability = mutability or MutabilityEnum.IMMUTABLE
def __init__(self, axis_types=None): AbstractIdentifiable.__init__(self) self.axes={} if axis_types is not None: for l in axis_types: self.add_axis(l)
def __init__(self): AbstractIdentifiable.__init__(self)
def __init__(self, name, extents=None): AbstractIdentifiable.__init__(self) self.name = name self.extents = extents or [0]
def __init__(self, shape, **kwargs): kwc=kwargs.copy() AbstractIdentifiable.__init__(self, **kwc) self.shape = shape
def __init__(self, tdom=None, sdom=None, **kwargs): kwc=kwargs.copy() AbstractIdentifiable.__init__(self, **kwc) self.tdom = tdom self.sdom = sdom
def __init__(self, name, param_type=None, axis=None, fill_value=None, variability=None, uom=None, **kwargs): """ Construct a new ParameterContext object Must provide the 'name' argument. It can be either a string indicating the name of the parameter, or an exising ParameterContext object that should be used as a template. If 'name' is a ParameterContext, a keyword argument 'new_name' can be provided which will be used as the name for the new ParameterContext. If 'new_name' is not provided, the name will be the same as the template. When 'name' is a ParameterContext - the provided ParameterContext is utilized as a 'template' and it's attributes are copied into the new ParameterContext. If additional constructor arguments are provided (i.e. axis, fill_value, etc), they will be used preferentially over those in the 'template' ParameterContext. If param_type is specified, it must be compatible (i.e. equivalent) to the param_type in the 'template' ParameterContext. @param name The local name OR a 'template' ParameterContext. @param param_type The concrete AbstractParameterType; defaults to QuantityType if not provided @param axis The axis, typically a member of AxisTypeEnum; if not None, associated with the appropriate Domain @param fill_value The default fill value @param variability Indicates if the parameter is a function of time, space, both, or neither; Default is VariabilityEnum.BOTH @param **kwargs Keyword arguments matching members of ParameterContext.ATTRS are applied. Additional keyword arguments are copied and the copy is passed up to AbstractIdentifiable; see documentation for that class for details """ kwc=kwargs.copy() my_kwargs = {x:kwc.pop(x) for x in self.ATTRS if x in kwc} new_name = kwc.pop('new_name') if 'new_name' in kwc else None param_context = None if not isinstance(name, (basestring, ParameterContext)): raise SystemError('\'name\' must be an instance of either basestring or ParameterContext') if isinstance(name, ParameterContext): param_context = name name = new_name or param_context.name # TODO: If additional required constructor parameters are added, make sure they're dealt with in _load if param_context is None and name is None: raise SystemError('Must specify \'name\', which can be either a string or ParameterContext.') AbstractIdentifiable.__init__(self, **kwc) if not param_context is None: self._derived_from_name = param_context._derived_from_name self.name = name or self._derived_from_name # CBM TODO: Is this right? If param_type is provided, AND is equivalent to the clone's param_type, use it if not param_type is None and (param_type == param_context.param_type): self.param_type = param_type else: self.param_type = copy.deepcopy(param_context.param_type) # Ensure the param_type's name is the same as yours self.param_type.name = self.name self.axis = axis or param_context.axis if uom is not None: self.uom = uom elif param_context.uom is not None: self.uom = param_context.uom self.fill_value = fill_value or param_context.fill_value self.variability = variability or param_context.variability for a in self.ATTRS: setattr(self, a, kwargs[a] if a in my_kwargs else getattr(param_context, a)) else: # TODO: Should this be None? potential for mismatches if the self-given name happens to match a "blessed" name... self._derived_from_name = name self.name = name if param_type and not isinstance(param_type, AbstractParameterType): raise SystemError('\'param_type\' must be a concrete subclass of AbstractParameterType') self.param_type = param_type or QuantityType() # Ensure the param_type's name is the same as yours self.param_type.name = self.name self.axis = axis or None if uom is not None: self.uom = uom if fill_value is not None: # Provided by ParameterType self.fill_value = fill_value self.variability = variability or VariabilityEnum.BOTH for a in self.ATTRS: setattr(self, a, kwargs[a] if a in my_kwargs else None)