Skip to content

Commit 080b16c

Browse files
committed
Avoid creating 't' dimension in output file from closed_wall_R/Z
Having a 't' dimension would confuse loading of the grid file into xbout.
1 parent 771735e commit 080b16c

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

hypnotoad/core/mesh.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,10 +3764,6 @@ def writeGridfile(self, filename):
37643764
if hasattr(self.equilibrium, "psi_bdry_gfile"):
37653765
f.write("psi_bdry_gfile", self.equilibrium.psi_bdry_gfile)
37663766

3767-
if hasattr(self.equilibrium, "closed_wallarray"):
3768-
f.write("closed_wall_R", self.equilibrium.closed_wallarray[:, 0])
3769-
f.write("closed_wall_Z", self.equilibrium.closed_wallarray[:, 1])
3770-
37713767
# write the 2d fields
37723768
for name in self.fields_to_output:
37733769
self.writeArray(name, self.__dict__[name], f)
@@ -3931,6 +3927,24 @@ def writeGridfile(self, filename):
39313927
# Field-aligned coordinates
39323928
f.write_file_attribute("parallel_transform", "identity")
39333929

3930+
if hasattr(self.equilibrium, "closed_wallarray"):
3931+
# Hack the "bout_type" for these variables to avoid creating a 't'
3932+
# dimension in the grid file.
3933+
f.write(
3934+
"closed_wall_R",
3935+
BoutArray(
3936+
self.equilibrium.closed_wallarray[:, 0],
3937+
attributes={"bout_type": "ArrayX"},
3938+
),
3939+
)
3940+
f.write(
3941+
"closed_wall_Z",
3942+
BoutArray(
3943+
self.equilibrium.closed_wallarray[:, 1],
3944+
attributes={"bout_type": "ArrayX"},
3945+
),
3946+
)
3947+
39343948
# Save hypnotoad_inputs as a variable rather than an attribute because they
39353949
# are long and attributes are printed by 'ncdump -h' or by ncdump when
39363950
# looking at a different variable, which would be inconvenient. It is not

0 commit comments

Comments
 (0)