Pro L1scan, thefile ;scan the granule file 'thefile' for meta data ;results are printed to the command line ;modified version of a function that gathered meta for DAAC archiving ;Y2K compliance ; this code make a call 'caldat' that returns a calendar date ; caldat is an IDL function. ; this code should be Y2K regardless of IDL since the year returned ; by the IDL routine is not used. The 'year' is set in one of ; the lines just below this message. basename='LITE_L1_1994' YEAR='1994' processdate='1998-12-01' sep=string(9B) ;separate fields with a tab nl=string(10B) ;newline ;define a structure that will store the meta data MI = {MetaStruct, $ Smon:0, $ ;start month Sday:0, $ ;start day Syear:0, $ ;start year Shour:0, $ ;start hour Smin:0, $ ;start min Ssec:0, $ ;start sec Shund:0, $ ;start hundreths sec Emon:0, $ ;end month Eday:0, $ ;end day Eyear:0, $ ;end year Ehour:0, $ ;end hour Emin:0, $ ;end min Esec:0, $ ;endt sec Ehund:0, $ ;end hundreths sec MinLat:'', $ ;min lat +/-xx.xx MaxLat:'', $ ;max lat "" MinLon:'', $ ;min lon "" MaxLon:'', $ ;max lon "" GranSize:0.0, $ ;granule size (in bytes) ProDate:'' $ ;process date (12/01/1998 for all) } ;LITE level 1 structure p = {newstructuretype, $ magicnumber:0, $ majorversionnumber:0b, $ minorversionnumber:0b, $ idofdatatake:bytarr(7), $ orbitnumber:0b, $ idnumber:0l, $ gmtday:0, $ gmthour:0b, $ gmtmin:0b, $ gmtsec:0b, $ gmthund:0b, $ metday:0, $ methour:0b, $ metmin:0b, $ metsec:0b, $ methund:0b, $ latfootprint:0.0, $ ;degrees lonfootprint:0.0, $ ;degrees altshuttlefootprint:0.0, $ ;kilometers angleoffnadir:0.0, $ ;degrees digitizerondelay:0.0, $ ;useconds datatakemode:0b, $ ;0=daymode 1=nightmode specialopsmode:0b, $ ;0=normal 1=multiscatter 2=gainchange profilevalidstatus:0b, $ ;0=valid 1=355quest 2=532quest 4=064quest $ ; 8=355invalid 16=532invalid 32=064invalid landfootprintflag:0b, $ ;0=land 1=water surfaceelevatfootprint:0.0,$ ;kilometers altof18prssures:fltarr(18),$ ;kilometers tempat18plevels:fltarr(18),$ ;kelvin alttropopause:0.0, $ ;kilometers temptropopause:0.0, $ ;kelvin laserselected:0b, $ ;0=a 1=b baalignmentstatus:0b, $ ;0=unaligned 1=aligned isdbstatus:0b, $ ;0=invalid 1=valid badatastatus:0b, $ ;0=invalid 1=valid aodatastatus:0b, $ ;0=invalid 1=valid motorinmotion:0b, $ ;0=stopped 1=inmotion aperwheelstatus:0b, $ ;0=closed 1=large 2=annular 3=small 4=inmotion backgroundmongain:0b, $ ;0=day 1=night surfacemode355:0b, $ ;0=no 1=yes dbattenuation355:0b, $ ;db numbersatabovesurf355:0, $ ;num samples highestsatsample355:0.0, $ ;kilometers numberunderflows355:0, $ ;num samples filterstatus355:0b, $ ;0=out 1=in 2=inmotion callibrationstatus355:0b, $ ;0=estimated 1=calculated calibrationfactor355:0.0, $ baselinerippleremvd355:0b, $ ;0=no 1=yes oscillationremoved355:0b, $ ;0=no 1=yes backgroundvalue355:0b, $ ;raw value from instrument highvoltage355enabled:0b, $ ;0=disabled 1=enabled highvoltage355:0.0, $ ;volts energymonitor355:0.0, $ ;mjoules pmtgain355:0.0, $ baselinesubmethod355:0b, $ ;0=slope 1 = averaged subregionunderflow355:0b, $ ;0=none 1=underflow in baseline subtraction reg. transitionproblem355:0b, $ ;0=none 1=questionable fillbyte1:0b, $ surfacemode532:0b, $ ;0=no 1=yes dbattenuation532:0b, $ ;db numbersatabovesurf532:0, $ ;num samples highestsatsample532:0.0, $ ;kilometers numberunderflows532:0, $ ;num samples filterstatus532:0b, $ ;0=out 1=in 2=inmotion callibrationstatus532:0b, $ ;0=estimated 1=calculated calibrationfactor532:0.0, $ baselinerippleremvd532:0b, $ ;0=no 1=yes oscillationremoved532:0b, $ ;0=no 1=yes backgroundvalue532:0b, $ ;raw value from instrument highvoltage532enabled:0b, $ ;0=disabled 1=enabled highvoltage532:0.0, $ ;volts energymonitor532:0.0, $ ;mjoules pmtgain532:0.0, $ baselinesubmethod532:0b, $ ;0=slope 1 = averaged subregionunderflow532:0b, $ ;0=none 1=underflow in baseline subtraction reg. transitionproblem532:0b, $ ;0=none 1=questionable fillbyte2:0b, $ surfacemode064:0b, $ ;0=no 1=yes dbattenuation064:0b, $ ;db numbersatabovesurf064:0, $ ;num samples highestsatsample064:0.0, $ ;kilometers numberunderflows064:0, $ ;num samples filterstatus064:0b, $ ;0=out 1=in 2=inmotion callibrationstatus064:0b, $ ;0=estimated 1=calculated calibrationfactor064:0.0, $ baselinerippleremvd064:0b, $ ;0=no 1=yes oscillationremoved064:0b, $ ;0=no 1=yes backgroundvalue064:0b, $ ;raw value from instrument highvoltage064enabled:0b, $ ;0=disabled 1=enabled highvoltage064:0.0, $ ;volts energymonitor064:0.0, $ ;mjoules apdgain064:0.0, $ baselinesubmethod064:0b, $ ;0=slope 1 = averaged subregionunderflow064:0b, $ ;0=none 1=underflow in baseline subtraction reg. transitionproblem064:0b, $ ;0=none 1=questionable fillbyte3:0b, $ timeedsinthour:0b, $ ;unadjusted eds time timeedsintmin:0b, $ timeedsintsec:0b, $ timeedsinthund:0b, $ level0fileidnumber:0b, $ ;level 0 directory number level0fileidletter:0b, $ ;level 0 file letter dda:0, $ ddb:0, $ ;dig on delay for phase c processing filecounter:0, $ ;file counter for file breakup processing highvoltage355cmd:0.0, $ highvoltage532cmd:0.0, $ reserved:bytarr(4), $ b0_355:0.0, $ ;baseline subtraction value b0_532:0.0, $ ;baseline subtraction value b0_064:0.0, $ ;baseline subtraction value outofrng355abv40:0b, $ ;out of range 355 above 40 1=uf 2=of outofrng532abv40:0b, $ ;out of range 355 above 40, outofrng064abv40:0b, $ ;out of range 355 above 40, outofrange355:bytarr(375), $ ;bit array if bit is set then outofrange532:bytarr(375), $ ;there was underflow or overflow outofrange064:bytarr(375), $ ;for the corresponding count top355:0, $ ;index of highest valid count bottom355:0, $ ;index of lowest valid count top532:0, $ ;index of highest valid count bottom532:0, $ ;index of lowest valid count top064:0, $ ;index of highest valid count bottom064:0, $ ;index of lowest valid count profile355:fltarr(3000), $ ;counts profile532:fltarr(3000), $ profile064:fltarr(3000) $ } ;*************************************************************************** ;get julday of begining year FirstDay=JULDAY(1,1,YEAR) meta=MI GET_LUN, unit_r ;open the data file and read the first record openr,unit_r,thefile readu,unit_r,p if p.magicnumber ne 12345 then begin print,'bad magicnumber, file may be corrupted!' stop endif FS=FSTAT(unit_r) caldat, FirstDay+p.gmtday-1,M,D,Y meta.Smon=M meta.Sday=D meta.Syear=Y meta.Shour=p.gmthour meta.Smin=p.gmtmin meta.Ssec=p.gmtsec meta.Shund=p.gmthund meta.Emon=M meta.Eday=D meta.Eyear=Y meta.Ehour=p.gmthour meta.Emin=p.gmtmin meta.Esec=p.gmtsec meta.Ehund=p.gmthund meta.MinLat=p.latfootprint meta.MaxLat=p.latfootprint meta.MinLon=p.lonfootprint meta.MaxLon=p.lonfootprint meta.GranSize=FS.size meta.ProDate=processdate while not eof(unit_r) do begin readu,unit_r,p caldat, FirstDay+p.gmtday-1,M,D,Y meta.Emon=M meta.Eday=D meta.Eyear=Y meta.Ehour=p.gmthour meta.Emin=p.gmtmin meta.Esec=p.gmtsec meta.Ehund=p.gmthund if p.latfootprint lt meta.MinLat then begin meta.MinLat=p.latfootprint endif if p.latfootprint gt meta.MaxLat then begin meta.MaxLat=p.latfootprint endif if p.lonfootprint lt meta.MinLon then begin meta.MinLon=p.lonfootprint endif if p.lonfootprint gt meta.MaxLon then begin meta.MaxLon=p.lonfootprint endif endwhile close, unit_r FREE_LUN, unit_r GranName=basename+string(format='(i2.2)',meta.Smon) + $ string(format='(i2.2)',meta.Sday) + '_' + $ string(format='(i2.2)',meta.Shour) + $ string(format='(i2.2)',meta.Smin) + $ string(format='(i2.2)',meta.Ssec) + '_' + $ string(format='(i2.2)',meta.Ehour) + $ string(format='(i2.2)',meta.Emin) + $ string(format='(i2.2)',meta.Esec) ;start & end date & time (yyyy-mm-dd hh:mm:ss.tt) sDate= YEAR + '-' + $ string(format='(i2.2)',meta.Smon) + '-' + $ string(format='(i2.2)',meta.Sday) sTime= string(format='(i2.2)',meta.Shour) +':' + $ string(format='(i2.2)',meta.Smin) + ':' + $ string(format='(i2.2)',meta.Ssec) + '.' + $ string(format='(i2.2)',meta.Shund) eDate= YEAR + '-' + $ string(format='(i2.2)',meta.Emon) + '-' + $ string(format='(i2.2)',meta.Eday) eTime= string(format='(i2.2)',meta.Ehour) + ':' + $ string(format='(i2.2)',meta.Emin) + ':' + $ string(format='(i2.2)',meta.Esec) + '.' + $ string(format='(i2.2)',meta.Ehund) ;min lat +/-xx.xx res=strtrim(string(FORMAT='(D12.4)',meta.MinLat),2) if meta.MinLat gt 0.0 then begin mnlat = '+' + res endif else begin mnlat = res endelse ;max lat res=strtrim(string(FORMAT='(D12.4)',meta.MaxLat),2) if meta.MaxLat gt 0.0 then begin mxlat = '+' + res endif else begin mxlat = res endelse ;min lon "" res=strtrim(string(FORMAT='(D12.4)',meta.MinLon),2) if meta.MinLon gt 0.0 then begin mnlon = '+' + res endif else begin mnlon = res endelse ;max lon "" res=strtrim(string(FORMAT='(D12.4)',meta.MaxLon),2) if meta.MaxLon gt 0.0 then begin mxlon = '+' + res endif else begin mxlon = res endelse ;granule size (in bytes) res=strtrim(string(FORMAT='(D20.0)',meta.GranSize),2) ;get rid of the trailing '.' res=strmid(res,0,strlen(res)-1) gsize = res print,'' print,'GranuleName: '+GranName print,'GranuleSize: '+gsize print,'Minlon: '+mnlon print,'Maxlat: '+mxlat print,'Maxlon: '+mxlon print,'Minlat: '+mnlat print,'Start Time: '+sTime print,'End Time: '+eTime print,'Start Date: '+sDate print,'End Date: '+eDate print,'' end