viscid.readers.vfile module¶
-
class
viscid.readers.vfile.
VFile
(fname, parent_bucket=None, grid_type=None, grid_opts=None, **kwargs)[source]¶ Bases:
viscid.dataset.Dataset
Generic File
Note
If you want a file that can load other files (like how XDMF files need to be able to load HDF5 files) then subclass off of
viscid.readers.vfile_bucket.ContainerFile
instead.Note
Important when subclassing: Do not call the constructors for a dataset / grid yourself, dispatch through _make_dataset and _make_grid.
-
SAVE_ONLY
= False¶
-
classmethod
collective_name
(group)[source]¶ Parameters: group – single file name or list of file names that would be grouped by group_fnames Returns: a single name Return type: str
-
classmethod
detect_type
(fname, mode='r', prefer=None)[source]¶ recursively detect a filetype using _detector regex string.
This is called recursively for all subclasses and results further down the tree are given precedence.
- TODO: move this functionality into a more robust/extendable factory
- class… that can also take care of the bucket / circular reference problem maybe
Parameters: - fname (str) – Filename
- mode (str) – ‘r’ or ‘w’
- prefer (str) – If multiple file types match, give some part of the class name for the reader that you prefer
- Note: THIS WILL ONLY WORK FOR CLASSES THAT HAVE ALREADY BEEN
- IMPORTED. THIS IS A FRAGILE MECHANISM IN THAT SENSE.
Returns: Some reader that matches fname Return type: VFile subclass
-
dirname
= None¶
-
file
= None¶
-
fname
= None¶
-
classmethod
group_fnames
(fnames)[source]¶ Group File names
The default implementation just returns fnames, but some file types might do something fancy here
Parameters: fnames (list) – names that can be logically grouped, as in a bunch of file names that are different time steps of a given run Returns: A list of things that can be given to the constructor of this class
-
handle_name
= None¶
-
load_time
= None¶
-
parent_bucket
= None¶
-
save
(fname=None, **kwargs)[source]¶ save an instance of VFile, fname defaults to the name of the file object as read
-