1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
|
C Copyright 1981-2007 ECMWF
C
C Licensed under the GNU Lesser General Public License which
C incorporates the terms and conditions of version 3 of the GNU
C General Public License.
C See LICENSE and gpl-3.0.txt for details.
C
SUBROUTINE HWTSLL
X (KLEN,KSCHEME,KLA,PDLAT,PLATINC,PDLO0,PDLO1,PDLO2,PDLO3,NEIGH,
X PWTS)
C
C---->
C**** HWTSLL
C
C Purpose
C -------
C
C This routine accepts a vector of points and calculates the
C interpolation weightings for each point suitable for the
C horizontal interpolation.
C
C
C Interface
C ---------
C
C CALL HWTSLL
C X (KLEN,KSCHEME,KLA,PDLAT,PLATINC,PDLO0,PDLO1,PDLO2,PDLO3,NEIGH,
C X PWTS)
C
C
C Input parameters
C ----------------
C
C KLEN - Number of points along the vector.
C KSCHEME - Flag showing interpolation scheme to use for point
C 0 = 12-point
C 1 = 4-point bilinear
C 2 = nearest neighbour
C KLA - Latitude number in original field of latitude north of
C point in the vector.
C PDLAT - Meridian linear weight.
C PLATINC - Increment between latitudes.
C PDLO0 - Zonal linear weight for the latitude of point 5.
C PDLO1 - Zonal linear weight for the latitude of point 1.
C PDLO2 - Zonal linear weight for the latitude of point 3.
C PDLO3 - Zonal linear weight for the latitude of point 11.
C NEIGH - List of indices in the original field of neighbouring
C point values.
C
C
C Output parameters
C -----------------
C
C PWTS - Weights for interpolation.
C
C Common block usage
C ------------------
C
C None.
C
C
C Method
C ------
C
C Numbering of the points (I is the interpolation point):
C
C 13 5 6 14
C
C 7 1 2 8
C (I)
C 9 3 4 10
C
C 15 11 12 16
C
C
C Externals
C ---------
C
C None.
C
C
C Reference
C ---------
C
C ECMWF Meteorological Bulletin M1.6/7
C IFS Documentation
C Part VI: Technical and Computational Procedures (CY21R4)
C March 2000
C Section 2.3
C
C
C Comments
C --------
C
C None.
C
C
C Author
C ------
C
C J.D.Chambers ECMWF January 2001
C
C
C Modifications
C -------------
C
C None.
C
C----<
C -----------------------------------------------------------------|
C* Definition of variables.
C -----------------------------------------------------------------|
C
IMPLICIT NONE
C
C Parameters
C
INTEGER JP12PT, JP4PT, JPNEARN
PARAMETER (JP12PT = 0)
PARAMETER (JP4PT = 1)
PARAMETER (JPNEARN = 2)
C
C Function arguments
C
INTEGER KLEN, KSCHEME(KLEN), KLA(KLEN)
REAL PDLAT(KLEN), PLATINC
REAL PDLO0(KLEN), PDLO1(KLEN), PDLO2(KLEN), PDLO3(KLEN)
INTEGER NEIGH(12,*)
REAL PWTS(12,*)
C
C Local variables
C
INTEGER NEXT, LOOP
INTEGER ILA0G, ILA1G, ILA2G, ILA3G
REAL ZDLAT, ZDY, ZDY10, ZDY21, ZDY32
REAL ZDLO1, ZDLO2, ZWXN0, ZWXN1, ZWXN2, ZWXN3
REAL ZWY0, ZWY1, ZWY2, ZWY3
REAL ZWXNN, ZCXNN, ZWXSS, ZCXSS
REAL ZWXS0, ZWXS1, ZWXS2, ZWXS3
C
C Inline functions
C
REAL ALPHA, F2, F3, F4
C
F2(ALPHA) = ((ALPHA+1.0) * (ALPHA-2.0) * (ALPHA-1.0))/2.0
C
F3(ALPHA) = - ((ALPHA+1.0) * (ALPHA-2.0) * ALPHA)/2.0
C
F4(ALPHA) = (ALPHA * (ALPHA-1.0) * (ALPHA+1.0))/6.0
C
C -----------------------------------------------------------------|
C Process each point in the vector.
C -----------------------------------------------------------------|
C
DO NEXT = 1,KLEN
C
C Clear the weights for the current point
C
DO LOOP = 1, 12
PWTS(LOOP,NEXT) = 0.0
ENDDO
C
C Use appropriate interpolation scheme for the current point
C
C -----------------------------------------------------------------|
C Nearest point selection
C -----------------------------------------------------------------|
C
IF( KSCHEME(NEXT).EQ.JPNEARN ) THEN
C
DO LOOP = 1, 4
IF( NEIGH(LOOP,NEXT).NE.0 ) PWTS(LOOP,NEXT) = 1.0
ENDDO
C
GOTO 900
C
C -----------------------------------------------------------------|
C 4-point interpolation
C -----------------------------------------------------------------|
C
ELSE IF( KSCHEME(NEXT).EQ.JP4PT ) THEN
C
PWTS(1,NEXT) = (1.0 - PDLO2(NEXT)) * (1.0 - PDLAT(NEXT))
PWTS(2,NEXT) = PDLO2(NEXT) * (1.0 - PDLAT(NEXT))
PWTS(3,NEXT) = (1.0 - PDLO1(NEXT)) * PDLAT(NEXT)
PWTS(4,NEXT) = PDLO1(NEXT) * PDLAT(NEXT)
C
GOTO 900
C
C -----------------------------------------------------------------|
C 12-point interpolation
C -----------------------------------------------------------------|
C
ELSE
C
C Setup latitude numbers for the 4 rows.
C
ILA1G = KLA(NEXT)
ILA0G = ILA1G - 1
ILA2G = ILA1G + 1
ILA3G = ILA1G + 2
C
C Setup the weights between rows.
C
ZDLAT = PDLAT(NEXT)
ZDY = ZDLAT * PLATINC
ZDY10 = PLATINC
ZDY21 = PLATINC
ZDY32 = PLATINC
C
C -----------------------------------------------------------------|
C Polynomial in x-direction.
C -----------------------------------------------------------------|
C
C Northern parallel
C
ZDLO1 = PDLO1(NEXT)
ZWXN1 = F2(ZDLO1)
ZWXN2 = F3(ZDLO1)
ZWXN3 = F4(ZDLO1)
ZWXN0 = 1.0 - ZWXN1 - ZWXN2 - ZWXN3
C
C Southern parallel
C
ZDLO2 = PDLO2(NEXT)
ZWXS1 = F2(ZDLO2)
ZWXS2 = F3(ZDLO2)
ZWXS3 = F4(ZDLO2)
ZWXS0 = 1.0 - ZWXS1 - ZWXS2 - ZWXS3
C
C -----------------------------------------------------------------|
C Polynomial in y-direction.
C -----------------------------------------------------------------|
C
ZWY3 = ((ZDY+ZDY10) * (ZDY) * (ZDY-ZDY21)) /
X ((ZDY10+ZDY21+ZDY32) * (ZDY21+ZDY32) * (ZDY32))
ZWY2 = ((ZDY+ZDY10) * (ZDY) * (ZDY-ZDY21-ZDY32)) /
X ((ZDY10+ZDY21) * (ZDY21) * (-ZDY32))
ZWY1 = ((ZDY+ZDY10) * (ZDY-ZDY21) * (ZDY-ZDY21-ZDY32)) /
X ((ZDY10) * (-ZDY21) * (-ZDY21-ZDY32))
ZWY0 = 1.0 - ZWY1 - ZWY2 - ZWY3
C
C -----------------------------------------------------------------|
C Linear parts for extreme rows.
C -----------------------------------------------------------------|
C
C Northernmost
C
ZWXNN = PDLO0(NEXT)
ZCXNN = 1.0 - PDLO0(NEXT)
C
C Southernmost
C
ZWXSS = PDLO3(NEXT)
ZCXSS = 1.0 - PDLO3(NEXT)
C
C -----------------------------------------------------------------|
C Weights for 12 points interpolation.
C -----------------------------------------------------------------|
C
PWTS( 1,NEXT) = ZWXN1 * ZWY1
PWTS( 2,NEXT) = ZWXN2 * ZWY1
PWTS( 3,NEXT) = ZWXS1 * ZWY2
PWTS( 4,NEXT) = ZWXS2 * ZWY2
PWTS( 5,NEXT) = ZCXNN * ZWY0
PWTS( 6,NEXT) = ZWXNN * ZWY0
PWTS( 7,NEXT) = ZWXN0 * ZWY1
PWTS( 8,NEXT) = ZWXN3 * ZWY1
PWTS( 9,NEXT) = ZWXS0 * ZWY2
PWTS(10,NEXT) = ZWXS3 * ZWY2
PWTS(11,NEXT) = ZCXSS * ZWY3
PWTS(12,NEXT) = ZWXSS * ZWY3
C
GOTO 900
C
ENDIF
C
C -----------------------------------------------------------------|
C End of processing for current point in vector.
C -----------------------------------------------------------------|
C
900 CONTINUE
C
ENDDO
C
RETURN
END
|