subroutine get_land_fraction(debug, line, elem, along_track_idx, across_track_idx, * land_cover, land_frc) c----------------------------------------------------------------------------------- c c Description: Calculate fraction of HIRS IFOV that is land or coast surface using c the PATMOS-X "packed_land_cover" 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 land_cover Land cover index from PATMOS-X data c c Output parameters: c land_frc Fraction of HIRS IFOV that is land or coast c c Revision history: 03/11 R. Frey Original version c c Calls None c c---------------------------------------------------------------------------------- implicit none save c---------------------------------------------------------------------------------- c Calling arguments. real*4 land_frc integer land_cover(409,15000) integer across_track_idx(100,56,1100), along_track_idx(100,56,1100) integer debug, line, elem c Local variables. integer lc, nlnd, ntot integer i, j, k c----------------------------------------------------------------------------------- c Get land cover indecis from collocated PATMOS-X data. nlnd = 0 ntot = 0 do i = 1, 100 j = along_track_idx(i,elem,line) k = across_track_idx(i,elem,line) lc = -1.0 if(j .ne. 0 .and. k .ne. 0) then lc = land_cover(k,j) if(lc .ge. 0 .and. lc .le. 7) then ntot = ntot + 1 if(lc .eq. 1 .or. lc .eq. 2 .or. lc .eq. 4) then nlnd = nlnd + 1.0 end if end if end if c---------------------------------------------------------------------------------- if(debug .gt. 1) then write(*,'(6i6)') i, j, k, lc, ntot, nlnd end if c---------------------------------------------------------------------------------- enddo c----------------------------------------------------------------------------------- c Calculate land fraction. if(ntot .gt. 0.0) then land_frc = real(nlnd) / real(ntot) else land_frc = -99.99 end if c----------------------------------------------------------------------------------- if(debug .gt. 0 .or. land_frc .eq. -99.99) then write(*,'(''Collocated AVHRR land fraction at line '', i5, '' and element '', * i5, '': '', f8.3)') line, elem, land_frc end if c----------------------------------------------------------------------------------- return end