[AstroPy] time conversion between JD and UT

gonghang.naoc ghang.naoc at gmail.com
Thu Sep 4 11:25:05 EDT 2014


Oh, that works.Thank you very much.
best
hang


On Thu, Sep 4, 2014 at 11:08 PM, Aldcroft, Thomas <
aldcroft at head.cfa.harvard.edu> wrote:

>
>
>
> On Thu, Sep 4, 2014 at 7:59 AM, gonghang.naoc <ghang.naoc at gmail.com>
> wrote:
>
>> Hi all,
>> I am trying astropy.time to do conversion between JD and UT.
>> It is easier to convert UT to JD.  It seems JD equals jd1+jd2, right?  I
>> do not know why there are two parts since one value is enough.
>> However It is difficult to convert JD to UT? It seems there is no
>> relative manipulation in this package.
>>
>> >>> from astropy.time import Time
>> >>> t = Time('2010-01-01 00:00:00', scale='utc')>>> t.jd1, t.jd2(2455197.5, 0.0)
>>
>> Hi Hang,
>
> This is probably what you want:
>
> >>> from astropy.time import Time
> >>> t = Time('2010-01-01 00:00:00', scale='utc')
> >>> t
> <Time object: scale='utc' format='iso' value=2010-01-01 00:00:00.000>
> >>> t.jd
> 2455197.5
> >>> t_jd = Time(2455197.5, format='jd', scale='utc')
> >>> t_jd
> <Time object: scale='utc' format='jd' value=2455197.5>
> >>> t_jd.iso
> '2010-01-01 00:00:00.000'
>
> All of this should be covered in the documentation (
> http://astropy.readthedocs.org/en/stable/time/index.html) so you might
> want to take a few minutes to read that through.
>
> Cheers,
> Tom
>
>>
>> best
>> Thank you.
>> hang
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> http://mail.scipy.org/mailman/listinfo/astropy
>>
>>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20140904/be1d0258/attachment.html>


More information about the AstroPy mailing list