From 560e56fcb8761a0f1daa9d3ff50f6aa6d3a23ab1 Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Thu, 5 Dec 2024 10:47:20 -0600 Subject: [PATCH] always cast enzo units to float --- yt/frontends/enzo/data_structures.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/yt/frontends/enzo/data_structures.py b/yt/frontends/enzo/data_structures.py index acb7ea0c9f6..0af49ddd3f0 100644 --- a/yt/frontends/enzo/data_structures.py +++ b/yt/frontends/enzo/data_structures.py @@ -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