astropy / astroplan

Observation planning package for astronomers – maintainer @bmorris3
https://astroplan.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
199 stars 109 forks source link

Problem with twilight_evening_nautical() at specific date and observatory #533

Open nicochunger opened 1 year ago

nicochunger commented 1 year ago

I'm using astroplan to schedule observations, and one of the many tasks is getting the nautical twilight time each night. It worked perfectly for many months, until it unexpectedly broke on the 3rd of November.

The code to reproduce the error is the following:

import astroplan
from astropy.time import Time

date = Time("2022-11-03")
lasilla = astroplan.Observer.at_site("lasilla")
evening_twilight = lasilla.twilight_evening_nautical(date, which="next")

The output:

WARNING: TargetNeverUpWarning: Target with index 0 does not cross horizon=-12.0 deg within 24 hours [astroplan.observer]
<Time object: scale='utc' format='jd' value=nan>

For some reason, it thinks the Sun never crosses the horizon on the 3rd of November. To troubleshoot, I tried changing the dates, and it works for a day earlier (02/11) or a day later (04/11). So it's specifically with the 3rd of November, and of any year as well. And apparently this error only appears with "lasilla" at the site of the observer. When I change it to "paranal" it does work. So I'm a bit lost on what could be causing this problem.

nicochunger commented 1 year ago

To add, I just tested the same thing with twilight_evening_civil() and with twilight_evening_astronomical() and it works in both cases. So the problem is just with the nautical twilight

bmorris3 commented 1 year ago

Does this FAQ page answer your question? https://astroplan.readthedocs.io/en/latest/faq/precision.html