1 | SUBROUTINE coasts (plon, plat, kmsk, kmskval, klon, klat, kmesh) |
---|
2 | C |
---|
3 | C ***************************** |
---|
4 | C * OASIS ROUTINE - LEVEL 3 * |
---|
5 | C * ------------- ------- * |
---|
6 | C ***************************** |
---|
7 | C |
---|
8 | C**** *coasts* - locate coastal points where SST must be extrapolated |
---|
9 | C when using surfmesh interpolation. |
---|
10 | C |
---|
11 | C Purpose: |
---|
12 | C ------- |
---|
13 | C This routine is designed to detect coastal points where there is |
---|
14 | C mismatch between the atmosphere and ocean land sea masks and |
---|
15 | C where this mismatch could result in the atmosphere (undesirably) |
---|
16 | C 'seeing' climatological SST's directly adjacent to ocean model SST's. |
---|
17 | C Where this situation arises, suitable neighbours from where |
---|
18 | C ocean model SST's may be extrapolated are located. |
---|
19 | C |
---|
20 | C NB: This is only for use with 'SURFMESH' interpolation of SST's. |
---|
21 | C |
---|
22 | C** Interface: |
---|
23 | C --------- |
---|
24 | C *CALL* *coasts*(plon, plat, kmsk, kmskval, klon, klat, kmesh)* |
---|
25 | C |
---|
26 | C Input: |
---|
27 | C ----- |
---|
28 | C plon : target grid longitude array (real 2D) |
---|
29 | C plat : target grid latitude array (real 2D) |
---|
30 | C klon : number of longitude for target grid (integer) |
---|
31 | C klat : number of latitude for target grid (integer) |
---|
32 | C kmsk : target grid sea-land mask (integer 2D) |
---|
33 | C kmskval : sea-land mask value (integer) |
---|
34 | C kmesh : overlap array (integer 2D) |
---|
35 | C |
---|
36 | C Output: |
---|
37 | C ------ |
---|
38 | C None |
---|
39 | C |
---|
40 | C Workspace: |
---|
41 | C --------- |
---|
42 | C indx(4) - stores indices for neighbours |
---|
43 | C |
---|
44 | C Externals: |
---|
45 | C --------- |
---|
46 | C None |
---|
47 | C |
---|
48 | C History: |
---|
49 | C ------- |
---|
50 | C Version Programmer Date Description |
---|
51 | C ------- ---------- ---- ----------- |
---|
52 | C 1.1 R. Sutton 24/11/95 Original |
---|
53 | C 2.0 L. Terray 26/12/95 Modified: to suit OASIS 2.0 |
---|
54 | C 2.3 S. Valcke 99/04/30 added: printing levels |
---|
55 | C |
---|
56 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
57 | C |
---|
58 | C* --------------- Include files and USE of modules --------------------------- |
---|
59 | C |
---|
60 | USE mod_kinds_oasis |
---|
61 | USE mod_parameter |
---|
62 | USE mod_coast |
---|
63 | USE mod_unit |
---|
64 | USE mod_smooth |
---|
65 | USE mod_printing |
---|
66 | C |
---|
67 | C* ---------------------------- Argument declarations ------------------- |
---|
68 | C |
---|
69 | REAL (kind=ip_realwp_p) plon(klon,klat), plat(klon,klat) |
---|
70 | INTEGER (kind=ip_intwp_p) kmsk(klon,klat), kmesh(klon,klat) |
---|
71 | C |
---|
72 | C* ---------------------------- Local declarations ---------------------- |
---|
73 | C |
---|
74 | INTEGER (kind=ip_intwp_p) indx(4) |
---|
75 | C |
---|
76 | C* ---------------------------- Poema verses ---------------------------- |
---|
77 | C |
---|
78 | C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
79 | C |
---|
80 | C |
---|
81 | C* 1. Initialization |
---|
82 | C -------------- |
---|
83 | C |
---|
84 | IF (nlogprt .GE. 2) THEN |
---|
85 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
86 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
87 | WRITE (UNIT = nulou,FMT = *) |
---|
88 | $ ' ROUTINE coasts - Level 3' |
---|
89 | WRITE (UNIT = nulou,FMT = *) |
---|
90 | $ ' ************** *******' |
---|
91 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
92 | WRITE (UNIT = nulou,FMT = *) |
---|
93 | $ ' locate any coastal points where SST must be extrapolated' |
---|
94 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
95 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
96 | ENDIF |
---|
97 | ncoast = 0 |
---|
98 | indx(:)=0 |
---|
99 | C |
---|
100 | C |
---|
101 | C* 2. Locate coastal points and neighbours from where to do extrapolation |
---|
102 | C ------------------------------------------------------------------- |
---|
103 | C |
---|
104 | C* Loop between southern and northern boundaries |
---|
105 | C (Range of latitude is set by parameters defined in blkdata.) |
---|
106 | C |
---|
107 | DO 210 jj = nsltb+1, nnltb-1 |
---|
108 | DO 220 ji = 1, klon |
---|
109 | C |
---|
110 | C* Find all grid squares which are ocean on the atmosphere grid but |
---|
111 | C have no ocean underlying them on the ocean grid |
---|
112 | C |
---|
113 | IF (kmsk(ji,jj) .NE. kmskval .AND. |
---|
114 | $ kmesh(ji,jj) .EQ. 0) THEN |
---|
115 | is = jj-1 |
---|
116 | in = jj+1 |
---|
117 | iw = ji-1 |
---|
118 | ie = ji+1 |
---|
119 | C |
---|
120 | C* For an atmospheric domain that is periodic in longitude |
---|
121 | C |
---|
122 | IF (iw .EQ. 0) iw = klon |
---|
123 | IF (ie .GT. klon) ie = ie - klon |
---|
124 | C |
---|
125 | C* For a domain that is not periodic in longitude |
---|
126 | C if (iw .eq. 0) iw=1 |
---|
127 | C if (ie .gt. klon) ie=klon |
---|
128 | C |
---|
129 | C* Search for neighbours from which ocean model SST may be extrapolated. |
---|
130 | C |
---|
131 | inbor = 0 |
---|
132 | IF (kmsk(iw,jj) .EQ. 0 .AND. kmesh(iw,jj) .NE. 0) THEN |
---|
133 | inbor = inbor + 1 |
---|
134 | indx(inbor) = iw + (jj-1) * klon |
---|
135 | ENDIF |
---|
136 | IF (kmsk(ie,jj) .EQ. 0 .AND. kmesh(ie,jj) .NE. 0) THEN |
---|
137 | inbor = inbor + 1 |
---|
138 | indx(inbor)= ie + (jj-1) * klon |
---|
139 | ENDIF |
---|
140 | IF (kmsk(ji,is) .EQ. 0 .AND. kmesh(ji,is) .NE. 0) THEN |
---|
141 | inbor = inbor + 1 |
---|
142 | indx(inbor) = ji + (is-1) * klon |
---|
143 | ENDIF |
---|
144 | IF (kmsk(ji,in) .EQ. 0 .AND. kmesh(ji,in) .NE. 0) THEN |
---|
145 | inbor = inbor + 1 |
---|
146 | indx(inbor) = ji + (in-1) * klon |
---|
147 | ENDIF |
---|
148 | C |
---|
149 | C* Store location of coastal point, number of suitable |
---|
150 | C neighbours and their locations. |
---|
151 | C Note that if there are no neighbours the point must |
---|
152 | C be an inland sea on the atmosphere grid for which |
---|
153 | C we do not want to extrapolate the ocean SST's |
---|
154 | C |
---|
155 | IF (inbor .GT. 0) THEN |
---|
156 | ncoast = ncoast + 1 |
---|
157 | npcoast(ncoast,1) = ji + (jj-1) * klon |
---|
158 | npcoast(ncoast,2) = inbor |
---|
159 | DO 230 jkbor = 1, inbor |
---|
160 | npcoast(ncoast,2+jkbor) = indx(jkbor) |
---|
161 | 230 CONTINUE |
---|
162 | ENDIF |
---|
163 | ENDIF |
---|
164 | 220 CONTINUE |
---|
165 | 210 CONTINUE |
---|
166 | C |
---|
167 | C |
---|
168 | C* 3. Writing results |
---|
169 | C --------------- |
---|
170 | C |
---|
171 | IF (nlogprt .GE. 2) THEN |
---|
172 | WRITE (UNIT = nulou,FMT = *) |
---|
173 | $ 'Number of coastal ocean squares on the atmosphere grid '// |
---|
174 | $ 'for which there' |
---|
175 | WRITE (UNIT = nulou,FMT = *) |
---|
176 | $ 'are no underlying ocean squares on the ocean grid = ',ncoast |
---|
177 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
178 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
179 | WRITE (UNIT = nulou,FMT = *) |
---|
180 | $ 'Coordinates nbor Coordinates of neighbours ' |
---|
181 | do 310 jn = 1, ncoast |
---|
182 | ii = icoor(npcoast(jn,1),klon) |
---|
183 | ij = jcoor(npcoast(jn,1),klon) |
---|
184 | WRITE (UNIT = nulou,FMT = 3100) |
---|
185 | $ plon(ii,ij),plat(ii,ij),npcoast(jn,2), |
---|
186 | $ (plon(icoor(npcoast(jn,jkbor),klon), |
---|
187 | $ jcoor(npcoast(jn,jkbor),klon)), |
---|
188 | $ plat(icoor(npcoast(jn,jkbor),klon), |
---|
189 | $ jcoor(npcoast(jn,jkbor),klon)), |
---|
190 | $ jkbor=3,2+npcoast(jn,2)) |
---|
191 | 310 CONTINUE |
---|
192 | ENDIF |
---|
193 | C |
---|
194 | C* Formats |
---|
195 | C |
---|
196 | 3100 FORMAT (1X,'(',F5.1,',',F5.1,') ',I1, |
---|
197 | $ 4X,4('(',F5.1,',',F5.1,') ')) |
---|
198 | C |
---|
199 | C |
---|
200 | C* 4. End of routine |
---|
201 | C -------------- |
---|
202 | C |
---|
203 | IF (nlogprt .GE. 2) THEN |
---|
204 | WRITE (UNIT = nulou,FMT = *) ' ' |
---|
205 | WRITE (UNIT = nulou,FMT = *) |
---|
206 | $ ' --------- End of routine coasts ---------' |
---|
207 | CALL FLUSH (nulou) |
---|
208 | ENDIF |
---|
209 | RETURN |
---|
210 | END |
---|
211 | |
---|
212 | |
---|