[AstroPy] time conversion between JD and UT
aldcroft at head.cfa.harvard.edu
Thu Sep 4 11:08:24 EDT 2014
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')
<Time object: scale='utc' format='iso' value=2010-01-01 00:00:00.000>
>>> t_jd = Time(2455197.5, format='jd', scale='utc')
<Time object: scale='utc' format='jd' value=2455197.5>
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.
> Thank you.
> AstroPy mailing list
> AstroPy at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy