xdas.virtual.VirtualLayout#
- class xdas.virtual.VirtualLayout(shape, dtype, maxshape=None, filename=None)[source]#
A lazy array layout pointing toward multiple netCDF4/HDF5 files.
Instantiate this class with the final shape of the virtual array. Then Fill it up by assigning to slices of it VirtualSource objects.
Once the data assignement is completed, the layout can be virually written into a h5py.File or h5py.Group object using the to_dataset method.
The VirtualLayout can be sliced and the selected data accessed without writting the layout to disk. To that end, use numpy.asarray or the __array__ special method. Note that for now, sliced VirtualLayout cannot be written to disk.
- Parameters:
maxshape (tuple of int or None, optional) – The layout is resizable up to this shape. Use None for axes you want to be unlimited.
filename (str, optional) – The name of the destination file, if known in advance. Mappings from data in the same file will be stored with filename ‘.’, allowing the file to be renamed later.
- to_dataset(file_or_group, name)[source]#
Writes virtually the layout into the specified HDF5 file of group with the given name.
Methods
__init__(shape, dtype[, maxshape, filename])create_variable(file, name[, dims, dtype])Write this virtual array into file and register it as a named variable.
to_dataset(file_or_group, name)Write the layout as an HDF5 virtual dataset in file_or_group.
Attributes