from_julian_date#

from_julian_date(jd1, jd2, scale, forward_res=48, reverse_res=48)#

Converts two-part Julian Dates (JD) to SIVs.

[astropy.time](https://docs.astropy.org/en/stable/time/index.html) provides a simple interface to convert between common datetime representations (e.g. numpy.datetime64, datetime, iso strings, etc. ) and two-part (JD). See in examples below

from [Julian Day Wikipedia](https://en.wikipedia.org/wiki/Julian_day) “the Julian date (JD) of any instant is the Julian day number plus the fraction of a day since the preceding noon in Universal Time. Julian dates are expressed as a Julian day number with a decimal fraction added. For example, the Julian Date for 00:30:00.0 UT January 1, 2013, is 2 456 293.520 833.

from [pyerfa](https://pyerfa.readthedocs.io/en/latest/api/erfa.d2dtf.html#erfa.d2dtf): “d1+d2 is Julian Date, apportioned in any convenient way between the two arguments, for example where d1 is the Julian Day Number and d2 is the fraction of a day.”

Parameters:
jd1: double

jd1+jd2 is Julian Date apportioned in any convenient

jd2: double

jd1+jd2 is Julian Date apportioned in any convenient

scale: str. Either ‘tai’ or ‘utc

The timescale (or time standard)

forward_res: int. Valid range is 0..48

The forward resolution (c.f coarsest_resolution_finer_or_equal_ms())

reverse_res: int. Valid range is 0..48

The reverse resolution (c.f. coarsest_resolution_finer_or_equal_ms()

Returns:
tivs: 1D numpy.array

STARE temporal index values

Examples

>>> import astropy.time
>>> t = astropy.time.Time('2021-08-26T17:36:46.426092', format='isot')
>>> t.jd1, t.jd2
(2459453.0, 0.23387067236111114)
>>> jd1 = numpy.array([2459453.0])
>>> jd2 = numpy.array([0.23387067236111114])
>>> tivs = pystare.from_julian_date(jd1=jd1, jd2=jd2, scale='tai', forward_res=10, reverse_res=10)
>>> pystare.to_stare_timestring(tivs)
['2021-08-26T17:36:46.426 (10 10) (1)']
>>> tivs = pystare.from_julian_date(jd1=jd1, jd2=jd2, scale='utc', forward_res=10, reverse_res=10)
>>> pystare.to_stare_timestring(tivs)
['2021-08-26T17:37:23.426 (10 10) (1)']