NADCON5-ng  0.0.1
NADCON5 Next Generation
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 169 of file regrd2.f.

Referenced by regrd2().

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

+ Here is the caller graph for this function:

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

Definition at line 242 of file regrd2.f.

Referenced by regrd2().

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

+ Here is the caller graph for this function:

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

Definition at line 314 of file regrd2.f.

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

Definition at line 330 of file regrd2.f.

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

Definition at line 346 of file regrd2.f.

Referenced by regrd2().

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

+ Here is the caller graph for this function:

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

Definition at line 358 of file regrd2.f.

Referenced by regrd2().

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

+ Here is the caller graph for this function: