NADCON5-ng  0.0.2
NADCON5 Next Generation Documentation
regrd2.f File Reference

Go to the source code of this file.

Functions/Subroutines

program regrd2
 Part of the NADCON5 NADCON5 Core Library , regrid data. More...
 
subroutine bquad1 (h, gla, glo, ival)
 
subroutine bquad2 (z, gla, glo, val)
 
real function qterp1 (x, if0, if1, if2)
 
real function qterp2 (x, f0, f1, f2)
 
subroutine r1 (lin, h, nla, nlo)
 
subroutine r2 (lin, z, nla, nlo)
 

Function/Subroutine Documentation

subroutine bquad1 ( integer, dimension(nla,nlo)  h,
  gla,
  glo,
  ival 
)

Definition at line 173 of file regrd2.f.

Referenced by regrd2().

173 
174 *** compute biquadratic interpolation, integer version
175 *** logic not tested for '0/360 meridian wraparound'
176 
177  implicit double precision(a-h,o-z)
178  integer h(nla,nlo)
179  real*4 x,y,fx0,fx1,fx2,val,qterp1,qterp2
180  external qterp1,qterp2
181  common/gstuff/glamn,dgla,glamx,glomn,dglo,glomx,nla,nlo,nclip
182 
183  if(gla.lt.glamn.or.gla.gt.glamx.or.
184  * glo.lt.glomn.or.glo.gt.glomx) then
185  nclip=nclip+1
186  ival=2147483647
187  else
188 
189 *** within grid boundaries, get indicies in the grid
190 
191  ix=(glo-glomn)/dglo+1.d0
192  ix1=ix+1
193  ix2=ix+2
194 
195 *** check if edge collision
196 
197  1 if(ix2.gt.nlo)then
198  ix =ix -1
199  ix1=ix1-1
200  ix2=ix2-1
201  go to 1
202  endif
203 
204  x=(glo-dglo*(ix-1)-glomn)/dglo
205 
206 *** move grid to get nearer center of 3 x 3
207 
208  if(x.lt.0.5.and.ix.gt.1)then
209  ix =ix -1
210  ix1=ix1-1
211  ix2=ix2-1
212  x=x+1.
213  endif
214  if(x.lt.0..or.x.gt.2.) stop 55555
215 
216 *** now do it for y
217 
218  jy=(gla-glamn)/dgla+1.d0
219  jy1=jy+1
220  jy2=jy+2
221  2 if(jy2.gt.nla)then
222  jy =jy -1
223  jy1=jy1-1
224  jy2=jy2-1
225  go to 2
226  endif
227  y=(gla-dgla*(jy-1)-glamn)/dgla
228  if(y.lt.0.5.and.jy.gt.1)then
229  jy =jy -1
230  jy1=jy1-1
231  jy2=jy2-1
232  y=y+1.
233  endif
234  if(y.lt.0..or.y.gt.2.) stop 33333
235 
236  fx0=qterp1(x, h(jy ,ix ), h(jy ,ix1), h(jy ,ix2))
237  fx1=qterp1(x, h(jy1,ix ), h(jy1,ix1), h(jy1,ix2))
238  fx2=qterp1(x, h(jy2,ix ), h(jy2,ix1), h(jy2,ix2))
239  val=qterp2(y, fx0 , fx1 , fx2 )
240  ival=nint(val)
241  endif
242 
243  return
real function qterp2(x, f0, f1, f2)
Definition: regrd2.f:334
real function qterp1(x, if0, if1, if2)
Definition: regrd2.f:318

+ Here is the caller graph for this function:

subroutine bquad2 ( real*4, dimension(nla,nlo)  z,
  gla,
  glo,
  val 
)

Definition at line 246 of file regrd2.f.

Referenced by regrd2().

246 
247 *** compute biquadratic interpolation, floating point version
248 *** logic not tested for '0/360 meridian wraparound'
249 
250  implicit double precision(a-h,o-z)
251  real*4 z(nla,nlo)
252  real*4 x,y,fx0,fx1,fx2,qterp2
253  external qterp2
254  common/gstuff/glamn,dgla,glamx,glomn,dglo,glomx,nla,nlo,nclip
255 
256  if(gla.lt.glamn.or.gla.gt.glamx.or.
257  * glo.lt.glomn.or.glo.gt.glomx) then
258  nclip=nclip+1
259  val=1.d30
260  else
261 
262 *** within grid boundaries, get indicies in the grid
263 
264  ix=(glo-glomn)/dglo+1.d0
265  ix1=ix+1
266  ix2=ix+2
267 
268 *** check if edge collision
269 
270  1 if(ix2.gt.nlo)then
271  ix =ix -1
272  ix1=ix1-1
273  ix2=ix2-1
274  go to 1
275  endif
276 
277  x=(glo-dglo*(ix-1)-glomn)/dglo
278 
279 *** move grid to get nearer center of 3 x 3
280 
281  if(x.lt.0.5.and.ix.gt.1)then
282  ix =ix -1
283  ix1=ix1-1
284  ix2=ix2-1
285  x=x+1.
286  endif
287  if(x.lt.0..or.x.gt.2.) stop 66666
288 
289 *** now do it for y
290 
291  jy=(gla-glamn)/dgla+1.d0
292  jy1=jy+1
293  jy2=jy+2
294  2 if(jy2.gt.nla)then
295  jy =jy -1
296  jy1=jy1-1
297  jy2=jy2-1
298  go to 2
299  endif
300  y=(gla-dgla*(jy-1)-glamn)/dgla
301  if(y.lt.0.5.and.jy.gt.1)then
302  jy =jy -1
303  jy1=jy1-1
304  jy2=jy2-1
305  y=y+1.
306  endif
307  if(y.lt.0..or.y.gt.2.) stop 44444
308 
309  fx0= qterp2(x, z(jy ,ix ), z(jy ,ix1), z(jy ,ix2))
310  fx1= qterp2(x, z(jy1,ix ), z(jy1,ix1), z(jy1,ix2))
311  fx2= qterp2(x, z(jy2,ix ), z(jy2,ix1), z(jy2,ix2))
312  val=dble(qterp2(y, fx0 , fx1 , fx2 ))
313  endif
314 
315  return
real function qterp2(x, f0, f1, f2)
Definition: regrd2.f:334

+ Here is the caller graph for this function:

real function qterp1 (   x,
  if0,
  if1,
  if2 
)

Definition at line 318 of file regrd2.f.

318 
319 *** linear quadratic interpolation from equally spaced values
320 *** uses newton-gregory forward polynomial
321 *** x ranges from 0 thru 2. (thus s = x)
322 
323 *** forward differences
324 
325  idf0 =if1 -if0
326  idf1 =if2 -if1
327  id2f0=idf1-idf0
328 
329  qterp1=if0 + x*idf0 + 0.5*x*(x-1.)*id2f0
330 
331  return
real function qterp1(x, if0, if1, if2)
Definition: regrd2.f:318
real function qterp2 (   x,
  f0,
  f1,
  f2 
)

Definition at line 334 of file regrd2.f.

334 
335 *** linear quadratic interpolation from equally spaced values
336 *** uses newton-gregory forward polynomial
337 *** x ranges from 0 thru 2. (thus s = x)
338 
339 *** forward differences
340 
341  df0 =f1 -f0
342  df1 =f2 -f1
343  d2f0=df1-df0
344 
345  qterp2=f0 + x*df0 + 0.5*x*(x-1.)*d2f0
346 
347  return
real function qterp2(x, f0, f1, f2)
Definition: regrd2.f:334
subroutine r1 (   lin,
integer, dimension(nla,nlo)  h,
  nla,
  nlo 
)

Definition at line 350 of file regrd2.f.

Referenced by regrd2().

350 
351 *** read records south to north (elements are west to east)
352 
353  implicit double precision(a-h,o-z)
354  integer h(nla,nlo)
355 
356  do 1 i=1,nla
357  1 read(lin) (h(i,j),j=1,nlo)
358 
359  return

+ Here is the caller graph for this function:

subroutine r2 (   lin,
real*4, dimension(nla,nlo)  z,
  nla,
  nlo 
)

Definition at line 362 of file regrd2.f.

Referenced by regrd2().

362 
363 *** read records south to north (elements are west to east)
364 
365  implicit double precision(a-h,o-z)
366  real*4 z(nla,nlo)
367 
368  do 1 i=1,nla
369  1 read(lin) (z(i,j),j=1,nlo)
370 
371  return

+ Here is the caller graph for this function: