c23456789012345678901234567890123456789012345678901234567890123456789012


      SUBROUTINE A_zonxx(opt) 

c     ******************************************************************
c
c     This routine constructs the matrix A of the linear system Ax=b
c     corresponding to the constraints on integrated meridional transport  
c     at different latitudes
c
c     ******************************************************************

c     -------------
c     Declarations
c     -------------

c     ''''''''''''''''''''''
      implicit none
      include 'commonvar.f'      
c     ''''''''''''''''''''''

c---- Argument variable

      character	opt*5


c---- Local variables

      integer	j,n

      character*12 string0




c     --------------------------------
c     Matrix A for 3-degree resolution
c     --------------------------------

c---- Test

c++
      if (opt.eq.'AT003') then
c++


c---- Number of zonal constraints

      n_zon = 3


c---- Matrix

c--
      do j=1,n_zon
      do n=1,n_o
c--

         A_zon(j,n) = 0.d0
         string0    = string(n)

         if (j.eq.1) then	! Constraint at 32S 
           if (string0(01:02).eq.'VV' .and.
     >	       string0(07:08).eq.'05') then
               A_zon(j,n) = 1.d0
           endif
         endif

         if (j.eq.2) then       ! Constraint at 24N 
           if (string0(01:02).eq.'VV' .and.
     >         string0(07:08).eq.'24') then
               A_zon(j,n) = 1.d0
           endif
         endif
 
         if (j.eq.3) then       ! Constraint at 36N
           if (string0(01:02).eq.'VV' .and.
     >         string0(07:08).eq.'28') then
               A_zon(j,n) = 1.d0
           endif
         endif


c--
      enddo
      enddo
c--


c---- End of test

c++
      endif
c++




c     --------------------------------
c     Matrix A for 2-degree resolution
c     --------------------------------

c---- Test

c++
      if (opt.eq.'AT002') then
c++


c---- Number of zonal constraints

      n_zon = 3


c---- Matrix

c--
      do j=1,n_zon
      do n=1,n_o
c--

         A_zon(j,n) = 0.d0
         string0    = string(n)

         if (j.eq.1) then       ! Constraint at 32S 
           if (string0(01:02).eq.'VV' .and.
     >         string0(07:08).eq.'08') then
               A_zon(j,n) = 1.d0
           endif
         endif

         if (j.eq.2) then       ! Constraint at 24N 
           if (string0(01:02).eq.'VV' .and.
     >         string0(07:08).eq.'36') then
               A_zon(j,n) = 1.d0
           endif
         endif
 
         if (j.eq.3) then       ! Constraint at 36N
           if (string0(01:02).eq.'VV' .and.
     >         string0(07:08).eq.'42') then
               A_zon(j,n) = 1.d0
           endif
         endif


c--
      enddo
      enddo
c--


c---- End of test

c++
      endif
c++




c     --------------------------
c     Test if iflag=2 or iflag=3
c     --------------------------

      if (iflag.eq.2 .or. iflag.eq.3) then

         n_zon = 0

         do j=1,jtot+1
         do n=1,idim_n_o
            A_zon(j,n) = 0.d0
         enddo
         enddo

      endif




c     -------------------
c     End of the routine
c     -------------------

      return

      end

c     ******************************************************************

