     program read_zeff 
     INTEGER                                       :: IM
     INTEGER                                       :: JM
     INTEGER                                       :: N,I,J
     REAL      , ALLOCATABLE, DIMENSION(:,:)       :: TEMP1,HGT,SM  
   
     WRITE(6,*) "INPUT IM, JM"
     READ(5,*)IM
     READ(5,*)JM
     ALLOCATE(TEMP1(IM,JM))
     ALLOCATE(HGT(IM,JM))
     ALLOCATE(SM(IM,JM))
     !    READ SEA-LAND MASK ETA-GRID
     write(6,*)IM,JM
     open(10,file='etatopo.dat',status='unknown',form='unformatted')
     READ(10) HGT,SM


!------------------ 
! READ Z0 EFFECTIVE
!------------------
     OPEN(UNIT=22, FILE='ZEFF', FORM='UNFORMATTED')
!
     DO N=1,4
       READ(22) TEMP1
       write(9000+N,*)"ZEFF Minimo:", MINVAL(TEMP1),"ZEFF Maximo:",MAXVAL(TEMP1)
       write(9000+N,*)"HGT Minimo:" , MINVAL(HGT)  ,"HGT Maximo:" ,MAXVAL(HGT)
       write(9000+N,*)"SM Minimo:"  , MINVAL(SM)   ,"SM Maximo:"  ,MAXVAL(SM)
       DO J=1,JM
          DO I=1,IM
             WRITE(9000+N,100)I,J,TEMP1(I,J),HGT(I,J),SM(I,J)
          END DO
       END DO
       close(9000+N)
     END DO
 100 format('I:',I3,' J:',I3,' ZEFF:',f12.7,' HGT:',f9.2,' SM:',f12.4)
     end program read_zeff 

