Skip to content

Commit

Permalink
Avoid creating 't' dimension in output file from closed_wall_R/Z
Browse files Browse the repository at this point in the history
Having a 't' dimension would confuse loading of the grid file into
xbout.
  • Loading branch information
johnomotani committed Nov 13, 2024
1 parent 769b97b commit 6319293
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions hypnotoad/core/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3763,10 +3763,6 @@ def writeGridfile(self, filename):
if hasattr(self.equilibrium, "psi_bdry_gfile"):
f.write("psi_bdry_gfile", self.equilibrium.psi_bdry_gfile)

if hasattr(self.equilibrium, "closed_wallarray"):
f.write("closed_wall_R", self.equilibrium.closed_wallarray[:, 0])
f.write("closed_wall_Z", self.equilibrium.closed_wallarray[:, 1])

# write the 2d fields
for name in self.fields_to_output:
self.writeArray(name, self.__dict__[name], f)
Expand Down Expand Up @@ -3930,6 +3926,24 @@ def writeGridfile(self, filename):
# Field-aligned coordinates
f.write_file_attribute("parallel_transform", "identity")

if hasattr(self.equilibrium, "closed_wallarray"):
# Hack the "bout_type" for these variables to avoid creating a 't'
# dimension in the grid file.
f.write(
"closed_wall_R",
BoutArray(
self.equilibrium.closed_wallarray[:, 0],
attributes={"bout_type": "ArrayX"},
),
)
f.write(
"closed_wall_Z",
BoutArray(
self.equilibrium.closed_wallarray[:, 1],
attributes={"bout_type": "ArrayX"},
),
)

# Save hypnotoad_inputs as a variable rather than an attribute because they
# are long and attributes are printed by 'ncdump -h' or by ncdump when
# looking at a different variable, which would be inconvenient. It is not
Expand Down

0 comments on commit 6319293

Please sign in to comment.