c23456789012345678901234567890123456789012345678901234567890123456789012


      SUBROUTINE wocexxx(opt)

c     ******************************************************************
c
c     This routine reads gridded densities and errors from WOCE dataset 
c
c     ******************************************************************

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

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

c--   Argument variables

      character	opt*4


c--   Internal variables

      integer	i,j,k





c     --------------------------------------------------------
c     Read - gridded densities           from WOCE climatology
c          - gridded density fluxes from WOCE climatology
c
c     Note
c     ----
c     Files 'r_woce.d'   has been produced from another program 
c           'F_r_woce.d' has been produced from another program 
c     ---------------------------------------------------------

c---- Test

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


c---- Gridded densities 

      open (50,file='r_woce.d',status='old')

      do k=ktot+1,1,-1

         read(50,*)
         read(50,*) 
         read(50,*)
         do j=jtot+1,1,-1
            read(50,*) (r(i,j,k),i=1,itot+1)
         enddo

      enddo

      close (50)


c---- Gridded vertical turbulent diffusive density fluxes

      open (50,file='F_r_woce.d',status='old')

      do k=ktot+1,1,-1

         read(50,*)
         read(50,*) 
         read(50,*)
         do j=jtot,1,-1
            read(50,*) (F_r(i,j,k),i=1,itot)
         enddo

      enddo

      close (50)


c---- End of test

c     ++++++
      endif
c     ++++++




c     --------------------------------------------------------
c     Read gridded density errors from WOCE climatology
c
c     Note
c     ----
c     File 'e_r_woce.d' has been produced from another program 
c     --------------------------------------------------------

c---- Test

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


c---- Read

      open (50,file='e_r_woce.d',status='old')

      do k=ktot+1,1,-1

         read(50,*)
         read(50,*)
         read(50,*)
         do j=jtot+1,1,-1
            read(50,*) (e_r(i,j,k),i=1,itot+1)
         enddo

      enddo

      close (50)


c---- End of test

c     ++++++
      endif
c     ++++++




c     ---------------------------------------------------------
c     Read - gridded PO4        from WOCE climatology
c          - gridded PO4 fluxes from WOCE climatology
c
c     Note
c     ----
c     Files 'p_woce.d'   has been produced from another program
c           'F_p_woce.d' has been produced from another program 
c     ---------------------------------------------------------

c---- Test

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


c---- Gridded PO4 

      open (50,file='p_woce.d',status='old')

      do k=ktot+1,1,-1

         read(50,*)
         read(50,*) 
         read(50,*)
         do j=jtot+1,1,-1
            read(50,*) (p(i,j,k),i=1,itot+1)
         enddo

      enddo

      close (50)


c---- Gridded vertical turbulent diffusive PO4 fluxes

      open (50,file='F_p_woce.d',status='old')

      do k=ktot+1,1,-1

         read(50,*)
         read(50,*)
         read(50,*)
         do j=jtot,1,-1
            read(50,*) (F_p(i,j,k),i=1,itot)
         enddo

      enddo

      close (50)


c---- End of test

c     ++++++
      endif
c     ++++++




c     --------------------------------------------------------
c     Read gridded PO4 errors from WOCE climatology
c
c     Note
c     ----
c     File 'e_p_woce.d' has been produced from another program 
c     --------------------------------------------------------

c---- Test

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


c---- Read

      open (50,file='e_p_woce.d',status='old')

      do k=ktot+1,1,-1

         read(50,*)
         read(50,*)
         read(50,*)
         do j=jtot+1,1,-1
            read(50,*) (e_p(i,j,k),i=1,itot+1)
         enddo

      enddo

      close (50)


c---- End of test

c     ++++++
      endif
c     ++++++




c     ----------------------
c     End of the subroutine
c     ----------------------

      return

      end

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