Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / convertor / wave2grid_kma / LT2GAU.inc
bloba67b2cd4df7eabf04f8f58f45d640abe3eeeb5b7
1       SUBROUTINE LT2GAU                                          
2      &(EDATA,IMAXE,JMAXE,IMAXG,JMAXG,COLRAD,                    
3      & GDATA,DY,LY)                                            
4 C                                                             
5       DIMENSION EDATA(IMAXE,JMAXE),GDATA(IMAXG,JMAXG)        
6       DIMENSION DY(JMAXG),LY(JMAXG)                         
7       DIMENSION COLRAD(*)                                  
8       LOGICAL FIRST
9       DATA FIRST/.TRUE./
10       SAVE
11 CCH      LOGICAL FIRST/.TRUE./                            
12 C                                                        
13       IF(FIRST) THEN                                    
14       FIRST =.FALSE.                                   
15       PAI2  =8.0*ATAN(1.0)                            
16       DLONE =PAI2/FLOAT(IMAXE)                       
17       DLONG =PAI2/FLOAT(IMAXG)                     
18       DLONEI=1.0/DLONE                            
19       CNVG2E=DLONG*DLONEI                       
20 C                                              
21       DO 100 JG=1,JMAXG                                               
22       DO 100 JE=1,JMAXE                                              
23       FLATE=FLOAT(JE-1)*DLONE                                       
24       IF(COLRAD(JG).GE.FLATE) THEN                                 
25       LY(JG)=JE                                                  
26       DY(JG)=(COLRAD(JG)-FLATE)*DLONEI                          
27       END IF                                                   
28   100 CONTINUE                                                
29 C                                                            
30       END IF                                                
31 C                                                          
32       DO 200 JG=1,JMAXG                                   
33       JE=LY(JG)                                                        
34       FY=DY(JG)                                                       
35       DO 200 IG=1,IMAXG                                              
36       FLONG =FLOAT(IG-1)*CNVG2E                                     
37       IE    =INT(FLONG)+1                                          
38       IEP1  =IE+1                                                 
39       IF(IE.EQ.IMAXE) IEP1=1                                     
40       FX    =FLONG-FLOAT(IE-1)                                  
41       GDATA(IG,JG)=(1.0-FX)*(1.0-FY)*EDATA(IE  ,JE  )          
42      &            +     FX *(1.0-FY)*EDATA(IEP1,JE  )         
43      &            +     FX *     FY *EDATA(IEP1,JE+1)        
44      &            +(1.0-FX)*     FY *EDATA(IE  ,JE+1)       
45   200 CONTINUE                                             
46 C                                                         
47 C                                                        
48       RETURN                                           
49       END SUBROUTINE LT2GAU