Subsets
- class deker.subset.Subset(slice_expression, shape, array, adapter)
Bases:
BaseSubset
Array
subset.A subset of the
Array
data with setbounds
,shape
,dtype
andfill_value
.It is final
lazy
object that canread
,update
andclear
the data within theArray
. Once created, it does not contain any data and does not access the storage until user manually invokes one of the subset API methods. If you need to get and manage all the data from the array you should create a subset withArray[:]
orArray[...]
.Properties
shape
: returns shape of the subsetbounds
: returns the bounds that were applied to theArray
dtype
: returns type of the queried datafill_value
: returns the value that fills empty cells instead of None
API methods
describe
: returns an OrderedDict with description of all the subset’s dimensionsread
: returns a numpy ndarray with all the data from the Subset boundsNote
If the Subset or Array is empty, a numpy ndarray of
fill_values
will be returnedWarning
Mind your RAM!
read_xarray
: returns anxarray.DataArray
with data returned by read method and its description.Attention
Scalar data cannot be converted to
xarray.DataArray
update
: writes new data to the storage;Note
Data cannot be
None
Data
shape
should be equal to theSubset.shape
Data
dtype
should be equal to theArray.dtype
clear
: removes or resets with fill_value all data from the storage within the subset bounds;
- clear()
Clear data in
Array
by slice.- Return type
None
- read()
Read data from
Array
slice.- Return type
Union[int, float, complex, int8, int16, int32, int64, longlong, uint64, uint8, uint16, uint32, ulonglong, float16, complex128, float32, clongdouble, float64, longdouble, complex64, ndarray]
- update(data)
Update data in
Array
by slice.Data cannot be
None
Data
shape
should be equal to theSubset.shape
Data
dtype
should be equal to theArray.dtype
- Parameters
data (Union[list, tuple, ndarray, int, float, complex, int8, int16, int32, int64, longlong, uint64, uint8, uint16, uint32, ulonglong, float16, complex128, float32, clongdouble, float64, longdouble, complex64]) – new data which shall match subset slicing
- Return type
None
- Parameters
slice_expression (Tuple[Union[slice, int], ...]) –
shape (Tuple[int, ...]) –
array (Array) –
adapter (BaseArrayAdapter) –
- class deker.subset.VSubset(slice_expression, shape, array, array_adapter, varray_adapter, collection)
Bases:
BaseSubset
VArray
subset.A subset of
VArray
data with setbounds
,shape
,dtype
andfill_value
.It is final
lazy
object that canread
,update
andclear
the data within theVArray
. Once created, it does not contain any data and does not access the storage until user manually invokes one of the virtual subset API methods. If you need to get and manage all the data from array you shall create a virtual subset withVArray[:]
orVArray[...]
.Properties
shape
: returns shape of the virtual subsetbounds
: returns bounds that were applied toVArray
dtype
: returns type of queried datafill_value
: returns value that fills empty cells instead of None
API methods
describe
: returns an OrderedDict with description of all VSubset’s dimensionsread
: returns a numpy ndarray with all the data from the VSubset boundsNote
If the VSubset or VArray is empty, a numpy ndarray of
fill_values
will be returnedWarning
Mind your RAM!
read_xarray
: returns anxarray.DataArray
with data returned by read method and its description.Attention
Scalar data cannot be converted to
xarray.DataArray
update
: writes new data to the storage;Note
Data cannot be
None
Data
shape
shall be equal to theVSubset.shape
Data
dtype
shall be equal to theVArray.dtype
clear
: removes or resets with fill_value all data from the storage within the virtual subset bounds;
- param slice_expression
a slice, tuple of slices or numpy IndexExpression, created by VArray.__getitem__()
- param shape
subset shape, calculated by VArray.__getitem__()
- param array
an instance of VArray to which the virtual subset is bound
- param array_adapter
ArrayAdapter instance
- param collection
Collection instance, to which the virtual array is bound
- clear()
Clear data in
VArray
by slice.- Return type
None
- read()
Read data from
VArray
slice.- Return type
Union[int, float, complex, int8, int16, int32, int64, longlong, uint64, uint8, uint16, uint32, ulonglong, float16, complex128, float32, clongdouble, float64, longdouble, complex64, ndarray]
- update(data)
Update data in
VArray
by slice.Data cannot be
None
Data
shape
should be equal to theVSubset.shape
Data
dtype
should be equal to theVArray.dtype
- Parameters
data (Union[list, tuple, ndarray, int, float, complex, int8, int16, int32, int64, longlong, uint64, uint8, uint16, uint32, ulonglong, float16, complex128, float32, clongdouble, float64, longdouble, complex64]) – new data which shall match subset slicing
- Return type
None
- Parameters
slice_expression (Tuple[Union[slice, int], ...]) –
shape (Tuple[int, ...]) –
array (VArray) –
array_adapter (BaseArrayAdapter) –
varray_adapter (BaseVArrayAdapter) –
collection (Collection) –