GeoEco.Datasets.CollectibleObject

class GeoEco.Datasets.CollectibleObject(parentCollection=None, queryableAttributes=None, queryableAttributeValues=None, lazyPropertyValues=None)

Bases: object

Base class for objects that can appear in a DatasetCollection, namely Dataset and DatasetCollection.

A CollectibleObject typically represents a tabular or gridded dataset such as a table, shapefile, raster, netCDF variable, or OPeNDAP grid. CollectibleObjects are usually queried from a DatasetCollection, which is referred to as the parent of the CollectibleObjects within it. CollectibleObjects can also be defined independently of a DatasetCollection, and have no parent. However, CollectibleObject is a base class that should not be instantiated directly; instead, users should instantiate one of the many derived classes representing the type of dataset they’re interested in.

A DatasetCollection is also itself a CollectibleObject and can be contained within another DatasetCollection. For example, a DatasetCollection representing a netCDF file, which contains CollectibleObjects representing netCDF variables, may be contained by a DatasetCollection representing a file system directory tree or an FTP server.

CollectibleObjects have queryable attributes, which are metadata values used to retrieve a subset of CollectibleObjects from a DatasetCollection by calling QueryDatasets() and supplying a SQL-like expression. The values of queryable attributes are often extracted from file names or other dataset characteristics related to how they are organized or stored in their original source (which is represented by the DatasetCollection).

The queryable attribute definitions for a CollectibleObject can be obtained with GetAllQueryableAttributes() or retrieved individually by name with GetQueryableAttribute(). The queryable attribute values can be retrieved with GetQueryableAttributeValue().

Queryable attributes defined for a DatasetCollection are also implicitly defined for any child CollectibleObjects that they contain (including child DatasetCollections). The children will also inherit the values of their parent’s queryable attributes, unless the children define their own values (these override the parent’s).

CollectibleObjects also have lazy properties, which are additional metadata values that are often not related to how datasets are organized or stored but are needed for certain tasks. Different types of CollectibleObjects have different lazy properties, and it is generally not possible to enumerate them; callers are expected to know the names of the lazy properties they are interested in ahead of time.

Lazy properties may be expensive to retrieve; examples include the dimensions or data type of a netCDF variable, which might not be known until the netCDF file is downloaded and opened. The various types of CollectibleObjects know how to retrieve them but typically defer this until GetLazyPropertyValue() is called. To allow this potentially slow operation to be avoided entirely when the values are known a priori, the caller can supply lazy property values to the CollectibleObject constructor or set them after construction with SetLazyPropertyValue(). For example, if the caller knows the dimensions, data type, and geospatial characteristics of a netCDF variable, these can be supplied when the CollectibleObjects are instantiated, so that they can be utilized by various functions that need to know these values without actually having to download the netCDF files.

The values of lazy properties can also be derived from queryable attributes. Please see the QueryableAttribute documentation for more information.

Parameters:
  • parentCollection (DatasetCollection, optional) – Parent DatasetCollection that this object is part of (if any).

  • queryableAttributes (tuple of QueryableAttribute, optional) – Queryable attributes defined for this object.

  • queryableAttributeValues (dict mapping str to object, optional) – Values of the queryable attributes, expressed as a dictionary mapping the case-insensitive names of queryable attributes to their values.

  • lazyPropertyValues (dict mapping str to object, optional) – Lazy properties to set when this object is constructed, expressed as a dictionary mapping the names of lazy properties to their values.

Returns:

CollectibleObject instance.

Return type:

CollectibleObject

Properties

property DisplayName

(str) Informal name of this object, suitable to be displayed to the user. Read only. Minimum length꞉ 1.

property ParentCollection

(DatasetCollection or None) Parent DatasetCollection that this object is part of (if any). Read only.

Methods

Close

Closes any open files or connections associated with this object and releases any other resources allocated to access it.

DeleteLazyPropertyValue

Deletes the lazy property with the specified name.

GetAllQueryableAttributes

Returns a list of all queryable attributes.

GetLazyPropertyValue

Returns the value of the lazy property with the specified name.

GetQueryableAttribute

Returns the queryable attribute with the specified name.

GetQueryableAttributeValue

Returns the value of the queryable attribute with the specified name.

GetQueryableAttributesWithDataType

Returns a list queryable attributes having the specified data type.

HasLazyPropertyValue

Returns True if the specified lazy property has a value.

SetLazyPropertyValue

Sets the lazy property with the specified name to the specified value.

TestCapability

Tests whether a capability is supported by this class or an instance of it.