PRO Get_Scat_Averaged_v4,filename, windspd,winddir,scatflag,radrain,ierr ; this routine will read the RSS scatterometer time_averaged bytemap files. ; reads version-4 files released April 2011 ; ; The only input argument is the filename with full path. ; This routine assumes the file is zipped. Remove compression from openr command if your files are unzipped. ; ; The routine returns: ; wspd, wdir, scatflag, radrain ; 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 ; derived from an SSMI or TMI observation collocated within 60 minutes of the scatterometer observation ; 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 ; ; Data contained in the daily files are scalar (wind speed) and vector (wind direction) averaged ; to produce the values in the time-averaged files. A data value for a given cell is only provided in a ; time-averaged file if a minimum number of data exist within the time period being produced ; (3-day maps, 2 obs; week maps, 5 obs; month maps, 20 obs) ; ; 3-day =(average of 3 days ending on file date) ; weekly =(average of 7 days ending on Saturday of file date) ; monthly =(average of all days in month) ; ; please read the description file on www.remss.com ; for infomation on the various fields, or contact RSS support: ; http://www.remss.com/support ; ; Adjusted to read both seawinds and quikscat July 2004 ; Added cell lat/lon definition March 2005 ; Added definition of averaged files Feb 2009 ; changed text to say it reads v4 April 2011 ; ierr=0 ;binary data in file binarydata= bytarr(1440,720,3) ;output products (lon,lat,asc/dsc) windspd =fltarr(1440,720) winddir =fltarr(1440,720) scatflag=intarr(1440,720) radrain =fltarr(1440,720) 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!!' ierr=1 return 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 ierr=1 return endif else begin readu,2,binarydata close,2 endelse ; multipliers to change binary data to real data xscale=[.2,1.5] ; loop through 3 variables for ivar=0,2 do begin ; extract 1 variable, scale and assign to real array dat=binarydata[*,*,ivar] case ivar of 0: BEGIN ;wind speed windspd[*,*]=dat*xscale[ivar] END 1: BEGIN ;wind direction winddir[*,*]=dat*xscale[ivar] END 2: BEGIN ;scatflag and radrain scatflag[*,*] =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[*,*]=temp END ENDCASE endfor ;ivar endelse bad=where(windspd gt 50.0) windspd[bad] = -999. winddir[bad] = -999. scatflag[bad] = -999. radrain[bad] = -999. return END