;+ ; NAME: ; CarringtonVar ; PURPOSE: ; Get Carrington variable for given time T ; CALLING SEQUENCE: FUNCTION CarringtonVar, T, fraction=xc ; INPUTS: ; T array; type: standard time structure ; OUTPUTS: ; CarringtonVar array; type: float ; Carrington variable ; OPTIONAL OUTPUTS: ; fraction array; positive fraction of a rotation ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; AngleRange, ScEarth, TimeSet, TimeOp, TimeUnit ; SEE ALSO: ; CarringtonNr, CarringtonLng ; PROCEDURE: ; See CarringtonT0 for more details. ; MODIFICATION HISTORY: ; SEP-1999, Paul Hick (UCSD/CASS) ; JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Rewrite, circumventing ugly CarringtonT0 calls ;- TwoPi = 2*!dpi xc = AngleRange(ScEarth(T)) ; Heliographic longitude in [0,360] xc = (TwoPi-xc)/TwoPi ; Exact positive fraction of one dd = TimeSet(jd=2445871, sec=78624) ; JD 2445871.91d0) dd = TimeOp(/subtract, T, dd, TimeUnit(/day) )/!sun.synodicp nc = floor(dd) dd = dd-nc ; Approx positive fraction of one nc = 1750+nc dd = dd-xc ; Error in fraction n = where(dd LT -0.5d0) IF n[0] NE -1 THEN nc[n] = nc[n]-1 n = where(dd GT 0.5d0) IF n[0] NE -1 THEN nc[n] = nc[n]+1 RETURN, nc+xc & END