Skip to content

Commit

Permalink
always cast enzo units to float
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishavlin committed Dec 5, 2024
1 parent 9e483ce commit 560e56f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions yt/frontends/enzo/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,15 @@ def _set_code_unit_attributes(self):
mylog.warning("Setting 1.0 in code units to be 1.0 s")
length_unit = mass_unit = time_unit = 1.0

setdefaultattr(self, "length_unit", self.quan(length_unit, "cm"))
setdefaultattr(self, "mass_unit", self.quan(mass_unit, "g"))
setdefaultattr(self, "time_unit", self.quan(time_unit, "s"))
setdefaultattr(
self, "length_unit", self.quan(length_unit, "cm").astype("float64")
)
setdefaultattr(
self, "mass_unit", self.quan(mass_unit, "g").astype("float64")
)
setdefaultattr(
self, "time_unit", self.quan(time_unit, "s").astype("float64")
)
setdefaultattr(self, "velocity_unit", self.length_unit / self.time_unit)

density_unit = self.mass_unit / self.length_unit**3
Expand Down

0 comments on commit 560e56f

Please sign in to comment.