Skip to content

Commit

Permalink
Merge pull request #309 from boutproject/fix-gridless-loading
Browse files Browse the repository at this point in the history
Changes required to load output from a grid-free BOUT.0.nc file, nece…
  • Loading branch information
johnomotani authored Jan 15, 2025
2 parents 0761754 + 4cc9c53 commit 7b4d5d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion xbout/geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def apply_geometry(ds, geometry_name, *, coordinates=None, grid=None):
dz = updated_ds["dz"]

z0 = 2 * np.pi * updated_ds.metadata["ZMIN"]
z1 = z0 + nz * dz.data[()]
z1 = z0 + nz * dz.data[0, 0]
if not np.all(
np.isclose(
z1,
Expand Down
6 changes: 3 additions & 3 deletions xbout/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ def attrs_remove_section(obj, section):
# by xBOUT, not by BOUT++
ds.bout.fine_interpolation_factor = 8

if ("dump" in input_type or "restart" in input_type) and ds.metadata[
"BOUT_VERSION"
] < 4.0:
if ("dump" in input_type or "restart" in input_type) and (
"BOUT_VERSION" in ds.metadata and ds.metadata["BOUT_VERSION"] < 4.0
):
# Add workarounds for missing information or different
# conventions in data saved by BOUT++ v3.x.
for v in ds:
Expand Down

0 comments on commit 7b4d5d3

Please sign in to comment.