c-------------------------------------------------------------------------------- c NAME: gridit3 c c PURPOSE: Grids HIRS scan line data and bins into grid c c LANGUAGE: c FORTRAN-77 c INPUTS: c c day_file.........File name of daily clear-sky file c nolimb...........T -> no limb cor., F -> limb correction c rcoef............Regression coefficient array c chnord...........Regression channel order array c npred............Number of predictors array c nlon.............number of longitude grid points c nlat.............number of latitude grid points c gres.............grid resolution c c OUTPUTS: c c sum..............sum of the TB values for each channel and gridpoint c sumsq............sum squared of TB values c icnt.............number of points. c c EXTERNALS: c binit -> Bins the lon/lat data onto grid c nodalpass -> Identifies asc/des pass for observation c hlimb -> Limb correction C c CREATION HISTORY: C Darren Jackson CIRES/ETL 2000 c - Version 3 - bins data by ascending/descending node. c - Removes N12 observation after April 1997. c--------------------------------------------------------------------------------- subroutine gridit3(day_file,nolimb,rcoef,chnord,npred,nlon,nlat, . sum,sumsq,icnt,gres) implicit none include 'hirs_grid.inc' integer nlon,nlat integer icnt(nlon,nlat,nchn,node),ispot(nspot) integer irec,ii,jj,k,n,day,year integer prvline,prvtime,prvn,line,ifromc real sum(nlon,nlat,nchn,node),sumsq(nlon,nlat,nchn,node) real alt(nspot),fscale,xlon,xlat,gres,ref real tb(nspot,nchn2),tblc(nspot,nchn2) real prvlon character day_file*50,sat*2 logical bad_data(nspot),nolimb integer chnord(ncoef-1,nang,nchn2),npred(nang,nchn2) real rcoef(ncoef,nang,nchn2) c c* HIRS scan line data array c integer itime integer*2 ilon,ilat,iszen,ialt,iline byte isp,oqc,csf,iref integer*2 itb(nchn2) c c* Inititalize c data bad_data/.false./ sat=day_file(23:24) year=ifromc(day_file(27:27))*10+ifromc(day_file(28:28)) day=ifromc(day_file(31:31))*100 + ifromc(day_file(32:32))*10 + . ifromc(day_file(33:33)) c c* Do not process N12 data after April 1997. Filter wheel anomaly. c if(sat.eq.'12' .and. year.eq.97 .and. day.gt.120) goto 98 if(sat.eq.'12' .and. year.gt.97) goto 98 c c* Read and bin scan line data c n=1 prvn=1 irec=1 open(1,file=day_file,access='direct',recl=56) 60 read(1,rec=irec,err=99) itime,ilon,ilat,iline,isp, . iszen,ialt,oqc,csf,iref,itb xlon=fscale(ilon,180.,100.) xlat=fscale(ilat,0.,100.) call binit(gres,1,1,xlon,xlat,ii,jj) c c* Convert parameters for limb correction c ispot(1)=int(isp) alt(1)=fscale(ialt,0.,10.) do k=1,nchn2 tb(1,k)=fscale(itb(k),100.,100.) enddo ref=float(iref)/100. line=iline c c* Do not process first pixel so to find node direction c if(irec .gt. 1) then c c* Determine ascending/descending observation c call nodalpass(itime,xlon,line,n,prvtime,prvlon, . prvline,prvn) c write(89,*) n,prvn,xlon,prvlon,xlat c write(89,*) iline,prvline,itime,prvtime c c* Apply limb correction c if(.not. nolimb) then call hlimb(ispot,alt,bad_data,rcoef,chnord,npred, . tb,tblc) endif c c* Sum resulting TBs c do k=1,nchn if(k .lt. nchn) then if(tb(1,k) .ne. xmiss) then if(nolimb) then sum(ii,jj,k,n)=sum(ii,jj,k,n)+tb(1,k) sumsq(ii,jj,k,n)=sumsq(ii,jj,k,n)+(tb(1,k))**2 icnt(ii,jj,k,n)=icnt(ii,jj,k,n)+1 else if(tblc(1,k) .ne. xmiss) then sum(ii,jj,k,n)=sum(ii,jj,k,n)+tblc(1,k) sumsq(ii,jj,k,n)=sumsq(ii,jj,k,n)+tblc(1,k)**2 icnt(ii,jj,k,n)=icnt(ii,jj,k,n)+1 endif endif endif else if(ref .ge. 0 .and. ref .lt. 2.54) then sum(ii,jj,k,n)=sum(ii,jj,k,n)+ref sumsq(ii,jj,k,n)=sumsq(ii,jj,k,n)+ref**2 icnt(ii,jj,k,n)=icnt(ii,jj,k,n)+1 endif endif enddo endif irec=irec+1 prvn=n prvtime=itime prvlon=xlon prvline=line goto 60 99 close(1) 98 write(*,*) 'Read ',irec,' records in ',day_file return end