Skip to content

Remove unrecognised variable warning on grid load#338

Closed
mikekryjak wants to merge 3 commits into
masterfrom
remove-grid-warning
Closed

Remove unrecognised variable warning on grid load#338
mikekryjak wants to merge 3 commits into
masterfrom
remove-grid-warning

Conversation

@mikekryjak

Copy link
Copy Markdown
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

ZedThree commented Mar 6, 2026

Copy link
Copy Markdown
Member

See also warnings.filterwarnings to turn this off

Comment thread xbout/load.py Outdated
Co-authored-by: David Bold <dave@ipp.mpg.de>
@mikekryjak

Copy link
Copy Markdown
Collaborator Author

It's better to keep the wall coords instead of silently dropping them. Now implemented in #350.

@mikekryjak mikekryjak closed this Jun 15, 2026
@mikekryjak mikekryjak deleted the remove-grid-warning branch June 15, 2026 14:38
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.

3 participants