load_data#
- LibUserd.load_data(data_file: str, result_file: str = '', file_format: str | None = None, reader_options: Dict[str, Any] = {}) Reader #
Use the reader to load a dataset and return an instance to the resulting
Reader
interface.- Parameters:
- data_file
str
Name of the data file to load.
- result_file
str
,optional
Name of the second data file for dual-file datasets.
- file_format
str
,optional
Name of the USERD reader to use. The default is
None
, in which case libuserd selects a reader.- reader_options
dict
,optional
Dictionary of reader-specific option-value pairs that can be used to customize the reader behavior. The default is
None
.
- data_file
- Returns:
Reader
Resulting Reader object instance.
- Raises:
RuntimeError
If libused cannot guess the file format or an error occurs while the data is being read.
Examples
>>> from ansys.pyensight.core import libuserd >>> userd = libuserd.LibUserd() >>> userd.initialize() >>> opt = {'Long names': False, 'Number of timesteps': '10', 'Number of scalars': '3'} >>> data = userd.load_data("foo", file_format="Synthetic", reader_options=opt >>> print(data.parts()) >>> print(data.variables()) >>> userd.shutdown()