function nso_fe_start, rotation, limb_select, line=line, height=height, $ utstart=utstart, limb=limb, silent=silent, error=error @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; nso_fe_start ; PURPOSE: ; Retrieves the exact start time for an NSO Fe XIV, Fe X or Ca XV synoptic map ; CATEGORY: ; gen/idl/toolbox/nso_fe ; CALLING SEQUENCE: ; status = nso_fe_start(rotation, limb_select, line=line, $ ; utstart=utstart, limb=limb, height=height) ; INPUTS: ; rotation scalar; type: integer ; Carrington rotation number ; limb_select scalar; type: string ; one of 'ww','ee','ew','we' ; If not set then the best limb is used (as identified by the ; plus sign in the sacpeak.* files). ; OPTIONAL INPUT PARAMETERS: ; line=line scalar; type: string; default: 'g' ; one of 'g', 'r', 'y' ; coronal line id: green (Fe XIV), red (Fe X) or yellow (Ca XV) ; 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) ; /silent controls messages ; OUTPUTS: ; status 0: no start time found (utstart and limb do not exist) ; 1: start time found ; output variables utstart and limb will only exist if status=1. ; OPTIONAL OUTPUT PARAMETERS: ; error=error scalar; type: string ; error string if status=0; null string if status=1 ; utstart=utstart ; array[1]; type: time structure ; start time of synoptic map ; limb=limb scalar; type: string ; one of 'ww','we','ee','ew' ; Same as limb_select if it was set, or else the 'best limb' ; CALLS: ; InitVar, destroyvar, flt_read, TimeSet, who_am_i, ArrayLocation ; RESTRICTIONS: ; The startimes are stored in three files sacpeak.xiv, sacpeak.x and sacpeak.ca ; stored in the same directory ast this routine. ; PROCEDURE: ; MODIFICATION HISTORY: ; JUL-2001, Paul Hick (UCSD/CASS) ; NOV-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Complete rewrite. ;- InitVar, rotation, 1880 InitVar, line , 'g' InitVar, silent, 0 InitVar, height, 115-2*(line eq 'y') destroyvar, utstart, limb case line of 'g': label = 'Fe XIV (green line)' 'r': label = 'Fe X (red line)' 'y': label = 'Ca XV (yellow line)' endcase sacfile = 'sacpeak_'+strcompress(height,/rem)+'.'+line if flt_read(filepath(root=who_am_i(/dir), sacfile), start, error=error, crumbs=crumbs, silent=silent) then begin crumbs = strtrim(crumbs[1:*,*],2) i = size(crumbs,/dim) limbs = crumbs[reform((ArrayLocation(where(strpos(crumbs,'+') ne -1),dim=i))[0,*]),indgen(i[1])] limbs = strlowcase(strmid(limbs,0,2)) i = where(start eq rotation) case i[0] ne -1 of 0: error = 'no entry for '+label+' CR'+strcompress(rotation) 1: begin i = (ArrayLocation(i[0], size=size(start)))[1] InitVar, limb_select, limbs[i] doy = start[2+(where(strlowcase(limb_select) eq ['ee','ew','ww','we']))[0],i] case doy ne 0.0 of 0: error = 'no start time for '+label+' CR'+strcompress(rotation)+', limb '+limb_select 1: begin utstart = TimeSet(yr=start[1,i], doy=doy) limb = limb_select end endcase end endcase endif status = error eq '' if not status then message, /info, error return, status & end