subroutine get_avhrr_ctp(debug, line, elem, along_track_idx, across_track_idx, * avhrr_ctp, mean_avhrr_ctp) c----------------------------------------------------------------------------------- c c Description: Calculate mean of all collocated AVHRR cloud top pressure values c in the current HIRS IFOV. 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 avhrr_ctp AVHRR cloud top pressures from PATMOS-x data c c Output parameters: c mean_avhrr_cpt Mean of collocated AVHRR cloud top pressures c c Revision history: 03/14 R. Frey Original version c c Calls None c c---------------------------------------------------------------------------------- implicit none save c---------------------------------------------------------------------------------- c Calling arguments. real*4 avhrr_ctp(409, 15000), mean_avhrr_ctp integer across_track_idx(100,56,1100), along_track_idx(100,56,1100) integer debug, line, elem c Local variables. real ctpsum integer ntot integer i, j, k c----------------------------------------------------------------------------------- c Get land cover indecis from collocated PATMOS-X data. ntot = 0 ctpsum = 0.0 do i = 1, 100 j = along_track_idx(i,elem,line) k = across_track_idx(i,elem,line) if(j .ne. 0 .and. k .ne. 0) then if(avhrr_ctp(k,j) .gt. 0.0) then ctpsum = ctpsum + avhrr_ctp(k,j) ntot = ntot + 1 if(debug .gt. 1) then write(*,'(4i6,2f12.3)') i, j, k, ntot, avhrr_ctp(k,j), ctpsum end if end if end if c---------------------------------------------------------------------------------- enddo c----------------------------------------------------------------------------------- c Calculate mean cloud top pressure. if(ntot .gt. 0.0) then mean_avhrr_ctp = ctpsum / ntot else mean_avhrr_ctp = -99.99 end if c----------------------------------------------------------------------------------- if(debug .gt. 0 .or. mean_avhrr_ctp .eq. -99.99) then write(*,'(''Collocated AVHRR CTP at line '', i5, '' and element '', * i5, '': '', f8.3)') line, elem, mean_avhrr_ctp end if c----------------------------------------------------------------------------------- return end