1 | SUBROUTINE pmrhal (pr1to2, k1to2, kw1to2, |
---|
2 | $ px1, py1, kmsk1, kngx1, kngy1, cdper1, kper1, |
---|
3 | $ px2, py2, kmsk2, kngx2, kngy2, cdper2, kper2, |
---|
4 | $ kvma1, kvma2, kmskz2, kvmsz2) |
---|
5 | C**** |
---|
6 | C ***************************** |
---|
7 | C * OASIS ROUTINE - LEVEL 3 * |
---|
8 | C * ------------- ------- * |
---|
9 | C ***************************** |
---|
10 | C |
---|
11 | C**** *pmrhal* - 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 kw1to2 closest neighbours |
---|
16 | C adresses k1to2 in source grid 1 and their weight pr1to2. |
---|
17 | C Here, neighbours are those in the mesh overlapped by each target point |
---|
18 | C and weights are proportional to the surface mesh intersections. |
---|
19 | C 2D grid assumptions are made here. |
---|
20 | C |
---|
21 | C |
---|
22 | C** Interface: |
---|
23 | C --------- |
---|
24 | C *CALL* *pmrhal(pr1to2, k1to2, kw1to2, |
---|
25 | C px1, py1, kmsk1, kngx1, kngy1, cdper1, kper1, |
---|
26 | C px2, py2, kmsk2, kngx2, kngy2, cdper2, kper2, |
---|
27 | C kvma1, kvma2, kmskz2, kvmsz2)* |
---|
28 | C Input: |
---|
29 | C ----- |
---|
30 | C kw1to2 : maximum number of overlapped 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 cdper1 : source grid periodicity |
---|
37 | C kper1 : number of overlapped points for source grid |
---|
38 | C px2 : longitudes for target grid (real 2D) |
---|
39 | C py2 : latitudes for target grid (real 2D) |
---|
40 | C kmsk2 : the mask of target grid (integer 2D) |
---|
41 | C kngx2 : number of longitudes for target grid |
---|
42 | C kngy2 : number of latitudes for target grid |
---|
43 | C cdper2 : target grid periodicity |
---|
44 | C kper2 : number of overlapped points for target grid |
---|
45 | C kvma1 : the value of the mask for source grid |
---|
46 | C kvma2 : the value of the mask for target grid |
---|
47 | C kvmsz2 : mask value for array kmskz2 |
---|
48 | C |
---|
49 | C Output: |
---|
50 | C ------ |
---|
51 | C pr1to2 : weights for Anaism interpolation (real 3D) |
---|
52 | C k1to2 : source grid neighbors adresses (integer 3D) |
---|
53 | C kmskz2 : number of source grid neighbors (integer 2D) |
---|
54 | C |
---|
55 | C Workspace: |
---|
56 | C --------- |
---|
57 | C None |
---|
58 | C |
---|
59 | C External: |
---|
60 | C -------- |
---|
61 | C pmesh, pmrho |
---|
62 | C |
---|
63 | C References: |
---|
64 | C ---------- |
---|
65 | C O. Thual, Simple ocean-atmosphere interpolation. |
---|
66 | C Part A: The method, EPICOA 0629 (1992) |
---|
67 | C Part B: Software implementation, EPICOA 0630 (1992) |
---|
68 | C See also OASIS manual (1995) |
---|
69 | C |
---|
70 | C History: |
---|
71 | C ------- |
---|
72 | C Version Programmer Date Description |
---|
73 | C ------- ---------- ---- ----------- |
---|
74 | C 1.1 O. Thual 93/04/15 created |
---|
75 | C 2.0 L. Terray 95/10/01 modified: new structure |
---|
76 | C 2.3 L. Terray 99/09/15 changed periodicity variables |
---|
77 | C |
---|
78 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
79 | C |
---|
80 | C* ---------------------------- Include files --------------------------- |
---|
81 | C |
---|
82 | USE mod_kinds_oasis |
---|
83 | USE mod_unit |
---|
84 | C |
---|
85 | C* ---------------------------- Argument declarations ------------------- |
---|
86 | C |
---|
87 | REAL (kind=ip_realwp_p) px1(kngx1,kngy1), py1(kngx1,kngy1) |
---|
88 | REAL (kind=ip_realwp_p) px2(kngx2,kngy2), py2(kngx2,kngy2) |
---|
89 | REAL (kind=ip_realwp_p) pr1to2(kw1to2,kngx2,kngy2) |
---|
90 | INTEGER (kind=ip_intwp_p) kmsk1(kngx1,kngy1), kmsk2(kngx2,kngy2) |
---|
91 | INTEGER (kind=ip_intwp_p) k1to2(kw1to2,kngx2,kngy2), |
---|
92 | $ kmskz2(kngx2,kngy2) |
---|
93 | CHARACTER*8 cdper1, cdper2 |
---|
94 | C |
---|
95 | C* ---------------------------- Poema verses ---------------------------- |
---|
96 | C |
---|
97 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
98 | C |
---|
99 | C* 1. Neighbours determination |
---|
100 | C ------------------------ |
---|
101 | C |
---|
102 | DO 110 jy = 1, kngy2 |
---|
103 | DO 120 jx = 1, kngx2 |
---|
104 | C |
---|
105 | C* For all target grid points: zero all weights and set adresses to one |
---|
106 | C |
---|
107 | DO 130 jwg = 1, kw1to2 |
---|
108 | pr1to2(jwg,jx,jy) = 0. |
---|
109 | k1to2(jwg,jx,jy) = 1 |
---|
110 | 130 CONTINUE |
---|
111 | C |
---|
112 | C* Calculate the surface of all the target grid squares (masked or not) |
---|
113 | C |
---|
114 | CALL pmesh (jx, jy, px2, py2, kngx2, kngy2, cdper2, kper2, |
---|
115 | $ z2xi, z2xs, z2yi, z2ys) |
---|
116 | C |
---|
117 | C* Calculate the neighbors in the source grid and their weights |
---|
118 | C |
---|
119 | CALL pmrho (pr1to2(1,jx,jy), k1to2(1,jx,jy), kw1to2, |
---|
120 | $ z2xi, z2xs, z2yi, z2ys, |
---|
121 | $ px1, py1, kmsk1, kngx1, kngy1, cdper1, kper1, |
---|
122 | $ kvma1, kmskz2(jx,jy), kvmsz2) |
---|
123 | C |
---|
124 | C* For masked points: |
---|
125 | C |
---|
126 | IF (kmsk2(jx,jy) .EQ. kvma2) THEN |
---|
127 | DO 140 jwg = 1, kw1to2 |
---|
128 | pr1to2(jwg,jx,jy) = 0. |
---|
129 | k1to2(jwg,jx,jy) = 1 |
---|
130 | 140 CONTINUE |
---|
131 | ENDIF |
---|
132 | 120 CONTINUE |
---|
133 | 110 CONTINUE |
---|
134 | C |
---|
135 | C* End of routine |
---|
136 | C |
---|
137 | RETURN |
---|
138 | END |
---|