Skip to content

Remove unrecognised variable warning on grid load#338

Open
mikekryjak wants to merge 2 commits intomasterfrom
remove-grid-warning
Open

Remove unrecognised variable warning on grid load#338
mikekryjak wants to merge 2 commits intomasterfrom
remove-grid-warning

Conversation

@mikekryjak
Copy link
Collaborator

This thing prints a warning every time I load a Hermes-3 dataset:

xBOUT/xbout/load.py

Lines 1155 to 1162 in 9b67b37

if len(unrecognised_dims) > 0:
# Weird string formatting is a workaround to deal with possible bug in
# pytest warnings capture - doesn't match strings containing brackets
warn(
"Will drop all variables containing the dimensions {} because "
"they are not recognised".format(str(unrecognised_dims)[1:-1])
)
grid = grid.drop_dims(unrecognised_dims)

It's picking up closed_wall_R and closed_wall_Z, which are 1D arrays defined over the time dimension (I guess for a lack of a dummy dimension), and so cause an error due to not being over [x,y,z].

This PR removes the warning. If anyone wants these variables, they can look to modify the code further to make sure they are read properly.

This prints an error when reading e.g. closed_wall due to it not being over [x,y,z] but rather a 1D array with [t] (I guess for a lack of a dummy dimension). I always have these variables and always get the warning.
@ZedThree
Copy link
Member

ZedThree commented Mar 6, 2026

See also warnings.filterwarnings to turn this off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants