Skip to content

Conversation

@pnorbert
Copy link
Contributor

Added xarraybackend.py to xBOUT as it is bout++ specific code not generic adios solution.
Open .bp files with "bout_adios2" engine in xarray.
It requires BOUT-dev #3098

Tested with elm-pb/xpt run and the following script:

import xbout
import matplotlib.pyplot as plt

# Read the data
ds = xbout.open_boutdataset('BOUT.dmp.bp',
        geometry="toroidal",
        gridfilepath="g185472-68x64-curv.nc"
     )

# Interpolate, mapping field-aligned coordinates
ds_highres = ds.bout.interpolate_parallel("P", n = ds.metadata['zperiod'])

# Plot
ds_highres.isel(t=-1, zeta=0)["P"].bout.pcolormesh(shading="gouraud")
plt.show()

@pnorbert
Copy link
Contributor Author

Can someone please explain what I need to fix to pass the tests?

@bendudson
Copy link
Contributor

Hi @pnorbert ! Thank you very much for this! It's great to have this capability.
The linting and black failures should be just a matter of running flake8 and black on the new code.

The other failures are strange: Segfaults shouldn't happen from python code. Python 3.10 is also segfaulting in xBOUT (https://github.com/boutproject/xBOUT/).

@bendudson bendudson merged commit cb87f23 into boutproject:master May 30, 2025
1 check passed
@pnorbert pnorbert deleted the adios2 branch May 30, 2025 23:22
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