dedalus.tools.post

Post-processing helpers.

Module Contents

logger
MPI_RANK
MPI_SIZE
visit_writes(set_paths, function, **kw)

Apply function to writes from a list of analysis sets.

Parameters:
  • set_paths (list of str or pathlib.Path) – List of set paths

  • function (function(set_path, start, count, **kw)) – A function on an HDF5 file, start index, and count.

  • Other keyword arguments are passed on to `function`

Notes

This function is parallelized over writes, and so can be effectively parallelized up to the number of writes from all specified sets.

get_assigned_writes(set_paths)

Divide writes from a list of analysis sets between MPI processes.

Parameters:

set_paths (list of str or pathlib.Path) – List of set paths

get_all_writes(set_paths)

Get write numbers from a list of analysis sets.

Parameters:

set_paths (list of str or pathlib.Path) – List of set paths

get_assigned_sets(base_path, distributed=False)

Divide analysis sets from a FileHandler between MPI processes.

Parameters:
  • base_path (str or pathlib.Path) – Base path of FileHandler output

  • distributed (bool, optional) – Divide distributed sets instead of merged sets (default: False)

merge_virtual_analysis(base_path, cleanup=False)

Merge virtual files from a FileHandler into single files.

Parameters:
  • base_path (str or pathlib.Path) – Base path of FileHandler output

  • cleanup (bool, optional) – Delete virtual and distributed files after merging (default: False)

Notes

This function is parallelized over sets, and so can be effectively parallelized up to the number of virtual files.

Merged files are output into a ‘merged_X’ directory, where X is the stem name of the input FileHandler.

merge_virtual_file(virtual_file_path, cleanup=False)

Merge a virtual file from a FileHandler.

Parameters:
  • virtual_file_path (str of pathlib.Path) – Path to a virtual .h5 file

  • cleanup (bool, optional) – Delete distributed files and virtual file after merging (default: False)

merge_analysis(base_path, cleanup=False)

Merge distributed analysis sets from a FileHandler.

Parameters:
  • base_path (str or pathlib.Path) – Base path of FileHandler output

  • cleanup (bool, optional) – Delete distributed files after merging (default: False)

Notes

This function is parallelized over sets, and so can be effectively parallelized up to the number of distributed sets.

merge_distributed_set(set_path, cleanup=False)

Merge a distributed analysis set from a FileHandler.

Parameters:
  • set_path (str of pathlib.Path) – Path to distributed analysis set folder

  • cleanup (bool, optional) – Delete distributed files after merging (default: False)

merge_setup(joint_file, proc_paths, virtual=False)

Merge HDF5 setup from part of a distributed analysis set into a joint file.

Parameters:
  • joint_file (HDF5 file) – Joint file

  • proc_paths (list of [str or pathlib.Path]) – List of files in a distributed analysis set

  • virtual (bool, optional) – If True, merging a virtual file into a single file rather than distributed set

merge_data(joint_file, proc_path)

Merge data from part of a distributed analysis set into a joint file.

Parameters:
  • joint_file (HDF5 file) – Joint file

  • proc_path (str or pathlib.Path) – Path to part of a distributed analysis set

merge_virtual
dedalus_h5_to_xarray(dset)

Convert Dedalus HDF5 dataset to an Xarray DataArray.

load_tasks_to_xarray(filename, tasks=None, squeeze_constant=True)

Load task from Dedalus HDF5 output to an Xarray DataArray.

class DedalusXarrayBackend

Xarray backend targeting Dedalus HDF5 outputs.

open_dataset(filename_or_obj, *, drop_variables=None)