subroutine get_cloud_waterphase_fraction(debug, line, elem, along_track_idx, * across_track_idx, cloud_phase, * wtrcld_frc) c----------------------------------------------------------------------------------- c c Description: Calculate fraction of HIRS IFOV that is covered by water clouds c according to the PATMOS-X "cloud_phase" data set. c c Input parameters: c debug Debug write flag c line HIRS line number (1-1100) c elem HIRS pixel number (1-56) c along_track_idx AVHRR scan line numbers of collocated pixels c across_track_idx AVHRR element numbers of collocated pixels c cloud_phase AVHRR cloud phase index from PATMOS-X data c c Output parameters: c wtrcld_frc Fraction of HIRS IFOV that is covered by water clouds c c Revision history: 12/13 R. Frey Original version c c Calls None c c---------------------------------------------------------------------------------- implicit none save c---------------------------------------------------------------------------------- c Calling arguments. real*4 wtrcld_frc integer cloud_phase(409,15000) integer across_track_idx(100,56,1100), along_track_idx(100,56,1100) integer debug, line, elem c Local variables. integer wtr, ntot, nwtr integer i, j, k c----------------------------------------------------------------------------------- c Get land cover indecis from collocated PATMOS-X data. nwtr = 0 ntot = 0 do i = 1, 100 j = along_track_idx(i,elem,line) k = across_track_idx(i,elem,line) wtr = -1.0 if(j .ne. 0 .and. k .ne. 0) then wtr = cloud_phase(k,j) if(wtr .ge. 1 .and. wtr .le. 5) then ntot = ntot + 1 if(wtr .eq. 1) then nwtr = nwtr + 1.0 end if end if end if c---------------------------------------------------------------------------------- if(debug .gt. 1) then write(*,'(6i6)') i, j, k, wtr, ntot, nwtr end if c---------------------------------------------------------------------------------- enddo c----------------------------------------------------------------------------------- c Calculate land fraction. if(ntot .gt. 0.0) then wtrcld_frc = real(nwtr) / real(ntot) else wtrcld_frc = -99.99 end if c----------------------------------------------------------------------------------- if(debug .gt. 0) then write(*,'(''Collocated AVHRR water cloud fraction at line '', i5, '' and element '', * i5, '': '', f8.3)') line, elem, wtrcld_frc end if c----------------------------------------------------------------------------------- return end