Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / convertor / kma_wave2grid / W2GPXY.inc
blob356c4bb86219b566a6b1a4197180f6eb4d48d6a7
1       SUBROUTINE W2GPXY
2      I(MEND1,NEND1,JEND1,MNWAV,IMAX,JMAX,IMX ,JMAXHF,
3      I IFAX ,TRIGS,PNM  ,DPNM ,IPXY,IPSL,QPAI,
4      O GDAT ,
5      W GWRK)
7       DIMENSION QPAI(2,MNWAV)
9 c990408
10 c      DIMENSION IFAX(10),TRIGS(500)
11       DIMENSION IFAX(10),TRIGS(IMAX)
12 C...WARNING: THE DIMENSION OF GDAT,GWRK SHOULD BE .GE. IMX*JMAX*3
13 C            IMX=IMAX+2
14       DIMENSION GDAT(IMAX,JMAX,3) ,GWRK(IMAX,JMAX,3)
15       DIMENSION PNM (MNWAV,JMAXHF),DPNM(MNWAV,JMAXHF)
16 C...IPXY=1; OUTPUT OF THIS SUBR. IS  PS,D(PS)/DX,D(PS)/DY
17 C...     0;                          PS
19       CALL LGNW2G
20      I(MEND1,NEND1,JEND1,MNWAV,IMAX,JMAX,JMAXHF,   1,   1, PNM,QPAI,
21      O GDAT ,
22      W GWRK)
23       LOT=JMAX
24       IF(IPXY.EQ.1) THEN
25       CALL LGNW2G
26      I(MEND1,NEND1,JEND1,MNWAV,IMAX,JMAX,JMAXHF,   1,   0,DPNM,QPAI,
27      O GDAT(1,1,3),
28      W GWRK)
29       DO 100 J=1,JMAX
30       DO 100 M=1,MEND1
31       GDAT(2*M-1,J,2)=-FLOAT(M-1)*GDAT(2*M  ,J,1)
32       GDAT(2*M  ,J,2)=+FLOAT(M-1)*GDAT(2*M-1,J,1)
33   100 CONTINUE
34       DO 120 J=1,JMAX
35       DO 120 I=2*MEND1+1,IMAX
36       GDAT(I,J,2)=0.0
37       GDAT(I,J,3)=0.0
38   120 CONTINUE
39       LOT=JMAX*3
40       END IF
42       CALL FFT991(GDAT,TRIGS,IFAX,1,IMX,IMAX,LOT,1)
43 C     CALL FFT991(GDAT,GWRK,TRIGS,IFAX,1,IMX,IMAX,LOT,1)
45       IF(IPSL.EQ.1) THEN
46       DO 200 J=1,JMAX
47       DO 200 I=1,IMAX
48       X          =        EXP(GDAT(I,J,1))
49       GDAT(I,J,1)=X
50       GDAT(I,J,2)=GDAT(I,J,2)*X
51       GDAT(I,J,3)=GDAT(I,J,3)*X
52   200 CONTINUE
53       END IF
55       RETURN
56       END SUBROUTINE W2GPXY