Oasis3 4.0.2
|
00001 SUBROUTINE qgrhal (prho2, k1to2, kwg2, 00002 $ px2, py2, kmsk2, kngx2, kngy2, 00003 $ px1, py1, kmsk1, kngx1, kngy1, 00004 $ ps12, kvma1, kvma2) 00005 C**** 00006 C ***************************** 00007 C * OASIS ROUTINE - LEVEL 3 * 00008 C * ------------- ------- * 00009 C ***************************** 00010 C 00011 C**** *qgrhal* - Calculate weights and adresses for all the target grid 00012 C 00013 C Purpose: 00014 C ------- 00015 C For each point of a target grid 2 give the lpwg2 nearest neighbours 00016 C adresses k1to2 in source grid 1 and their weight which is function of 00017 C the distance and maybe other grid dependant considerations. 00018 C 00019 C N.B : the calculation is done only over unmasked points 00020 C 00021 C** Interface: 00022 C --------- 00023 C *CALL* *qgrhal (prho2, k1to2, kwg2, 00024 C px2, py2, kmsk2, kngx2, kngy2, 00025 C px1, py1, kmsk1, kngx1, kngy1, 00026 C ps12, kvma1, kvma2)* 00027 C 00028 C Input: 00029 C ----- 00030 C kwg2 : maximum number of nearest neighbors 00031 C px1 : longitudes for source grid (real 2D) 00032 C py1 : latitudes for source grid (real 2D) 00033 C kmsk1 : the mask for source grid (integer 2D) 00034 C kngx1 : number of longitudes for source grid 00035 C kngy1 : number of latitudes for source grid 00036 C px2 : longitudes for target grid (real 2D) 00037 C py2 : latitudes for target grid (real 2D) 00038 C kmsk2 : the mask of target grid (integer 2D) 00039 C kngx2 : number of longitudes for target grid 00040 C kngy2 : number of latitudes for target grid 00041 C ps12 : gaussian variance 00042 C kvma1 : the value of the mask for source grid 00043 C kvma2 : the value of the mask for target grid 00044 C 00045 C Output: 00046 C ------ 00047 C prho2 : weights for Anaism interpolation (real 3D) 00048 C k1to2 : source grid neighbors adresses (integer 3D) 00049 C 00050 C Workspace: 00051 C --------- 00052 C None 00053 C 00054 C External: 00055 C -------- 00056 C qgrho: to calculate the weights and adresses at one point 00057 C 00058 C References: 00059 C ---------- 00060 C O. Thual, Simple ocean-atmosphere interpolation. 00061 C Part A: The method, Epicoa 0629 (1992) 00062 C Part B: Software implementation, Epicoa 0630 (1992) 00063 C See also OASIS manual (1995) 00064 C 00065 C History: 00066 C ------- 00067 C Version Programmer Date Description 00068 C ------- ---------- ---- ----------- 00069 C 1.0 O. Thual 93/04/15 created 00070 C 1.1 E. Guilyardi 93/11/23 modified 00071 C 2.0 L. Terray 95/10/01 modified: new structure 00072 C 00073 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00074 C 00075 C* ---------------------------- Include files --------------------------- 00076 C 00077 USE mod_printing 00078 USE mod_unit 00079 C 00080 C* ---------------------------- Argument declarations ------------------- 00081 C 00082 REAL (kind=ip_realwp_p) prho2(kwg2,kngx2,kngy2) 00083 REAL (kind=ip_realwp_p) px1(kngx1,kngy1), py1(kngx1,kngy1) 00084 REAL (kind=ip_realwp_p) px2(kngx2,kngy2), py2(kngx2,kngy2) 00085 INTEGER (kind=ip_intwp_p) kmsk1(kngx1,kngy1), kmsk2(kngx2,kngy2) 00086 INTEGER (kind=ip_intwp_p) k1to2(kwg2,kngx2,kngy2) 00087 C 00088 C* ---------------------------- Poema verses ---------------------------- 00089 C 00090 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00091 C 00092 IF (nlogprt .GE. 2) THEN 00093 WRITE(nulou,*) '******* Entering ROUTINE qgrhal ******* ' 00094 CALL FLUSH(nulou) 00095 ENDIF 00096 C 00097 C* 1. Neighbours determination 00098 C ------------------------ 00099 C 00100 DO 110 j2 = 1, kngy2 00101 DO 120 j1 = 1, kngx2 00102 C 00103 C* For all target grid points: zero all weights and set adresses to one 00104 C 00105 DO 130 jwg = 1, kwg2 00106 prho2(jwg,j1,j2) = 0. 00107 k1to2(jwg,j1,j2) = 1 00108 130 CONTINUE 00109 C 00110 C* Calculate weights for unmasked points 00111 C 00112 IF (kmsk2(j1,j2) .NE. kvma2) THEN 00113 CALL qgrho (prho2(1,j1,j2), k1to2(1,j1,j2), kwg2, 00114 $ px2(j1,j2), py2(j1,j2), 00115 $ px1, py1, kmsk1, kngx1, kngy1, 00116 $ ps12, kvma1) 00117 ENDIF 00118 120 CONTINUE 00119 110 CONTINUE 00120 C 00121 IF (nlogprt .GE. 2) THEN 00122 WRITE(nulou,*) '******* Leaving ROUTINE qgrhal ******* ' 00123 CALL FLUSH(nulou) 00124 ENDIF 00125 C 00126 C* End of routine 00127 C 00128 RETURN 00129 END