;+
; PROJECT
;           SolarB EIS
;
; NAME
;           EIS_POINTING_OFFSET
;
; PURPOSE
;           This function simply returns the EIS FOV centre relative to that
;           of SOT
;
; CATEGORY
;           EIS timeline planning
;
; INPUTS
;           + obs_id   = [0/1/2] see notes/eis_iris/description.txt
;           + aia_time = time at which to get AIA offset
; WRITTEN
;           John A Rainnie, RAL, 24-Jun-2006
;
; HISTORY
;           V0.1 1-Jan-2007, David Williams
;                Changed from x=130 to x=0 in anticipation of successful CMIR
;                movement
;           v0.2 JAR 13-Jun-2007
;                y_offset changed to 50 - as requested by D. Brooks
;           v0.3 JAR 31-Mar-2014
;                Added inputs "obs_id" and "aia_time". The former flag is
;                to indicate which offsets to apply [0,1,2 = None, EIS/AIA,
;                and EIS/AIA and SOT/Hinode].
;           v0.4 JAR 27-Aug-2014
;                Added new input "sot_offset"
;-
;______________________________________________________________________________
FUNCTION eis_pointing_offset , obs_id , aia_time , sot_offset

IF (N_ELEMENTS(sot_offset) LT 2) THEN sot_offset = [0.,0.]

; Just for development/testing purposes
;IF (N_ELEMENTS(aia_time) NE 1) THEN BEGIN
;IF (N_ELEMENTS(sot_offset) NE 2) THEN BEGIN
;   traceback = scope_traceback(/structure)
;   called_by = traceback[N_elements(traceback)-2].routine
;   this_prog = traceback[N_elements(traceback)-1].routine
;   print,STRJOIN([' + ',this_prog,' => ',called_by],/SINGLE)
;ENDIF

def_offset = [0.  , 50.]
aia_offset = eis_aia_offsets(anytim2utc(aia_time,/stime))
;sot_offset = [12. ,35. ]
sot_offset = [0.,0.]

; For development/testing purpose only
verbose = 0
;verbose = 1
IF (verbose EQ 1) THEN BEGIN
   def = STRING(format='(D-6.2,A-2,D-6.2)',def_offset[0],', ',def_offset[1])
   aia = STRING(format='(D-6.2,A-2,D-6.2)',aia_offset[0],', ',aia_offset[1])
   sot = STRING(format='(D-6.2,A-2,D-6.2)',sot_offset[0],', ',sot_offset[1])
   print,         '+++ Offsets:   +++++++++++'
   print,STRJOIN(['Default    : ',def],/SINGLE)
   print,STRJOIN(['EIS/AIA    : ',aia],/SINGLE)
   print,STRJOIN(['Hinode/SOT : ',sot],/SINGLE)
   print,         '++++++++++++++++++++++++++'
ENDIF

RETURN , {def_offset:def_offset   ,   $
          aia_offset:aia_offset   ,   $
          sot_offset:sot_offset}

END
