You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a suggested example for plotting the fields of a grid.nc file https://github.com/boutproject/xBOUT/blob/master/examples/plot_grid.py. I have tried to use this code to plot the output from a simple Hyponotoad-generated grid. The result is that I received error messages which suggest that the advertised functionality is broken.
$ python3 plot_test.py
NXPE not found, setting to 1
NYPE not found, setting to 1
MXG not found, setting to 2
MYG not found, setting to 0
MXSUB not found, setting to 2
MYSUB not found, setting to 8
Traceback (most recent call last):
File "*/lib/python3.13/site-packages/xarray/core/dataset.py", line 1317, in _construct_dataarray
variable = self._variables[name]
~~~~~~~~~~~~~~~^^^^^^
KeyError: 't_array'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "*/plot_test.py", line 11, in <module>
grid = open_boutdataset(gridfilepath, geometry="toroidal")
File "*/lib/python3.13/site-packages/xbout/load.py", line 279, in open_boutdataset
ds, remove_yboundaries = _auto_open_mfboutdataset(
~~~~~~~~~~~~~~~~~~~~~~~~^
datapath=datapath,
^^^^^^^^^^^^^^^^^^
...<4 lines>...
**kwargs,
^^^^^^^^^
)
^
File "*/lib/python3.13/site-packages/xbout/load.py", line 736, in _auto_open_mfboutdataset
_, unique_indices = unique(ds["t_array"], return_index=True)
~~^^^^^^^^^^^
File "*/lib/python3.13/site-packages/xarray/core/dataset.py", line 1410, in __getitem__
return self._construct_dataarray(key)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "*/lib/python3.13/site-packages/xarray/core/dataset.py", line 1319, in _construct_dataarray
_, name, variable = _get_virtual_variable(self._variables, name, self.dims)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "*/lib/python3.13/site-packages/xarray/core/dataset.py", line 175, in _get_virtual_variable
raise KeyError(key)
KeyError: 't_array'
Trying to use _open_grid directly also failed. Fixing this would be very helpful for plotting Hypnotoad output.
The text was updated successfully, but these errors were encountered:
This problem was mostly caused by a change to hypnotoad which had resulted in a 't' dimension being created in grid files, which confused the function that detects whether the file being opened is 'dump', 'restart' or 'grid'. Also a name-conflict error.
There is a suggested example for plotting the fields of a
grid.nc
file https://github.com/boutproject/xBOUT/blob/master/examples/plot_grid.py. I have tried to use this code to plot the output from a simple Hyponotoad-generated grid. The result is that I received error messages which suggest that the advertised functionality is broken.To generate the grid I use (thanks to J. Omotani)
I then run the following script to try to plot
With this script, I get the following error
Trying to use
_open_grid
directly also failed. Fixing this would be very helpful for plotting Hypnotoad output.The text was updated successfully, but these errors were encountered: