* file: test.f - last change: 9/6/93 (c) 1993 Arlindo da Silva * * Reads UWM/COADS files and prints portion of it on the * screen. This program demonstrates routine UWREAD. * parameter ( IDIM = 360, JDIM = 180, NDIM = IDIM * JDIM ) real A(idim,jdim) character*80 label, fname *........................................................................... print * print *, ' << Printing UWM-COADS Files >>' print * ccc print *, 'INPUT file name: ' ccc read(*,'(a80)') fname c Sample file provided; notice that it only has climatology c --------------------------------------------------------- fname = 'salinity.nc$' print *, fname(1:78) *........................................................................ c This means climatology! iyear = 0 ccc do 50 iyear = 45, 89 do 50 imon = 1, 12 print *, 'month = ', imon print *, 'year = ', iyear print * * Read Array * ---------- call UWREAD ( ier, A, idim, jdim, label, imon, iyear, fname ) if ( ier .ne. 0 ) then print *, 'Error on return from UWREAD: ier = ', ier call exit(1) end if ll = index ( label, '$' ) - 1 * Print portion of it on the screen * --------------------------------- call PUTOUT ( a, idim, jdim, label(1:ll) ) 50 continue stop end *........................................................................ subroutine PUTOUT ( a, idim, jdim, string ) real a(idim,jdim) character*(*) string * This subroutine prints a portion of the * input array, generally corresponding to the * North Atlantic. * * This routine is resolution dependent. data i1, i2, idel / 300, 360, 8 / data j1, j2, jdel / 170, 90, -4 / data iu / 6 / * Prints the array a * ------------------ write(iu,*) write(iu,*) string call PRARR ( a, idim, jdim, i1, i2, idel, j1, j2, jdel, iu) *** read * return end *...................................................................... subroutine PRARR ( a, idim, jdim, i1, i2, idel, j1, j2, jdel, iu) * This routine prints out an array. real a(idim,jdim) character*8 ac(360) parameter ( ALAND = -1. E 10, AMISS = +1. E 10 ) do 20 j = j1, j2, jdel do 10 i = i1, i2, idel if ( a(i,j) .eq. AMISS ) then ac(i) = ' M ' else if ( a(i,j) .eq. ALAND ) then ac(i) = ' L ' else write(ac(i),'(1pe8.1)') a(i,j) end if 10 continue write(iu,100) ( ac(i), i = i1, i2, idel ) 100 format(80(1x,a8)) 20 continue return end