speasy.core.codecs.bundled_codecs.istp_cdf module
- class speasy.core.codecs.bundled_codecs.istp_cdf.IstpCdf[source]
Bases:
CodecInterface
Codec for ISTP CDF files. This codec is a wrapper around PyISTP library. It supports some variations around the ISTP standard.
- load_variable(variable: AnyStr, file: memoryview | bytearray | bytes | str | IOBase, cache_remote_files=True, master_cdf_url: memoryview | bytearray | bytes | str | IOBase | None = None, **kwargs) SpeasyVariable | None [source]
Load a variable from a file. The file can be a local file, a remote file or a file-like object.
- Parameters:
- variablestr
Variable name to load
- fileBuffer or str or io.IOBase
File to load variable from
- cache_remote_filesbool
Whether to cache remote files
- kwargs
Additional keyword arguments, codec specific arguments
- Returns:
- Optional[SpeasyVariable]
The variable loaded
- Raises:
- NotImplementedError
If the method is not implemented
See also
- load_variables(variables: List, file: memoryview | bytearray | bytes | str | IOBase, cache_remote_files=True, master_cdf_url: memoryview | bytearray | bytes | str | IOBase | None = None, **kwargs) Mapping[AnyStr, SpeasyVariable] | None [source]
Load variables from a file. The file can be a local file, a remote file or a file-like object.
- Parameters:
- variablesList[str]
List of variable names to load
- fileBuffer or str or io.IOBase
File to load variables from
- cache_remote_filesbool
Whether to cache remote files
- kwargs
Additional keyword arguments, codec specific arguments
- Returns:
- Optional[Mapping[str, SpeasyVariable]]
A dictionary with the variables loaded
- Raises:
- NotImplementedError
If the method is not implemented
See also
- save_variables(variables: List[SpeasyVariable], file: str | IOBase | None = None, compress_variables=False, **kwargs) bool | memoryview | bytearray | bytes [source]
Save variables to a file. The file can be a local file, a remote file or a file-like object.
- Parameters:
- variablesList[SpeasyVariable]
List of variables to save
- filestr or io.IOBase
File to save variables to, if None, return the data as bytes
- kwargs
Additional keyword arguments, codec specific arguments
- Returns:
- Union[bool, Buffer]
True if the variables were saved successfully, the data as buffer compatible object if file is None
- Raises:
- NotImplementedError
If the method is not implemented which is an acceptable behavior for read-only codecs
See also