From 935ab27d5dfb42fc4ef851605ed1f35f93a34d2c Mon Sep 17 00:00:00 2001 From: "H. Xie" <7456793+H-xie@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:42:07 +0800 Subject: [PATCH] Fix `TimeDeltaMissingUnitWarning` in `plot_airmass` The function `plot_airmass` triggers the warning `TimeDeltaMissingUnitWarning`. This issue arises from unit checks implemented in newer versions of Astropy (refer to commit d8968b29a209fdaebd0f48ff30863718bca9db78). The warning is generated because a time value without a unit is being added to an Astropy Time object. To resolve this warning, it is recommended to add the unit `u.hour` to the time value. --- astroplan/plots/time_dependent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroplan/plots/time_dependent.py b/astroplan/plots/time_dependent.py index e30e9874..8d961bb3 100644 --- a/astroplan/plots/time_dependent.py +++ b/astroplan/plots/time_dependent.py @@ -161,7 +161,7 @@ def plot_airmass(targets, observer, time, ax=None, style_kwargs=None, tzname = time.tzname() tzinfo = time.tzinfo else: - tzoffset = 0 + tzoffset = 0 * u.hour tzname = 'UTC' tzinfo = None # Populate time window if needed.