Skip to content

Fix for closed_wall_R/Z warning on load#350

Open
mikekryjak wants to merge 3 commits into
masterfrom
closed_wall_fix
Open

Fix for closed_wall_R/Z warning on load#350
mikekryjak wants to merge 3 commits into
masterfrom
closed_wall_fix

Conversation

@mikekryjak

Copy link
Copy Markdown
Collaborator

closed_wall_R and closed_wall_Z used to be defined over a t dimension, which caused a warning on unrecognised variable on grid load. This was resolved in Hypnotoad by changing the coordinate to closed_wall: boutproject/hypnotoad#191

This PR reproduces this fix on the xBOUT side for legacy grids which still have the t coordinate, and adds closed_wall to the list of acceptable dimensions.

This PR supersedes #338.

Patch for older Hypnotoad grids
Hypnotoad was writing closed_wall_R/Z with a "t" dim before, which would cause an xBOUT warning. This was resolved boutproject/hypnotoad#191. This PR does the same fix xBOUT side for older grids.
@mikekryjak mikekryjak added the bugfix Fix for a bug label Jun 15, 2026
@mikekryjak mikekryjak requested a review from dschwoerer June 15, 2026 13:46
@mikekryjak mikekryjak force-pushed the closed_wall_fix branch 2 times, most recently from 27561b0 to 90a83c3 Compare June 15, 2026 13:56
mikekryjak and others added 2 commits June 15, 2026 14:57
For closed_wall_RZ
The variables closed_wall_R/Z have a dimension closed_wall, which would be detected as a scalar here since it's not in the hardcoded dims.
Comment thread xbout/load.py Outdated
return grid

if grid["closed_wall_Z"].dims != ("t",):
return grid

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? Should we not just check if they are a 1D arrays, and if so, fix it up?

Comment thread xbout/load.py
return "reload"
elif "t" in ds.dims:

_update_legacy_closed_wall_dimension(ds)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_update_legacy_closed_wall_dimension(ds)
ds = _update_legacy_closed_wall_dimension(ds)

Comment thread xbout/load.py
return grid

for name in ("closed_wall_R", "closed_wall_Z"):
attrs = grid[name].attrs.copy()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the copy? What happens if we just take the attrs? They do not seem to be modified later, as far as I can tell.

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

Labels

bugfix Fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants