gvec.vtk#
- gvec.vtk.ev2vtk(filename: Path | str, xrds: Dataset, quiet: bool = True)#
Write a GVEC evaluation dataset to a VTS file.
- Parameters:
filename (str) – The name of the output file without the ‘.vts’ extension.
xrds (xr.Dataset) – The dataset containing the evaluation data.
quiet (bool, optional) – If False, return the path to the output file, by default True.
- Returns:
The path to the output file.
- Return type:
Path
Notes
The following dimension are expected to be in the dataset: - ‘pos’ : the cartesian components of grid points - ‘xyz’ : the dimension name for the cartesian components of grid points - ‘rad’ : the radial dimension name - ‘pol’ : the poloidal dimension name - ‘tor’ : the toroidal dimension name
Scalar variables without the ‘xyz’ dimension are broadcasted to the ‘rad’, ‘pol’, ‘tor’ dimensions.
If a variable does not have the expected dimensions, it is ignored.
Examples
>>> from gvec.vtk import ev2vtk >>> import xarray as xr >>> filename = "my_evaluation" >>> xrds = xr.Dataset({"pos": (["xyz", "rad", "pol", "tor"], np.random.rand(3, 10, 10, 10))}) >>> ev2vtk(filename, xrds)