From 6810bd38ed6702388419808cd3131bf6081d88fe Mon Sep 17 00:00:00 2001 From: Corentin Cadiou Date: Tue, 26 Nov 2024 15:23:22 +0100 Subject: [PATCH] Make sure center/radius have units --- yt/visualization/plot_modifications.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yt/visualization/plot_modifications.py b/yt/visualization/plot_modifications.py index d16e5d38fd..b1ce93f926 100644 --- a/yt/visualization/plot_modifications.py +++ b/yt/visualization/plot_modifications.py @@ -2084,6 +2084,12 @@ def __call__(self, plot): units = "code_length" self.radius = self.radius.to(units) + if not hasattr(self.radius, "units"): + self.radius = plot.data.ds.quan(self.radius, "code_length") + + if not hasattr(self.center, "units"): + self.center = plot.data.ds.arr(self.center, "code_length") + # This assures the radius has the appropriate size in # the different coordinate systems, since one cannot simply # apply a different transform for a length in the same way