PRO Get_Scat_Daily_v4,filename, mingmt,windspd,winddir,scatflag,radrain ; this routine will read RSS scatterometer daily bytemap files. ; will read version-4 files released April 2011 ; ; filename with full path is the only input argument. ; This routine assumes the file is *zipped*. Remove compression from openr command if your files are unzipped. ; ; The routine returns: ; mingmt, wspd, wdir, scatflag, radrain ; mingmt is the gmt time in minutes of day ; windspd is the 10 meter surface wind speed in m/s ; winddir is the wind direction in degrees the wind is blowing to, North= 0 degrees ; scatflag is the scatterometer rain flag (0=no rain, 1=rain) ; radrain is the collocated radiometer columnar rain rate in km*mm/hr ; SSMI or TMI observation within 60 minutes of QuikScat and SeaWinds ; radrain contains -999. where there is no collocated radiometer data ; 0. where there is radiometer data, but there is no measureable rain ; -1. where there is radiometer data, no measureable rain, but nearby cells have rain ; 0.5 to 31.0 km*mm/hr radiometer columnar rain rate for that cell ; ; The center of the first cell of the 1440 column and 720 row map is at 0.125 E longitude and -89.875 latitude. ; The center of the second cell is 0.375 E longitude, -89.875 latitude. ; XLAT=0.25*ILAT-90.125 ; XLON=0.25*ILON-0.125 ; ; please read the description file on www.remss.com for infomation on the various fields, ; or contact RSS support: http://www.remss.com/support ; ; program updated for both quikscat and seawinds July 2004 ; added cell description March 2005 ; added comment Jan 2007 ; changed text to state it reads v4 data Apr 2011 ; ;binary data in file binarydata= bytarr(1440,720,4,2) ;output products (lon,lat,asc/dsc) mingmt =fltarr(1440,720,2) windspd =fltarr(1440,720,2) winddir =fltarr(1440,720,2) scatflag=intarr(1440,720,2) radrain =fltarr(1440,720,2) radflag =intarr(1440,720) krain=radflag ;determine if file exists exist=findfile(filename,COUNT=cnt) if (cnt ne 1) then begin print, 'FILE DOES NOT EXIST!!' mingmt[*,*,*]=1530 endif else begin ;open file, read binary data, close file close,2 openr,2,filename, error=err, /compress ;compress keyword allows reading of gzip file if (err gt 0) then begin print, 'ERROR 1 WITH FILE: ', filename endif else begin readu,2,binarydata close,2 endelse ; multipliers to change binary data to real data xscale=[6.,.2,1.5] ; loop through asc/dsc and all 4 variables for iasc=0,1 do begin for ivar=0,3 do begin ; extract 1 variable, scale and assign to real array dat=binarydata[*,*,ivar,iasc] case ivar of 0: BEGIN ;gmt time mingmt[*,*,iasc]=dat*xscale[ivar] END 1: BEGIN ;wind speed windspd[*,*,iasc]=dat*xscale[ivar] END 2: BEGIN ;wind direction winddir[*,*,iasc]=dat*xscale[ivar] END 3: BEGIN ;scatflag and radrain scatflag[*,*,iasc] =dat-2*floor(dat/2) ; bit 1 is scat flag of 0=no rain, 1=rain radflag =floor((dat-4*floor(dat/4))/2) ; bit 2 is indicator of radiometer collocation, 0= no rad data, 1= 60 min rad data collocation krain=floor(dat/4) ; bits 3-8 are rad rain rate with a value of 1 indicating adjacent rain temp=fltarr(1440,720)-999. radok=where(radflag eq 1) temp[radok]=0 radok=where(radflag eq 1 and krain eq 1) ; if there is adjacent rain, set radrain value to -1.0 temp[radok]=-1 radok=where(radflag eq 1 and krain ge 2) temp[radok]=krain[radok]/2.-0.5 radrain[*,*,iasc]=temp END ENDCASE endfor ;ivar endfor ;iasc endelse bad=where(mingmt gt 1440) windspd[bad] = -999. winddir[bad] = -999. scatflag[bad] = -999. radrain[bad] = -999. return END