!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer, 
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms 
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer 
!version 3 or (at your option) any later version that should be found at: 
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html 
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software; 
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), 
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------

module v4dz 13
!
!author M.Tanguay 
!
!revision
! v3_00 - Tanguay M.        - initial MPI version
! v3_01 - Tanguay M.        - introduce gem2gauss for singular vectors
! v3_01 - Buehner M.        - external already_done
! v3_11 - M.Tanguay         - Add option for profiles done on U-V grids for winds 
!
!______________________________________________________________________
!                                                                      |
! VARIABLES ASSOCIATED with 4D-Var: EZSCINT sections                   |
!______________________________________________________________________|
!                    |                                                 |
! NAME               | DESCRIPTION                                     |
!--------------------|-------------------------------------------------|
! ax                 | X axe of INPUT Z grid                           |
! ay                 | Y axe of INPUT Z grid                           |
! cx                 | AX difference on INPUT Z grid                   |
! cy                 | AY difference on INPUT Z grid                   |
! wx                 | global Z grid weights proportional grid dist.   |
! cox                | local Z grid cos of x                           |
! six                | local Z grid sin of x                           |
! siy                | local z grid sin of y                           |
! axu                | X axe of INPUT U grid                           |
! ayv                | Y axe of INPUT V grid                           |
! cxu                | AX difference on INPUT U grid                   |
! cyv                | AY difference on INPUT V grid                   |
! wxu                | global U grid weights proportional grid dist.   |
! coxu               | local U grid cos of x                           |
! sixu               | local U grid sin of x                           |
! siyv               | local V grid sin of y                           |
! i1-i2              | Dimension x in INPUT grid                       |
! j1-j2              | Dimension y in INPUT grid                       |
! degree             | Degree of interpolation                         |
! grtypi             | Type of grid                                    |
!____________________|_________________________________________________|
!
 save
!
      integer V4dzgauss_ni,V4dzgauss_nj
!
!     ------------------------------
!     EZSCINT section (for profiles)
!     ------------------------------
      integer V4dz_i1,V4dz_i2,V4dz_j1,V4dz_j2,V4dz_degree
!
      real,   allocatable, dimension (:) :: V4dz_ax, V4dz_ay, V4dz_cx, V4dz_cy
      real,   allocatable, dimension (:) :: V4dz_axu,V4dz_ayv,V4dz_cxu,V4dz_cyv
!
      real*8, allocatable, dimension (:) :: V4dz_wx_8, V4dz_cox_8, V4dz_six_8, V4dz_siy_8
      real*8, allocatable, dimension (:) :: V4dz_wxu_8,V4dz_coxu_8,V4dz_sixu_8,V4dz_siyv_8
!
      character*1 V4dz_grtypi
!
!     -------------------------------
!     EZSCINT section (for gauss2gem)
!     -------------------------------
      integer V4dzga_i1,V4dzga_i2,V4dzga_j1,V4dzga_j2,V4dzga_degree,V4dzga_npts 
!
      real,   allocatable, dimension(:) ::V4dzga_ax,V4dzga_ay,V4dzga_cx,V4dzga_cy
      real,   pointer,     dimension(:) ::V4dzga_px,V4dzga_py
      real*8, allocatable, dimension(:) ::V4dzga_cox_8,V4dzga_six_8,V4dzga_siy_8,V4dzga_wx_8
!
      character*1 V4dzga_grtypi
!
      logical V4dzga_already_done_L
      data V4dzga_already_done_L /.false./
!
!     -------------------------------
!     EZSCINT section (for gem2gauss)
!     -------------------------------
      integer V4dzge_i1,V4dzge_i2,V4dzge_j1,V4dzge_j2,V4dzge_degree,V4dzge_npts 
!
      real,   allocatable, dimension(:) ::V4dzge_ax,V4dzge_ay,V4dzge_cx,V4dzge_cy
      real,   pointer,     dimension(:) ::V4dzge_px,V4dzge_py
      real*8, allocatable, dimension(:) ::V4dzge_cox_8,V4dzge_six_8,V4dzge_siy_8,V4dzge_wx_8
!
      character*1 V4dzge_grtypi
!
      logical V4dzge_already_done_L
      data V4dzge_already_done_L /.false./
!
end module v4dz