astropy / astropy/astroplan

LocalTimeConstraint does not consider local time-zone

Open
#466 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
225
Forks
121
Avg merge
28m
Merged PRs (30d)
1

Description

`AltitudeConstraint` does not consider DST (daylight saving time).
For instance consider the following code:

```
#!/usr/bin/env python3

import astroplan, astropy.time
import astropy.units as u
import pytz,datetime

polse=astroplan.Observer(
latitude=
46+(28+9.1/60)/60,
longitude=
13+(0+42.6/60)/60,
elevation=
750*u.meter,
timezone=
pytz.timezone('Europe/Rome'))

target = astroplan.FixedTarget.from_name('Aldebaran')
constraint = astroplan.AltitudeConstraint(min=20*u.deg)

print(constraint(polse,target,times=astropy.time.Time('2020-04-10 21:00',
location=polse.location)))

```

It determines whether Aldebaran is visible above 20 deg. on the evening of 2020-04-10.
In Stellarium at that time the star is above 25 deg. and at 22:00 the star is below the 20 deg.
However the code returns `False` after 20:00. When it should be `True` until 21:00.

I am running anaconda on Linux:
```
astroplan 0.6
astropy 4.0.1.post1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the supplied script with AltitudeConstraint, Observer, FixedTarget, and astropy.time.Time, then inspect how the constraint evaluates the timezone-aware observation time. Compare the result with the stated local-time and DST expectations, and add a regression test showing the constraint remains true through the expected hour.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.