Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / convertor / kma_wave2grid / LGNDR1.inc
blob88e9df778d7db75eb983ca834ad20b6b2ec21d48
1       SUBROUTINE LGNDR1(COA,MFP,ALP,DALP)                                       
2 C                                                                               
3 Crizvi      DIMENSION ALP(1),DALP(1)                                                  
4       DIMENSION ALP(*),DALP(*)                                                  
5 C                                                                               
6       SIA=SQRT(1.D0-COA*COA)                                                    
7       LM=2                                                                      
8       LMD=1                                                                     
9       ALP(1)=1.D0                                                               
10       F1M=SQRT(3.0D0)                                                           
11       ALP(2)=F1M*COA                                                            
12       DALP(1)=0.D0                                                              
13       DO 1 M1=1,MFP                                                             
14       M=M1-1                                                                    
15       AM=M                                                                      
16       A2M=M+M                                                                   
17       RE1=SQRT(A2M+3.D0)                                                        
18       E1=1.D0/RE1                                                               
19       IF(M.EQ.0) GO TO 3                                                        
20       F2M=F1M*SIA/SQRT(A2M)                                                     
21       F1M=F2M*RE1                                                               
22       LM=LM+1                                                                   
23       ALP(LM)=F2M                                                               
24       IF(M1.NE.MFP) GO TO 2                                                     
25       LMD=LMD+1                                                                 
26       DALP(LMD)=AM*E1*F1M*COA                                                   
27       GO TO 1                                                                   
28     2 LM=LM+1                                                                   
29       ALP(LM)=F1M*COA                                                           
30       LMD=LMD+1                                                                 
31       DALP(LMD)=AM*E1*ALP(LM)                                                   
32     3 M2=M+2                                                                    
33 *vdir NOVEC
34       DO 4 N=M2,MFP                                                             
35       AN=N                                                                      
36       AN2=N*N                                                                   
37       E2=SQRT((4.D0*AN2-1.D0)/(AN2-AM*AM))                                      
38       LM=LM+1                                                                   
39       ALP(LM)=E2*(COA*ALP(LM-1)-E1*ALP(LM-2))                                   
40       E2=1.D0/E2                                                                
41       LMD=LMD+1                                                                 
42       DALP(LMD)=(AN-1.D0)*E2*ALP(LM)-AN*E1*ALP(LM-2)                            
43       E1=E2                                                                     
44     4 CONTINUE                                                                  
45       LM =LM -1                                                                 
46     1 CONTINUE                                                                  
47       RETURN                                                                    
48       END SUBROUTINE LGNDR1