[AstroPy] problems with astroplan

banyal banyal at iiap.res.in
Mon Nov 7 23:05:37 EST 2016


 Would be great to have the 'object visibility' in local time. This
issue was also flagged by someone in the discussion group on astroplan_.
_I hope they fix it soon. 



On 2016-11-08 03:09, Matthew Craig wrote: 

> Hi, 
> IIRC, astropy times do not support timezones in a very direct way [1]. Both start_time and end_time from the example will be interpreted as times in UTC, and the time arguments to functions in astroplan are in UTC, not local time, even if you specify the time zone when you create the Observer object. The documentation for target_is_up say that the time is passed directly to the astropy Time class which, in the cases in the sample code, will assume UTC. 
> It looks like if you want to get local times you could use the astropy_time_to_datetime method of Observer. 
> I'm using astropy in an undergraduate observing class this semester and have been reminding them (repeatedly) that they need to do local to UTC conversions themselves and then feed the UTC times into astropy/astroplan. That is a little inconvenient, but seemed less error-prone than explaining how to use pytz or create a TimezoneInfo object (their python background is typically limited). 
> [1]: http://docs.astropy.org/en/latest/time/index.html#timezones [1] 
> Matt Craig 
> schedule: http://physics.mnstate.edu/craig [2]
> ---- 
> Professor
> Department of Physics and Astronomy 
> Minnesota State University Moorhead
> 1104 7th Ave S, Moorhead MN 56563
> office: Hagen 307F
> phone: (218) 477-2439
> fax: (218) 477-2290 
> On Nov 7, 2016, at 2:57 PM, Eric L. N. Jensen <ejensen1 at swarthmore.edu> wrote: 
> Good catch, Gautham. 
> And more generally to that point, Steven, I'd suggest getting in the habit of *always* specifying the timezone for any times you use in your code (e.g. in any call to 'Time'), even if you're using UTC, just to be more clear to yourself and to anyone reading your code what timezone you're working with. In the example you gave, when you're specifying the start and end times it would still be good to explicitly specify the timezone there as well. 
> Eric
> On Nov 7, 2016, at 3:53 PM, Gautham Narayan <gnarayan at noao.edu> wrote:
> Specify the time as well as the date. 2016-11-11 is being parsed at 2016-11-11 00:00:00 UTC, at which point it's only 5pm here in AZ, so it's not yet civil twilight at Kitt Peak.
> print(astroplan.is [3]_observable(constraint, kpno, target[:1], times=[Time('2016-11-11 12:15:00')]))
> # prints True
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy

AstroPy mailing list
AstroPy at scipy.org
https://mail.scipy.org/mailman/listinfo/astropy [4]

Best Regards
Dr Ravinder Banyal
Indian Institute of Astrophysics
Koramangala 2nd Block
Bangalore 560034
Phone: 08025530672

[1] http://docs.astropy.org/en/latest/time/index.html#timezones
[2] http://physics.mnstate.edu/craig
[3] http://astroplan.is
[4] https://mail.scipy.org/mailman/listinfo/astropy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20161108/d4be6248/attachment.html>

More information about the AstroPy mailing list