Skip to content

Conversation

@pnorbert
Copy link

@pnorbert pnorbert commented Aug 8, 2024

Notes:

  • Read-only. It does not support write to BP files.

Tested with the elm-pb example, running the example with the cbm18_dens8.grid_nx68ny64 mesh.

from boutdata import collect
from boutdata import griddata
from boututils.datafile import DataFile

# Read pressure “P” as a 4D [t,x,y,z] Numpy array:
p = collect("P", path="cbm18")

p.shape # -> (6, 68, 64, 16)

# Read the grid file
g = DataFile("cbm18_dens8.grid_nx68ny64.bp")

# g[“Rxy”] and g{“Zxy”] are 2D arrays [x, y] that specify the major radius (R) and height (Z)
# coordinates of the center of each cell, in meters

griddata.gridcontourf(g, p[-1,:,:,0])

Notes

  • The data directory cbm18 contains BOUT.dmp.bp in this case.
  • The same example works with using the NetCDF mesh instead of a (converted) ADIOS2 mesh file.

@ZedThree
Copy link
Member

Thanks @pnorbert! Sorry it's taken awhile to look at this. Please could you add a short test? I think we'll probably need to include a binary file if the interface is read-only

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