CEOS Panta Rhei (PRZ)#
RosettaSciIO can read and write .prz files used by the CEOS Panta Rhei software.
The .prz files are based on open formats (numpy arrays and python dictionaries)
so a complete support is in principle possible.
However, as new features are continuously being added to Panta Rhei, it is also
possible to occasionally encounter some which are not yet supported by RosettaSciIO.
Please report any problematic file on the issues tracker to make us aware of it.
API functions#
- rsciio.pantarhei.file_reader(filename: str | Path, lazy: bool = False, chunks: str | tuple[int, str] = 'auto', allow_restricted_pickle: bool = False, **kwargs) list[dict]#
Read a PantaRhei
.przfile. For Panta Rhei <24.03 a restricted unpickler can be used to load the meta data withallow_restricted_pickle=True, which raisesInvalidPickleErrorif restricted modules are detected.- Parameters:
- filename
str,pathlib.Path Filename of the file to read or corresponding pathlib.Path.
- lazybool, default=False
Whether to open the file lazily or not. The file will stay open until closed in
compute()or closed manually.get_file_handle()can be used to access the file handler and close it manually.- chunks
tupleofintorNone, default=None Define the chunking used for saving the dataset. If
None, calculates chunks for the signal, with preferably at least one chunk per signal space.- allow_restricted_picklebool, default=False
Allows unpickling of prz meta data for data saved with Panta Rhei <24.03. This poses a security risk, use only for completely trusted prz files.
- **kwargs
dict, optional Additional keyword arguments passed to
rsciio.utils.file.memmap_distributed()whenlazy=True.
- filename
- Returns:
listofdictList of dictionaries containing the following fields:
‘data’ – multidimensional
numpy.ndarrayordask.array.Array‘axes’ – list of dictionaries describing the axes containing the fields ‘name’, ‘units’, ‘index_in_array’, and either ‘size’, ‘offset’, and ‘scale’ or a numpy array ‘axis’ containing the full axes vector
‘metadata’ – dictionary containing the parsed metadata
‘original_metadata’ – dictionary containing the full metadata tree from the input file
When the file contains several datasets, each dataset will be loaded as separate dictionary.
- rsciio.pantarhei.file_writer(filename: str | Path, signal: dict) None#
Write signal to PantaRhei
.przformat.- Parameters:
- filename
str,pathlib.Path Filename of the file to write to or corresponding pathlib.Path.
- signal
dict Dictionary containing the signal object. Should contain the following fields:
‘data’ – multidimensional numpy array
‘axes’ – list of dictionaries describing the axes containing the fields ‘name’, ‘units’, ‘index_in_array’, and either ‘size’, ‘offset’, and ‘scale’ or a numpy array ‘axis’ containing the full axes vector
‘metadata’ – dictionary containing the metadata tree
- filename