viscid.readers.vfile_bucket module

class viscid.readers.vfile_bucket.ContainerFile(fname, parent_bucket=None, **kwargs)[source]

Bases: viscid.readers.vfile.VFile

A container file is a VFile that can load other files

The use case is always something like the relationship between XDMF files and HDF5 files. It’s nice for an XDMF file to keep track of all the HDF5 Files that it refers to.

child_bucket = None
clear_cache()[source]

Clear all childrens’ caches

reload()[source]
unload(**kwargs)[source]

Really unload a file, don’t just clear the cache

class viscid.readers.vfile_bucket.VFileBucket(**kwargs)[source]

Bases: viscid.bucket.Bucket

manages open files, create / get with get_file_bucket() as you generally only need one instance, but you can construct directly if you need more than one manager

load_file(fname, index_handle=True, **kwargs)[source]

load a single file and return a vFile instance, not a list of vFiles like load does

load_files(fnames, index_handle=True, file_type=None, prefer=None, force_reload=False, _add_ref=False, **kwargs)[source]

Load files, and add them to the bucket

Initialize obj before it’s put into the list, whatever is returned is what gets stored, returning None means object init failed, do not add to the _objs list

Parameters:
  • fnames – a list of file names (can cantain glob patterns)
  • index_handle

    ??

  • file_type – a class that is a subclass of VFile, if given, use this file type, don’t use the autodetect mechanism
  • kwargs – passed to file constructor
Returns:

A list of VFile instances. The length may not be the same as the length of fnames, and the order may not be the same in order to accomidate globs and file grouping.

remove_all_items(do_unload=True)[source]

unload all items

remove_item(item, do_unload=True)[source]
remove_item_by_handle(handle, do_unload=True)[source]

remove item by handle, raises KeyError if handle is not found