Hi, I'm building a visual observing planner and I'm trying to get meridian transit times. For DSOs and planets I'm getting no issues, but if I try creating a FixedTarget from the SkyCoord returned by astropy's get_body (like I do for the planets), I get a wrong transit time. So researching, I found astroplan uses a special target for the Moon: MoonFlag, and replacing the FixedTarget with MoonFlag I got the right result (at least for tonight). But testing another date, it would return and empty Time object. Here's a sample code to reproduce the problem:
import astropy.units as u
from astroplan import Observer
from astropy.time import Time
from astroplan.target import MoonFlag
place = Observer(latitude=40.41*u.deg,
longitude=-3.7*u.deg,
elevation=650*u.m,
name='Madrid',
timezone='Europe/Madrid')
t = Time('2025-06-11 00:14:21.664266')
meridian_time = place.target_meridian_transit_time(t, MoonFlag)
# Should be the 10th at 23:56 UTC
print(meridian_time) # Returns empty
t = Time('2025-01-10 00:14:21.664266') # Tonight for example
meridian_time = place.target_meridian_transit_time(t, MoonFlag)
print(meridian_time) # Gives correct result
What could be the reason? Thank you very much.
Hi, I'm building a visual observing planner and I'm trying to get meridian transit times. For DSOs and planets I'm getting no issues, but if I try creating a
FixedTargetfrom theSkyCoordreturned by astropy'sget_body(like I do for the planets), I get a wrong transit time. So researching, I found astroplan uses a special target for the Moon:MoonFlag, and replacing theFixedTargetwithMoonFlagI got the right result (at least for tonight). But testing another date, it would return and emptyTimeobject. Here's a sample code to reproduce the problem:What could be the reason? Thank you very much.