Skip to content

Observer.midnight fails if it starts at exactly midnight. #618

@zkbt

Description

@zkbt

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:

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

<Time object: scale='utc' format='jd' value=2460836.7935418035>

but if I instead try

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]
<Time object: scale='utc' format='jd' value=      ———>

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions