1 | SUBROUTINE pmesh (kx, ky, px, py, kngx, kngy, cdper, kper, |
---|
2 | $ pxi, pxs, pyi, pys) |
---|
3 | C**** |
---|
4 | C ***************************** |
---|
5 | C * OASIS ROUTINE - LEVEL 3 * |
---|
6 | C * ------------- ------- * |
---|
7 | C ***************************** |
---|
8 | C |
---|
9 | C**** *pmesh* - Calculate the mesh controlled by one point on a |
---|
10 | C periodical or non-periodical grid. |
---|
11 | C |
---|
12 | C Purpose: |
---|
13 | C ------- |
---|
14 | C For one point defined by the coordinates (px(k),py(k)) |
---|
15 | C on a lat-lon grid, gives the inferior and superior longitudes |
---|
16 | C (pxi,pxs) and latitudes (pyi,pys) of the associated mesh. |
---|
17 | C |
---|
18 | C |
---|
19 | C** Interface: |
---|
20 | C --------- |
---|
21 | C *CALL* *pmesh(kx, ky, px, py, kngx, kngy, cdper, kper, |
---|
22 | C pxi, pxs, pyi, pys)* |
---|
23 | C |
---|
24 | C Input: |
---|
25 | C ----- |
---|
26 | C kx : point longitude index |
---|
27 | C ky : point latitude index |
---|
28 | C px : longitude array (real 2D) |
---|
29 | C py : latitude array (real 2D) |
---|
30 | C kngx : number of longitudes |
---|
31 | C kngy : number of latitudes |
---|
32 | C cdper : grid periodicity |
---|
33 | C kper : number of overlapped points |
---|
34 | C |
---|
35 | C Output: |
---|
36 | C ------ |
---|
37 | C pxi : inferior longitude |
---|
38 | C pxs : superior longitude |
---|
39 | C pyi : inferior latitude |
---|
40 | C pys : superior latitude |
---|
41 | C |
---|
42 | C Workspace: |
---|
43 | C --------- |
---|
44 | C None |
---|
45 | C |
---|
46 | C External: |
---|
47 | C -------- |
---|
48 | C None |
---|
49 | C |
---|
50 | C References: |
---|
51 | C ---------- |
---|
52 | C O. Thual, Simple ocean-atmosphere interpolation. |
---|
53 | C Part A: The method, EPICOA 0629 (1992) |
---|
54 | C Part B: Software implementation, EPICOA 0630 (1992) |
---|
55 | C See also OASIS manual (1995) |
---|
56 | C |
---|
57 | C History: |
---|
58 | C ------- |
---|
59 | C Version Programmer Date Description |
---|
60 | C ------- ---------- ---- ----------- |
---|
61 | C 1.1 O. Thual 93/04/15 created |
---|
62 | C 2.0 L. Terray 95/10/01 modified: new structure |
---|
63 | C 2.3 L. Terray 99/09/15 changed periodicity variables |
---|
64 | C |
---|
65 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
66 | C |
---|
67 | C* ---------------------------- Include files --------------------------- |
---|
68 | C |
---|
69 | USE mod_kinds_oasis |
---|
70 | USE mod_unit |
---|
71 | C |
---|
72 | C* ---------------------------- Argument declarations ------------------- |
---|
73 | C |
---|
74 | REAL (kind=ip_realwp_p) px(kngx,kngy), py(kngx,kngy) |
---|
75 | CHARACTER*8 cdper |
---|
76 | C |
---|
77 | C* ---------------------------- Poema verses ---------------------------- |
---|
78 | C |
---|
79 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
80 | C |
---|
81 | C* 1. Left or right |
---|
82 | C ------------- |
---|
83 | C |
---|
84 | C* Periodic grid with kper overlapped points |
---|
85 | C |
---|
86 | IF (cdper .EQ. 'P') THEN |
---|
87 | IF (kx .EQ. 1) THEN |
---|
88 | pxi = 0.5 * (px(kx,ky) + px(kngx-kper,ky) - 360.) |
---|
89 | pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) |
---|
90 | ELSE IF (kx .EQ. kngx) THEN |
---|
91 | pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) |
---|
92 | pxs = 0.5 * (px(kx,ky) + px(1+kper,ky) + 360. ) |
---|
93 | ELSE |
---|
94 | pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) |
---|
95 | pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) |
---|
96 | ENDIF |
---|
97 | C |
---|
98 | C* Regional grid |
---|
99 | C |
---|
100 | ELSE IF (cdper .EQ. 'R') THEN |
---|
101 | IF (kx .EQ. 1) THEN |
---|
102 | pxi = px(kx,ky) |
---|
103 | pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) |
---|
104 | ELSE IF (kx .EQ. kngx) THEN |
---|
105 | pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) |
---|
106 | pxs = px(kx,ky) |
---|
107 | ELSE |
---|
108 | pxi = 0.5 * (px(kx-1,ky) + px(kx,ky)) |
---|
109 | pxs = 0.5 * (px(kx,ky) + px(kx+1,ky)) |
---|
110 | ENDIF |
---|
111 | END IF |
---|
112 | C |
---|
113 | C |
---|
114 | C* 2. Bottom or top (idem for both types of grid) |
---|
115 | C ------------------------------------------- |
---|
116 | C True only if it is a global grid in latitude [-90 , 90] |
---|
117 | C or as it is the case for regional models if the first and last |
---|
118 | C latitude row are masked ---> then we only go through the else statement. |
---|
119 | C |
---|
120 | IF (ky .EQ. 1) THEN |
---|
121 | pyi = -90. |
---|
122 | pys = 0.5 * (py(kx,ky) + py(kx,ky+1)) |
---|
123 | ELSE IF (ky .EQ. kngy) THEN |
---|
124 | pyi = 0.5 * (py(kx,ky-1) + py(kx,ky)) |
---|
125 | pys = 90. |
---|
126 | ELSE |
---|
127 | pyi = 0.5 * (py(kx,ky-1) + py(kx,ky)) |
---|
128 | pys = 0.5 * (py(kx,ky)+ py(kx,ky+1)) |
---|
129 | ENDIF |
---|
130 | C |
---|
131 | C* End of routine |
---|
132 | C |
---|
133 | RETURN |
---|
134 | END |
---|
135 | |
---|