Skip to content

to_restart: fix _FillValue incompatibility#349

Merged
mikekryjak merged 1 commit into
masterfrom
fix-restart-fillvalue
Jun 15, 2026
Merged

to_restart: fix _FillValue incompatibility#349
mikekryjak merged 1 commit into
masterfrom
fix-restart-fillvalue

Conversation

@mikekryjak

Copy link
Copy Markdown
Collaborator

This fixes BOUT++ crashing when running with restart files produced by to_restart().
Unlike the boutdata tool, the xBOUT restart tool let Xarray set the _FillValue attribute on all variables to NaN, which is default behaviour. When BOUT++ reads restart files, it rewrites all the attributes, which includes _FillValue. However, this is a special attribute and NetCDF doesn't allow it to be redefined, leading to a crash at launch.

This fixes BOUT++ crashing on running restarts.
Unlike the boutdata tool, the xBOUT restart tool let Xarray set the _FillValue attribute to NaN by default. When BOUT++ reads restart files, it rewrites all the attributes including this one, but Xarray doesn't allow _FillValue to be redefined, leading to a crash at launch.
@mikekryjak mikekryjak added the bugfix Fix for a bug label Jun 15, 2026

@dschwoerer dschwoerer left a comment

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.

LGTM

@mikekryjak mikekryjak merged commit 72d82b1 into master Jun 15, 2026
11 checks passed
@mikekryjak mikekryjak deleted the fix-restart-fillvalue branch June 15, 2026 12:07
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