1 | SUBROUTINE qgrhal (prho2, k1to2, kwg2, |
---|
2 | $ px2, py2, kmsk2, kngx2, kngy2, |
---|
3 | $ px1, py1, kmsk1, kngx1, kngy1, |
---|
4 | $ ps12, kvma1, kvma2) |
---|
5 | C**** |
---|
6 | C ***************************** |
---|
7 | C * OASIS ROUTINE - LEVEL 3 * |
---|
8 | C * ------------- ------- * |
---|
9 | C ***************************** |
---|
10 | C |
---|
11 | C**** *qgrhal* - Calculate weights and adresses for all the target grid |
---|
12 | C |
---|
13 | C Purpose: |
---|
14 | C ------- |
---|
15 | C For each point of a target grid 2 give the lpwg2 nearest neighbours |
---|
16 | C adresses k1to2 in source grid 1 and their weight which is function of |
---|
17 | C the distance and maybe other grid dependant considerations. |
---|
18 | C |
---|
19 | C N.B : the calculation is done only over unmasked points |
---|
20 | C |
---|
21 | C** Interface: |
---|
22 | C --------- |
---|
23 | C *CALL* *qgrhal (prho2, k1to2, kwg2, |
---|
24 | C px2, py2, kmsk2, kngx2, kngy2, |
---|
25 | C px1, py1, kmsk1, kngx1, kngy1, |
---|
26 | C ps12, kvma1, kvma2)* |
---|
27 | C |
---|
28 | C Input: |
---|
29 | C ----- |
---|
30 | C kwg2 : maximum number of nearest neighbors |
---|
31 | C px1 : longitudes for source grid (real 2D) |
---|
32 | C py1 : latitudes for source grid (real 2D) |
---|
33 | C kmsk1 : the mask for source grid (integer 2D) |
---|
34 | C kngx1 : number of longitudes for source grid |
---|
35 | C kngy1 : number of latitudes for source grid |
---|
36 | C px2 : longitudes for target grid (real 2D) |
---|
37 | C py2 : latitudes for target grid (real 2D) |
---|
38 | C kmsk2 : the mask of target grid (integer 2D) |
---|
39 | C kngx2 : number of longitudes for target grid |
---|
40 | C kngy2 : number of latitudes for target grid |
---|
41 | C ps12 : gaussian variance |
---|
42 | C kvma1 : the value of the mask for source grid |
---|
43 | C kvma2 : the value of the mask for target grid |
---|
44 | C |
---|
45 | C Output: |
---|
46 | C ------ |
---|
47 | C prho2 : weights for Anaism interpolation (real 3D) |
---|
48 | C k1to2 : source grid neighbors adresses (integer 3D) |
---|
49 | C |
---|
50 | C Workspace: |
---|
51 | C --------- |
---|
52 | C None |
---|
53 | C |
---|
54 | C External: |
---|
55 | C -------- |
---|
56 | C qgrho: to calculate the weights and adresses at one point |
---|
57 | C |
---|
58 | C References: |
---|
59 | C ---------- |
---|
60 | C O. Thual, Simple ocean-atmosphere interpolation. |
---|
61 | C Part A: The method, Epicoa 0629 (1992) |
---|
62 | C Part B: Software implementation, Epicoa 0630 (1992) |
---|
63 | C See also OASIS manual (1995) |
---|
64 | C |
---|
65 | C History: |
---|
66 | C ------- |
---|
67 | C Version Programmer Date Description |
---|
68 | C ------- ---------- ---- ----------- |
---|
69 | C 1.0 O. Thual 93/04/15 created |
---|
70 | C 1.1 E. Guilyardi 93/11/23 modified |
---|
71 | C 2.0 L. Terray 95/10/01 modified: new structure |
---|
72 | C |
---|
73 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
74 | C |
---|
75 | C* ---------------------------- Include files --------------------------- |
---|
76 | C |
---|
77 | USE mod_kinds_oasis |
---|
78 | USE mod_unit |
---|
79 | C |
---|
80 | C* ---------------------------- Argument declarations ------------------- |
---|
81 | C |
---|
82 | REAL (kind=ip_realwp_p) prho2(kwg2,kngx2,kngy2) |
---|
83 | REAL (kind=ip_realwp_p) px1(kngx1,kngy1), py1(kngx1,kngy1) |
---|
84 | REAL (kind=ip_realwp_p) px2(kngx2,kngy2), py2(kngx2,kngy2) |
---|
85 | INTEGER (kind=ip_intwp_p) kmsk1(kngx1,kngy1), kmsk2(kngx2,kngy2) |
---|
86 | INTEGER (kind=ip_intwp_p) k1to2(kwg2,kngx2,kngy2) |
---|
87 | C |
---|
88 | C* ---------------------------- Poema verses ---------------------------- |
---|
89 | C |
---|
90 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
91 | C |
---|
92 | C* 1. Neighbours determination |
---|
93 | C ------------------------ |
---|
94 | C |
---|
95 | DO 110 j2 = 1, kngy2 |
---|
96 | DO 120 j1 = 1, kngx2 |
---|
97 | C |
---|
98 | C* For all target grid points: zero all weights and set adresses to one |
---|
99 | C |
---|
100 | DO 130 jwg = 1, kwg2 |
---|
101 | prho2(jwg,j1,j2) = 0. |
---|
102 | k1to2(jwg,j1,j2) = 1 |
---|
103 | 130 CONTINUE |
---|
104 | C |
---|
105 | C* Calculate weights for unmasked points |
---|
106 | C |
---|
107 | IF (kmsk2(j1,j2) .NE. kvma2) THEN |
---|
108 | CALL qgrho (prho2(1,j1,j2), k1to2(1,j1,j2), kwg2, |
---|
109 | $ px2(j1,j2), py2(j1,j2), |
---|
110 | $ px1, py1, kmsk1, kngx1, kngy1, |
---|
111 | $ ps12, kvma1) |
---|
112 | ENDIF |
---|
113 | 120 CONTINUE |
---|
114 | 110 CONTINUE |
---|
115 | C |
---|
116 | C* End of routine |
---|
117 | C |
---|
118 | RETURN |
---|
119 | END |
---|