boutproject / boutdata

GNU Lesser General Public License v3.0
0 stars 2 forks source link

Added support for reading ADIOS2 BP files. #109

Open pnorbert opened 3 months ago

pnorbert commented 3 months ago

Notes:

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

ZedThree commented 3 months ago

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