Skip to main content
`Ctrl`+`K`

# 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 `.prz` file. For Panta Rhei <24.03 a restricted unpickler can be used to load the meta data with `allow_restricted_pickle=True`, which raises `InvalidPickleError` if restricted modules are detected.

  Parameters:
    filename `python:str`, `pathlib.Path`

      Filename of the file to read or corresponding pathlib.Path.

    lazy bool, 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 `python:tuple` of `python:int` or `python:None`, 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_pickle bool, 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 `python:dict`, optional

      Additional keyword arguments passed to `rsciio.utils.file.memmap_distributed()` when `lazy=True`.

  Returns:
    `python:list` of `python:dict`

      List of dictionaries containing the following fields:

      - ‘data’ – multidimensional `numpy.ndarray` or `dask.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 `.prz` format.

  Parameters:
    filename `python:str`, `pathlib.Path`

      Filename of the file to write to or corresponding pathlib.Path.

    signal `python: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