1616Example Usage
1717-------------
1818Python:
19+
1920 >>> from mpas_tools.viz.mpas_to_xdmf.mpas_to_xdmf import MpasToXdmf
2021 >>> converter = MpasToXdmf()
2122 >>> converter.load(mesh_filename="mesh.nc", time_series_filenames="output.*.nc",
2223 ... variables=["temperature", "salinity"], xtime_var="xtime")
2324 >>> converter.convert_to_xdmf(out_dir="output_dir", extra_dims={"nVertLevels": [0, 1, 2]})
2425
2526Command line:
27+
2628 $ mpas_to_xdmf -m mesh.nc -t output.*.nc -v temperature salinity -o output_dir -d nVertLevels=0:3
2729
2830See Also
@@ -92,8 +94,14 @@ def load(
9294 xtime_var = None ,
9395 ):
9496 """
95- Load the MPAS mesh file and optionally combine it with time series
96- files into a single xarray Dataset.
97+ Load the MPAS mesh file and optional time series.
98+
99+ Special keys for ``variables``:
100+
101+ - ``"allOnCells"`` - all variables with dimension ``"nCells"``
102+ - ``"allOnEdges"`` - all variables with dimension ``"nEdges"``
103+ - ``"allOnVertices"`` - all variables with dimension
104+ ``"nVertices"``
97105
98106 Parameters
99107 ----------
@@ -103,13 +111,10 @@ def load(
103111 List of NetCDF filenames or a wildcard string for time series
104112 files. If None, only the mesh file is used.
105113 variables : list of str, optional
106- List of variables to convert. Special keys:
107- - 'allOnCells': all variables with dimension 'nCells'
108- - 'allOnEdges': all variables with dimension 'nEdges'
109- - 'allOnVertices': all variables with dimension 'nVertices'
110- If None, all variables are included.
114+ List of variables to convert. If None, all variables are included.
111115 xtime_var : str, optional
112- Name of the variable containing time information (e.g., 'xtime').
116+ Name of the variable containing time information (e.g.,
117+ ``"xtime"``).
113118 """
114119 self .ds_mesh , self .ds = _load_dataset (
115120 mesh_filename = mesh_filename ,
@@ -128,8 +133,8 @@ def convert_to_xdmf(self, out_dir, extra_dims=None, quiet=False):
128133 Directory where XDMF and HDF5 files will be saved.
129134 extra_dims : dict, optional
130135 Dictionary mapping extra dimensions to their selected indices.
131- Example: {'nVertLevels': [0, 1, 2]}
132- If None, all indices are included.
136+ Example - `` {'nVertLevels': [0, 1, 2]}``. If None, all indices are
137+ included.
133138 quiet : bool, optional
134139 If True, suppress progress output.
135140
0 commit comments