c================================================================================ c c NAME: horb c c PURPOSE: Quality control subroutine for the HIRS scan line data. Uses statistics c derived from the orbit mean files to assess the quality of the data c from the given orbit. c c INPUTS: c head(trec).....................header record (int) c ioq............................file number c qcmn(nchn,nsat,nyr,nmon).......mean value c qcsd(nchn,nsat,nyr,nmon).......standard deviation c qcct(nchn,nsat,nyr,nmon).......number of orbits c c OUTPUT: c oqc............................orbit quality control flag (byte) c = 0 to 40 with 0 being best data and 40 the worst. c Weight is applied to each channel. c 0 -> inside 1 std c 1 -> 2 std > x > 1 std c 2 -> > 2 std c = 99 -> No log file found c = 98 -> No match orbit statistics in log file c = 97 -> No monthly mean statistics computed c NOTES: c Currently not used in processing code for version 2.2 c c HISTORY: Darren Jackson CIRES/ETL April 2002 c c====================================================================================== subroutine horb(head,ioq,qcmn,qcsd,qcct,oqc) implicit none include 'hirs_1c.inc' integer oqc integer ierr,iyr2,iyr4,idy,jdy,isat,isec,ichn,ioq,imn integer head(trec),iyr79,isat2 integer yr,dy,es,bss integer qcct(nchn2,nsat,nyr,nmon) integer qcmn(nchn2,nsat,nyr,nmon),qcsd(nchn2,nsat,nyr,nmon) real me,sd,mn,mx,adiff,scale oqc=0 scale=10000. c c* identify satellite, year, and julian day from header c iyr2=nint(head(1)/1000.) iyr4=iyr2+1900 jdy=head(1)-(iyr2*1000.) isat=head(5) isec=nint(head(50)/1000.)+1500 ! add 1500 seconds to start time c c* Indices dependent on qcmn and qcsd array structure c iyr79=iyr2-78 ! Assumes qcmn starts in 1979 isat2=isat-5 ! Assumes satellite id starts with NOAA-6 c c* find month number c call julian2(jdy,iyr4,imn,idy) c c* Open log file c do 20 ichn=1,nchn2 c c* Check for missing QC data in monthly mean file c if(qcmn(ichn,isat2,iyr79,imn)/scale .eq. 0. .or. . qcsd(ichn,isat2,iyr79,imn)/scale .eq. 0.) then oqc=97 ! no QC monthly data for 1 or more IR channels return endif c c* Open log file c call open_orb(ioq,isat,iyr2,ichn,ierr) if(ierr .ne. 0) then oqc=99 ! no log file found return endif c c* Apply QC histogram flag c 30 read(ioq,*,end=99) yr,dy,bss,es,me,sd,mn,mx if(es .gt. 86400) es=es+86400 if(dy .eq. jdy .and. . isec .ge. bss .and. isec .le. es) then adiff=abs(me-qcmn(ichn,isat2,iyr79,imn)/scale) c sdiff=abs(sd-qcsd(ichn,isat2,iyr79,imn)/scale) c tdiff=tdiff+adiff+sdiff if(adiff .gt. qcsd(ichn,isat2,iyr79,imn)/scale) . then oqc=oqc+1 if(adiff .gt. 2.*qcsd(ichn,isat2,iyr79,imn)/scale) then oqc=oqc+2 endif endif close(ioq) goto 20 endif goto 30 99 oqc=98 ! No matching orbit in file close(ioq) return 20 continue return end