FUNCTION readnsosc, nsofile, nlng=nlng, cvariable=cvariable, header=header @compile_opt.pro ; On error, return to caller wsc = readfits(nsofile, hdr) n = fxpar(hdr,'NFILETOT') IF !err NE -1 THEN BEGIN ; New SOLIS file ; The SOLIS files contain a list of magnetograms used to make the map. ; The time encoded in the file name for the last magnetogram is ; the time assigned to the synoptic map. tmp = fxpar(hdr,'FILE'+string(format='(I2.2)',n)) tmp = GetFileSpec(tmp,part='name') fmt = 'YYYYMNDD_hhmm' tmp = TimeSet(strmid(tmp,strlen(tmp)-strlen(fmt)),format=fmt) header = ['OBSERVAT=NSO/KP-SOLIS/VSM', 'OBSTIME='+TimeString(tmp,/_ydoy,upto=TimeUnit(/sec))] tmp = GetFileSpec(nsofile,part='name') tmp = strmid(tmp,strpos(tmp,'_cr')) ENDIF ELSE BEGIN tmp = GetFileSpec(nsofile,part='name') CASE strlowcase( strmid(tmp,0,3) ) OF 'nso': BEGIN ; Most of the old SOLIS files have an OBSTIME keyword in it. header = 'OBSERVAT=NSO/KP-SOLIS/VSM (old)' tmp = fxpar(hdr,'OBSTIME') IF !err NE -1 THEN header = [header, 'OBSTIME='+tmp] END 'mdi': header = 'OBSERVAT=SOHO/MDI' ELSE : header = 'OBSERVAT=UNKNOWN' ENDCASE tmp = GetFileSpec(nsofile,part='name') ENDELSE tmp = flt_string(tmp, /double) ; The Carrington variable grid for the output file has a ; resolution of 5 degrees. The grid is monotonically decreasing from ; the value implied by the file name (CR and longitude) back to ; the previous rotation in steps of 5 degrees. ; Dropping the last element in the Carrington array reduces the ; number of elements from 73 to 72 (this is equivalent to the ; /dropfirst keyword on wso_read). CASE n_elements(tmp) EQ 1 OF 0: tmp = tmp[0]+(1-tmp[1]/360) 1: tmp = tmp[0] ENDCASE InitVar, nlng, 72 cvariable = tmp-(gridgen(nlng+1,range=double([0,1])))[0:nlng-1] RETURN, wsc & END