Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / convertor / kma_wave2grid / RADF3M.inc
blob8d1d3c2cf1984b36040e45d558791ce39fc08d7e
1 C***********************************************************************
2       SUBROUTINE RADF3M (INC,LOT,IDO,L1,CC,CH,WA1,WA2)
3       DIMENSION  CH(INC,IDO,3,L1)  ,CC(INC,IDO,L1,3)  ,WA1(*)  ,WA2(*)
4       DATA TAUR,TAUI /-.5,.8660254037844390/
5       DO 101 K=1,L1
6 *VOPTION NOFVAL
7         DO 101 L=1,LOT
8           CR2           =       CC(L,1,K,2)+CC(L,1,K,3)
9           CH(L,  1,1,K) =       CC(L,1,K,1)+     CR2
10           CH(L,  1,3,K) = TAUI*(CC(L,1,K,3)-CC(L,1,K,2))
11           CH(L,IDO,2,K) =       CC(L,1,K,1)+TAUR*CR2
12   101   CONTINUE
13       IF (IDO .GT. 1) THEN
14           IDP2 = IDO+2
15         DO 103 K=1,L1
16 *VOPTION NOFVAL
17         DO 103 I=3,IDO,2
18             IC = IDP2-I
19 *VOPTION NOFVAL
20           DO 102 L=1,LOT
21             DR2 = WA1(I-2)*CC(L,I-1,K,2)+WA1(I-1)*CC(L,I  ,K,2)
22             DI2 = WA1(I-2)*CC(L,I  ,K,2)-WA1(I-1)*CC(L,I-1,K,2)
23             DR3 = WA2(I-2)*CC(L,I-1,K,3)+WA2(I-1)*CC(L,I  ,K,3)
24             DI3 = WA2(I-2)*CC(L,I  ,K,3)-WA2(I-1)*CC(L,I-1,K,3)
25             CR2            = DR2+DR3
26             CI2            = DI2+DI3
27             TR2            = CC(L,I-1,K,1)+TAUR*CR2
28             TI2            = CC(L,I  ,K,1)+TAUR*CI2
29             TR3            = TAUI*(DI2-DI3)
30             TI3            = TAUI*(DR3-DR2)
31             CH(L,I -1,1,K) = CC(L,I-1,K,1)+     CR2
32             CH(L,I   ,1,K) = CC(L,I  ,K,1)+     CI2
33             CH(L,IC-1,2,K) = TR2-TR3
34             CH(L,IC  ,2,K) = TI3-TI2
35             CH(L,I -1,3,K) = TR2+TR3
36             CH(L,I   ,3,K) = TI2+TI3
37   102     CONTINUE
38   103   CONTINUE
39       END IF
40       RETURN
41       END SUBROUTINE RADF3M