dedalus.tools.post ================== .. py:module:: dedalus.tools.post .. autoapi-nested-parse:: Post-processing helpers. Module Contents --------------- .. py:class:: DedalusXarrayBackend Xarray backend targeting Dedalus HDF5 outputs. .. py:method:: open_dataset(filename_or_obj, *, drop_variables=None) .. py:function:: dedalus_h5_to_xarray(dset) Convert Dedalus HDF5 dataset to an Xarray DataArray. .. py:function:: 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 .. py:function:: 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) .. py:function:: 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 .. py:function:: load_tasks_to_xarray(filename, tasks=None, squeeze_constant=True) Load task from Dedalus HDF5 output to an Xarray DataArray. .. py:function:: 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) .. rubric:: Notes This function is parallelized over sets, and so can be effectively parallelized up to the number of distributed sets. .. py:function:: 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 .. py:function:: 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) .. py:function:: 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 .. py:function:: 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) .. rubric:: 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. .. py:function:: 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) .. py:function:: 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`** .. rubric:: Notes This function is parallelized over writes, and so can be effectively parallelized up to the number of writes from all specified sets. .. py:data:: MPI_RANK .. py:data:: MPI_SIZE .. py:data:: logger .. py:data:: merge_virtual