`Observer.midnight` fails if it starts at exactly midnight.
- Dominant language
- Python
- Stars
- 225
- Forks
- 121
- Avg merge
- 28m
- Merged PRs (30d)
- 1
Description
Hi wonderful `astroplan` heroes!
I came across a tiny silly thing, which is that `Observer.midnight` seems to fail if the starting time you give it is already exactly a local midnight for the observatory. I could just avoid doing this, but I've done it by accident enough times that I thought it might be worth mentioning.
Here's an example:
```python
from astroplan import Observer
from astropy.time import Time
observatory = Observer.at_site('APO', timezone='US/Mountain')
day = Time.now()
observatory.midnight(day)
```
prints something like what I would expect as output
```
but if I instead try
```python
midnight = observatory.midnight(day)
observatory.midnight(midnight)
```
I get an unexpected output of
```
WARNING: TargetNeverUpWarning: Target with index 0 does not cross horizon=0.0 deg within 24 hours [astroplan.observer]
I'm guessing this might be something like the zero-crossing you use to identify what midnight is can't be found if it's at exactly the start or end of the time grid? No problem if you can't fix this or don't want to change the behavior of midnight, but I just thought I'd share.
Thanks so much @bmorris3 for this lovely package!
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with Observer.midnight using the two calls shown, especially when the second call starts at the returned midnight. Then inspect the midnight calculation and its time-grid or horizon-crossing behavior; done means an exact-midnight input returns a valid Time and a regression test covers it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100