Arrays
- class deker.arrays.Array(collection, adapter, id_=None, primary_attributes=None, custom_attributes=None)
- Bases: - BaseArray- Arrayis an abstract wrapper over final low-level arrays containing data.- Arrayis created by collection. It is a- lazyobject that does not interact with its data itself, but it possesses all information about the array. Interaction with data is performed by a- Subsetobject, which is produced by- Array.__getitem__()method.- Properties- as_dict: serializes main information about array into dictionary, prepared for JSON
- collection: returns the name of- Collectionto which the- Arrayis bound
- dimensions: returns a tuple of- Array'sdimensions as objects
- dtype: returns type of the- Arraydata
- id: returns- Array'sid
- schema: returns- Array'slow-level schema
- shape: returns- Array'sshape as a tuple of dimension sizes
- named_shape: returns- Array'sshape as a tuple of dimension names bound to their sizes
 - Attributes- According to the schema, arrays may have or may not have primary and/or custom attributes. Attributes are stored in low-level array’s metadata. Primary attributes are immutable and ordered, custom attributes are mutable and unordered. - primary_attributes: Primary attributes are used for- Arraysfiltering. It is an OrderedDict. If collection schema contains attributes schema with some of them defined as primary, you obtain a possibility to quickly find all- Arrayswhich can have a certain attribute or meet same conditions based on primary attributes values.- E.g., if we refer to the example above and store the information about arrays’ data heights into primary attribute, we can create a filter - {"height": 10}and find the- Array, which data was calculated at height equal to 10 meters.
- custom_attributes: Custom attributes are used to keep some unique information about the array or about its data. E.g. you store some weather data, which is calculated at different heights. If it is not important for filtering you can keep the information about certain heights in arrays’ custom attribute, named “height”. In this case you won’t be able to search by this attribute, but still you’ll be able to use this information in your calculations, checking it array by array. Anytime you can set this attribute to None for any array as it is not a global setting. But you are not able to change dtype of custom attributes. In other words you cannot provide attribute’s dtype as- intand set there any- floator string or whatever.
 - API Methods- read_meta: reads the array’s metadata from storage
- update_custom_attributes: updates- Array'scustom attributes values
- delete: deletes- Arrayfrom the storage with all its data and metadata
- __getitem__: returns a- Subsetinstance bound to the- Array
- __repr__: ordinary behaviour
- __str__: ordinary behaviour
 - param collection
- instance of the - Collection, to which the- Arrayis bound
- param adapter
- Arrayadapter instance
- param id_
- array unique uuid string 
- param primary_attributes
- any primary attributes keyword mapping 
- param custom_attributes
- any custom attributes keyword mapping 
 - custom_attributes
 - primary_attributes
 - property schema: ArraySchema
- Return - ArraySchemaof the Array’s Collection.
 - Parameters
- collection (Collection) – 
- adapter (BaseArrayAdapter) – 
- id_ (Optional[str]) – 
- primary_attributes (Optional[dict]) – 
- custom_attributes (Optional[dict]) – 
 
 
- class deker.arrays.VArray(collection, adapter, array_adapter, id_=None, primary_attributes=None, custom_attributes=None)
- Bases: - BaseArray- Virtual array or - VArrayis an abstract virtual array that consists of ordinary- Arrays.- VArrayis an “array of arrays” or an “image of pixels”. If we consider- VArrayas an image - it is split by virtual grid into tiles. In this case, each tile is an ordinary- Array. Meanwhile, for user- VArrayacts as an ordinary- Array.- VArrayis created by- Collection. It is a- lazyobject that does not interact with its data itself, but it possesses all information about the virtual array (and even a bit more). Interaction with data is performed by a VSubset object, which is produced by- VArray.__getitem__()method.- Properties- as_dict: serializes main information about- VArrayinto dictionary, prepared for JSON
- arrays_shape: returns common shape of all the- Arraysbound to the- VArray
- collection: returns the name of collection to which the- VArrayis bound
- dimensions: returns a tuple of- VArray'sdimensions as objects
- dtype: returns type of the- VArraydata
- id: returns virtual- VArray'sid
- schema: returns- VArray'slow-level schema
- shape: returns- VArray'sshape as a tuple of dimension sizes
- named_shape: returns- VArray'sshape as a tuple of dimension names bound to their sizes
- vgrid: returns virtual grid (a tuple of integers) by which- VArrayis split into- Arrays
 - Attributes- According to the schema, - VArraysmay have or may not have primary attributes and/or custom attributes. Attributes are stored in- VArray'smetadata. Primary attributes are immutable and ordered, custom attributes are mutable and unordered.- primary_attributes: Primary attributes are used for- VArraysfiltering. It is an OrderedDict. If collection schema contains attributes schema with some of them as primary, you obtain a possibility to quickly find all VArrays which can have a certain attribute or meet the same conditions based on primary attributes values.- E.g., if we refer to the example above and store the information about arrays’ data heights into primary attribute, we can create a filter - {"height": 10}and find the- VArray, which data was calculated at heights equal to 10 meters.
- custom_attributes: Custom attributes are used to keep some unique information about the array or about its data. E.g., you store some weather data, which is calculated at different heights. If it is not important for filtering, you can keep the information about certain heights in arrays’ custom attribute, named “height”. In this case, you won’t be able to search by this attribute, but still you’ll be able to use this information in your calculations, checking it array by array. Anytime you can set this attribute to None for any array as it is not a global setting. But you are not able to change dtype of custom attributes. In other words, you cannot provide attribute’s dtype as int and set there any float or string or whatever.
 - API Methods- read_meta: reads the array’s metadata from storage
- update_custom_attributes: updates- VArray'scustom attributes values
- delete: deletes- VArrayfrom the storage with all its data and metadata
- __getitem__: returns a- Subsetinstance bound to the- VArray
- __repr__: ordinary behaviour
- __str__: ordinary behaviour
 - param collection
- instance of the - Collection, to which the- VArrayis bound
- param adapter
- VArrayadapter instance
- param array_adapter
- Arrayadapter instance
- param id_
- VArrayunique uuid string
- param primary_attributes
- any primary attribute keyword mapping 
- param custom_attributes
- any custom attributes keyword mapping 
 - delete()
- Delete - VArrayfrom storage.- Return type
- None 
 
 - property arrays_shape: Tuple[int, ...]
- Get the shape of inner - Arrays.
 - property as_dict: dict
- Serialize self into dict. 
 - custom_attributes
 - primary_attributes
 - property schema: Optional[VArraySchema]
- Return - VArraySchemaof the VArray’s Collection.
 - property vgrid: Tuple[int, ...]
- Get - VArrayvirtual grid.
 - Parameters
- collection (Collection) – 
- adapter (BaseVArrayAdapter) – 
- array_adapter (BaseArrayAdapter) – 
- id_ (Optional[str]) – 
- primary_attributes (Optional[dict]) – 
- custom_attributes (Optional[dict]) –