FUNCTION amie_getTemperature, raw_label, sFilePath ;+ ; NAME: ; amie_getTemperature ; ; PURPOSE: ; Gets focal plane temperature at time acquisition from file ; ; CATEGORY: ; AMIE Calibration ; ; CALLING SEQUENCE: ; amie_getTemperature, raw_label, sFilePath ; ; INPUTS: ; raw_label: string with label information ; sFilePath: path of the temperature table files (temperatures_'MISSION_PHASE_NAME'.d) ; ; OPTIONAL INPUT PARAMETERS: ; a float variable containing the temperature ; ; OUTPUTS: ; Estimation of the temperature at image acquisition time by optimally ; weighted sums of close in time temperature measurements provided in ; 3 tables: temperatures_'mission_phase_name'.dat ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; Hopefully none. ; ; RESTRICTIONS: ; No restrictions ; ; MODIFICATION HISTORY: ; 2008 Jan 08, sm: First version ; ; (c) 2008, Santa Martinez, ESA/SCI-OS ;- IF (N_ELEMENTS(sFilePath) EQ 0) THEN sFilePath = '' sFilename = STRMID(pdspar(raw_label,'FILE_NAME'),1) sFilename = STRMID(sFilename,0,STRLEN(sFilename)-1) ;; Orbit number (or day if orbit non applicable) iIdentifier = STRMID(sFilename,9,5) ;; Number of the image in the orbit (or on that day) iImageNumber = STRMID(SFilename,15,5) ;; Mission phase name sMissionPhase = STRMID(pdspar(raw_label,'MISSION_PHASE_NAME'),1) sMissionPhase = STRMID(sMissionPhase,0,STRLEN(sMissionPhase)-1) ;; Focal Plane Temperature file path and name WHILE (((I = STRPOS(sMissionPhase, ' '))) NE -1) DO $ STRPUT, sMissionPhase, '_', I sTemperatureFile = sFilePath + STRLOWCASE('temperatures_' + sMissionPhase + '.dat') iCounter = 0 sLine = '' fTemp = -1. ;; Read Focal Plane Temperatures from file OPENR, iUnit, sTemperatureFile, /GET_LUN WHILE NOT EOF(iUnit) DO BEGIN READF, iUnit, sLine ;; Jump over the first 9 lines IF (iCounter++ LT 9) THEN CONTINUE ;; Split the line into the different columns sValues = STRTRIM(STRSPLIT(sLine,' ',/EXTRACT)) ;; Match iIdentifier (Orbit number or date) and iImageNumber IF (FIX(sValues[0]) NE iIdentifier) THEN CONTINUE; IF (FIX(sValues[1]) NE iImageNumber) THEN CONTINUE; ;; Temperature fTemp = FLOAT(sValues[6]) BREAK ENDWHILE CLOSE, iUnit FREE_LUN, iUnit RETURN, fTemp END