function nso_fe_read, source=source, $ green_line=green_line, red_line=red_line, yellow_line=yellow_line, $ temperature=temperature, $ calibrate=calibrate, silent=silent, error=error, $ line=line, rotation=rotation, limb=limb, height=height, bestlimb=bestlimb, $ utstart=utstart @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; nso_fe_read ; PURPOSE: ; Read red (Fe X), green (Fe XIV) or yellow (Ca XV) synoptic map from file ; CATEGORY: ; NSO ; CALLING SEQUENCE: ; map = nso_fe_read( /green_line, /calibrate, source=source) ; INPUTS: ; OPTIONAL INPUT PARAMETERS: ; source=source scalar; type: string; default: $SSW_SMEI_DAT/map/sacpeak ; location of Sac Peak maps ; ; The type of data read is set using one of the following keywords: ; ; /temperature get temperature map ; /green_line get green line map (same as line = 'g') ; /red_line get red line map (same as line = 'r') ; /yellow_line get yellow line map (same as line = 'y') ; line=line scalar; type: string ; 'g','r' or 'y'. ; ; If none of these are set then line='g' is assumed. ; Keyword /temperature results in two recursive calls to nso_fe_read to read a ; green and a red map, and calculate the temperature map from the ratio. ; The 'line' setting is also used to limit the files presented in the IDL ; pickfile dialog. ; ; rotation=rotation ; scalar; type: integer; default: none ; limb scalar; type: string ; limb indicator, 'ww', 'we', 'ew' or 'ee' ; /bestlimb if set this override the input 'limb' setting and forces ; reading of the 'best limb' map. ; height=height integer; type: scalar; default: 115 ('g' and 'r') or 113 ('y') ; scan height in solar radii, times 100 (i.e. 115, 125, 135 or 145) ; ; If 'rotation' and 'limb' (or /bestlimb) are set than the IDL pickfile dialog ; is NOT called and a file name is constructed (also using 'line' and 'height'). ; ; /calibrate if set the green and red data are scaled using the post-1989 calibration: ; Map = 3.49*0.693*Map Green ; Map = 2.88*0.543*Map Red ; The yellow line is never calibrated ; silent=silent controls messages to screen ; OUTPUTS: ; map array[32,61]; type: float ; line intensities for 32 daily scans (coverng a little more than ; one Carrington rotation). ; error scalar; type: string ; error string returned by flt_read ; error = '' after successfull read ; line scalar; type: string ; 'g', 'r' or 'y' ; rotation scalar; type: integer ; Carrington rotation number ; limb scalar; type: string ; limb indicator, 'ww', 'we', 'ew' or 'ee' ; height scalar; type: integer ; scan height in solar radii, times 100 (i.e. 115, 125, 135 or 145) ; utstart array[1]; type: time structure ; start time for map (=time of first scan) ; CALLS: ; InitVar, flt_read, IsType, SetFileSpec, GetFileSpec, flt_string, nso_fe_temperature ; PROCEDURE: ; The default location for the Sac Peak files is directory $SSW_SMEI_DAT/map/sacpeak ; MODIFICATION HISTORY: ; JUL-2001, Paul Hick (UCSD/CASS) ; SEP-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Rewrite ;- InitVar, temperature, /key if temperature then begin if IsType(limb,/defined) then begin green_limb = limb[0] if n_elements(limb) eq 2 then red_limb = limb[1] else red_limb = green_limb endif map = nso_fe_read(source=source, line='g', $ calibrate=calibrate, silent=silent, error=error, $ rotation=rotation, limb=green_limb, height=height, bestlimb=bestlimb, utstart=utstart1) if error eq '' then begin tmp = nso_fe_read(source=source, line='r', $ calibrate=calibrate, silent=silent, error=error, $ rotation=rotation, limb=red_limb, height=height, bestlimb=bestlimb, utstart=utstart2) endif case error eq '' of 0: map = -1 1: begin map = nso_fe_temperature(map,tmp) utstart = [utstart1, utstart2] limb = [green_limb, red_limb] end endcase return, map endif InitVar, calibrate , /key InitVar, silent , 0 InitVar, bestlimb , /key bestlimb = bestlimb or IsType(limb,/undefined) case 1 of IsType(green_line ,/defined): line = 'g' IsType(red_line ,/defined): line = 'r' IsType(yellow_line,/defined): line = 'y' IsType(line ,/undefined): line = 'g' endcase nLng = 32 nLat = 61 M8 = nLng/4 ; 8 numbers per record M4 = nLng/M8 ; 4 records per latitude InitVar, source, filepath(root=getenv('SSW_SMEI_DAT'),subdir=['map','sacpeak'],'') single_file = IsType(rotation,/defined) and (bestlimb or IsType(limb,/defined)) case single_file of 0: begin filter = '*.sac' if IsType(line,/defined) then filter = line+filter filename = dialog_pickfile(path=source, filter=filter, /read) filename = filename[0] if filename eq '' then begin error = 'no file selected' map = -1 return, map endif end 1: begin InitVar, limb , 'we' InitVar, height, 115-2*(line eq 'y') filename = filepath(root=source, line+strcompress(rotation,/rem)+limb+'_'+strcompress(height,/rem)+'.sac') end endcase ; Presumably we have a valid filename selected. Pull it apart. SetFileSpec, filename root = GetFileSpec(upto='dir') name = GetFileSpec(part='name') tmp = flt_string(name,strcrumbs=strcrumbs) line = strcrumbs[0] rotation = round(tmp[0]) limb = strmid(strcrumbs[1],0,2) height = round(tmp[1]) if not bestlimb then limb_select = limb if nso_fe_start(rotation, limb_select, line=line, height=height, $ limb=limb, utstart=utstart, error=error, silent=silent+1) then begin filename = filepath(root=root, line+strcompress(rotation,/rem)+limb+'_'+strcompress(height,/rem)+'.sac') if flt_read(filename, tmp, nx=M8, ny=M4*nLat, atleast=8, error=error, silent=silent) then begin map = reform(tmp, nLng, nLat, /overwrite) case calibrate of 0: message, /info, 'intensities not calibrated' 1: begin message, /info, 'intensities calibrated using post-89 calibration' case line of 'g': map = 3.49*0.693*map ; Fe XIV, green line 'r': map = 2.88*0.543*map ; Fe X, red line 'y': endcase end endcase endif endif InitVar, map, -1 return, map & end