;+ ; NAME: ; et2jd ; ; PURPOSE: ; converts ET to julian date (ET = TDB seconds after J2000) ; ; DESCRIPTION: ; converts ET to julian date (ET = TDB seconds after J2000) ; ; CALLING SEQUENCE: ; jd = et2jd(et) ; ; INPUTS: ; et - may be a double, or an array or matrix of doubles ; ; KEYWORDS ; OUTPUTS: ; jd - Julian date. Same dimensions as et. ; ; PROCEDURE: ; Calls cspice_et2jd to get the year, month, day; ; raparse to get the fractional day, and ; jdcnv to get the conversion to julian date. ; REVISON HISTORY: ; 2006 Apr 12 Leslie Young. Based on single_eph ;- function et2jd, et, format=format, prec=prec naifinit day = 24.d * 3600.d lenout = 30L sample = '2454258.86776 JDUTC' cspice_tpictr, sample, lenout, pictur, ok, errmsg if isarray(et) then begin dim = size(et, /dim) jd = make_array(dim,/double) n = n_elements(et) for i=0, n-1 do begin cspice_timout, et[i], pictur, 30L, output jd[i] = double( (strsplit(output, /ext))[0]) endfor endif else begin cspice_timout, et, pictur, 30L, output jd = double( (strsplit(output, /ext))[0]) endelse return, jd ; if isarray(et) then begin ; dim = size(et, /dim) ; jd = make_array(dim,/double) ; n = n_elements(et) ; for i=0, n-1 do begin ; CSPICE_ET2UTC, et[i], 'ISOC', 0, utci ; to nearest second ; year = fix(strmid(utci,0,4)) ; month = fix(strmid(utci,5,2)) ; day = fix(strmid(utci,8,2)) ; hr = raparse(strmid(utci,11,8))*12.d/!dpi ; jdcnv, year, month, day, hr, jdi ; jd[i] = jdi + (et[i]-utc2et(utci))/day ; get fractional seconds ; end ; return, jd ; endif else begin ; CSPICE_ET2UTC, et, 'ISOC', 0, utci ; to nearest second ; year = fix(strmid(utci,0,4)) ; month = fix(strmid(utci,5,2)) ; day = fix(strmid(utci,8,2)) ; hr = raparse(strmid(utci,11,8))*12.d/!dpi ; jdcnv, year, month, day, hr, jdi ; jd = jdi + (et-utc2et(utci))/day ; get fractional seconds ; return, jd ; end end