Skip to content

Commit 6319293

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 769b97b commit 6319293

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

hypnotoad/core/mesh.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -3763,10 +3763,6 @@ def writeGridfile(self, filename):
37633763
if hasattr(self.equilibrium, "psi_bdry_gfile"):
37643764
f.write("psi_bdry_gfile", self.equilibrium.psi_bdry_gfile)
37653765

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

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

0 commit comments

Comments
 (0)