c========================================================================== c c NAME: grid_ch3 c c PURPOSE: Grids HIRS cloud height scan line data and bins into grid. Currently c grids cloud top pressure and temperature and emissivity c c INPUTS: c day_file.........File name of daily clear-sky file c jday.............julian day of year c iyr4.............4 digit year c nlon.............number of longitude grid points c nlat.............number of latitude grid points c max_cnt..........Maximum number of observations in time array c iparm............Parameter to grid c s_range(2).......Range of scan points (1-28) c gres.............grid resolution c c OUTPUT: c sum..............sum of the values c sumsq............sum squared of values c obs_time.........array of observation times in julian days from Jan 1, 1969. c icnt.............number of points. c c EXTERNALS: c hirs_grid.inc c recl_parms.inc c binit.f c date_to_julian69.f c c HISTORY: c Darren Jackson CIRES/ETL April 2002 c Version 3 computes array of observation times, September 2002 c c============================================================================ subroutine grid_ch3(day_file,jday,iyr4,nlon,nlat,max_cnt, . iparm,s_range,sum,sumsq,obs_time,icnt,gres) implicit none include 'hirs_grid.inc' include 'recl_parms.inc' integer nlon,nlat,max_cnt,iparm,s_range(2) integer icnt(nlon,nlat),ispot(nspot),irec,ii,jj,k integer obs_time(nlon,nlat,max_cnt) integer jday,jday69,iyr4 integer itmp,ijday69 real sum(nlon,nlat),sumsq(nlon,nlat) real alt,fscale,xlon,xlat,gres,ref real parm character day_file*85 logical bad_data,nolimb c c* HIRS CH scan line data array (1 record = 46 bytes) c integer itime integer*2 ilon,ilat,iszen,ialt,iline,ipct,itc,itsfc byte isp,iref,iem,iclear integer*2 itb(7),ideltrad(4) c c* Inititalize c data bad_data/.false./ c c* Read and bin scan line data c irec=1 open(1,file=day_file,access='direct',recl=ch_rec) 60 read(1,rec=irec,err=99) itime,ilon,ilat,iline,isp, . iszen,ialt,iref,itb,ipct,iem,itc,itsfc,ideltrad, . iclear if(isp .gt. 28) isp = isp - 28 if(isp .ge. s_range(1) .and. isp .le. s_range(2)) then call date_to_julian69(iyr4,1,jday,jday69) itmp = nint((float(itime) /100. / 86400.) * 1000.) ijday69 = jday69 * 1000 + itmp xlon=fscale(ilon,180.,100.) xlat=fscale(ilat,0.,100.) call binit(gres,0,0,xlon,xlat,ii,jj) c c* Convert parameters for binning c if(iparm .eq. 1) then parm = ipct * 1. ! Cloud top pressure elseif(iparm .eq. 2) then parm = fscale(itc,100.,100.) ! Cloud top temperature elseif(iparm .eq. 3) then parm = iem * 1. ! IR emissivity elseif(iparm .ge. 4 .and. iparm .le. 8) then parm = fscale(itb(iparm-3),100.,100.) ! Channel 4-8 brightness temperature elseif(iparm .eq. 10) then parm = fscale(itb(6),100.,100.) ! Channel 10 brightness temperature elseif(iparm .eq. 12) then parm = fscale(itb(7),100.,100.) ! Channel 12 brightness temperature elseif(iparm .eq. 20) then parm = fscale(itsfc,100.,100.) ! Surface temperature elseif(iparm .ge. 24 .and. iparm .le. 27) then parm = fscale(ideltrad(iparm-23),0.,100.) ! Channel 4-8 Rclr-Rcld elseif(iparm .eq. 30) then if((iclear .eq. 0 .and. ipct .lt. 1000) .or. (iclear .eq. 1 . .and. iem .lt. 95)) then parm = 1. else parm = 0. endif endif c c* Sum resulting parameters c if(parm .gt. -998.) then sum(ii,jj)=sum(ii,jj)+parm sumsq(ii,jj)=sumsq(ii,jj)+parm**2 icnt(ii,jj)=icnt(ii,jj)+1 if(icnt(ii,jj) .le. max_cnt) then obs_time(ii,jj,icnt(ii,jj))=ijday69 else write(*,*) 'Number of obs. exceeds max_cnt' write(*,*) 'max_cnt,icnt = ',max_cnt,icnt(ii,jj) write(*,*) 'year = ',iyr4,' jday = ',jday write(*,*) 'longitude,latitude = ',xlon,xlat write(*,*) ' ' obs_time(ii,jj,1) = -1 endif endif endif irec=irec+1 goto 60 99 close(1) write(*,*) 'Read ',irec,' records in ',day_file return end