!-------------------------------------- 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 --------------------------------------
!
!
! X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
!
subroutine uv_acg2g_ez(putgrd,pvtgrd,pusgrd,pvsgrd,cdtrans) 1,3
!
!**s/r uv_acg2g_ez - Transform wind field (u,v) on scalar grid to
! Arakawa C grid using EZSCINT package. Reverse
! not coded yet
!
! Author : J-F Caron - ARMA/EC- 12 June 2008.
! Revision:
!
! -------------------
!
! Arguments
! in usgrd : Input U-field on Source grid.
! in vsgrd : Input V-field on Source grid.
! in cdtrans : S2A to go from S to Arakawa grid.
! A2S to go from Arakawa grid to S grid. (not coded)
! out utgrd : Output U-field on Target grid.
! out vtgrd : Output V-field on Target grid.
!
implicit none
#include "taglam4d.cdk"
#include "comct0.cdk"
#include "pardim.cdk"
#include "comdim.cdk"
#include "comgemla.cdk"
#include "comlun.cdk"
#include "comgrd_param.cdk"
#include "comgrd.cdk"
!
character*3 cdtrans
real*8 pusgrd(ni,nflev,nj)
real*8 pvsgrd(ni,nflev,nj)
real*8 putgrd(ni,nflev,nj)
real*8 pvtgrd(ni,nflev,nj)
real pusgrd2d(ni,nj)
real pvsgrd2d(ni,nj)
real zx8(ni),zy8(nj)
!
integer ji,jj,jk,nulout
integer idim,ier,lgdidla,ezqkdef,ezgdef_fmem,gdxyvval
real zuuout,zvvout,zscrap
real x,y
!
idim = ni*nflev*nj
call zero
(idim,putgrd)
call zero
(idim,pvtgrd)
!
c Warning: EZSCINT doesn't support real*8 for now. Use real instead
!
do ji=1,ni
zx8(ji)=grd_x_8(ji)
enddo
do jj=1,nj
zy8(jj)=grd_y_8(jj)
enddo
lgdidla = ezgdef_fmem(ni, nj ,'Z','E',mig1tic, mig2tic, mig3tic,
$ mig4tic, zx8, zy8)
c --------------------------------
c 1. Scalar Grid to Arakawa-C grid
c --------------------------------
if (cdtrans.eq.'S2A') then
do jk=1,nflev
do jj=1,nj
do ji=1,ni
pusgrd2d(ji,jj)=pusgrd(ji,jk,jj)
pvsgrd2d(ji,jj)=pvsgrd(ji,jk,jj)
enddo
enddo
c U-Grid (moved half grid point to the right of S-grid)
do jj=1,nj
do ji=1,ni-1
x = (float(ji)+0.5)
y = float(jj)
ier = gdxyvval(lgdidla, zuuout, zscrap, pusgrd2d, pvsgrd2d,
$ x, y , 1)
putgrd(ji,jk,jj) = zuuout
enddo
enddo
c V-Grid (moved half grid point upward of S-grid)
do jj=1,nj-1
do ji=1,ni
x = float(ji)
y = (float(jj)+0.5)
ier = gdxyvval(lgdidla, zscrap, zvvout, pusgrd2d, pvsgrd2d,
$ x, y, 1)
pvtgrd(ji,jk,jj) = zvvout
enddo
enddo
enddo
else
call abort3d
(nulout,'uv_acg2g_ez: Wrong Option')
endif
!
return
end