mpas_tools.viz.mpas_to_xdmf.mpas_to_xdmf.MpasToXdmf

class mpas_tools.viz.mpas_to_xdmf.mpas_to_xdmf.MpasToXdmf(ds=None, ds_mesh=None, xtime_var=None)[source]

A class for converting MPAS NetCDF files to XDMF + HDF5 format for visualization in ParaView.

Variables:
  • ds (xarray.Dataset) – The dataset containing variables to convert.

  • ds_mesh (xarray.Dataset) – The mesh dataset (may be the same as ds if no time series is provided).

Notes

  • Use the load() method to read mesh and time series files.

  • Use convert_to_xdmf() to write XDMF and HDF5 files.

  • Special variable keys: ‘allOnCells’, ‘allOnEdges’, ‘allOnVertices’.

  • Extra dimensions can be sliced using the extra_dims argument.

__init__(ds=None, ds_mesh=None, xtime_var=None)[source]

Initialize the converter with a mesh file and optional time series files.

Parameters:
  • ds (xarray.Dataset, optional) – An xarray Dataset containing variables to convert. If ds_mesh is not provided, ds must also contain mesh variables.

  • ds_mesh (xarray.Dataset, optional) – An xarray Dataset representing the mesh. If not provided, ds is used as the mesh.

  • xtime_var (str, optional) – Name of the variable containing time information (e.g., ‘xtime’).

Methods

__init__([ds, ds_mesh, xtime_var])

Initialize the converter with a mesh file and optional time series files.

convert_to_xdmf(out_dir[, extra_dims, quiet])

Convert the loaded xarray Dataset to XDMF + HDF5 format.

load(mesh_filename[, time_series_filenames, ...])

Load the MPAS mesh file and optionally combine it with time series files into a single xarray Dataset.