39
|
1 |
#======================================================================
|
|
2 |
# . N M I N T E R P . N A N
|
|
3 |
# doc: Sun Jul 6 20:37:31 2014
|
|
4 |
# dlm: Sun Jul 6 20:39:26 2014
|
|
5 |
# (c) 2014 A.M. Thurnherr
|
|
6 |
# uE-Info: 67 0 NIL 0 0 72 2 2 4 NIL ofnI
|
|
7 |
#======================================================================
|
|
8 |
|
|
9 |
# filling gaps with nan [fillgaps]
|
|
10 |
|
|
11 |
# HISTORY:
|
|
12 |
# Jul 6, 2014: - created from [.nminterp.linear]
|
|
13 |
|
|
14 |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
15 |
#
|
|
16 |
# THE FOLLOWING VARIABLES MUST BE SET GLOBALLY (i.e. during loading)
|
|
17 |
#
|
|
18 |
# $ISOpts string of allowed options
|
|
19 |
# $ISOptsUsage usage information string for options
|
|
20 |
#
|
|
21 |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
22 |
|
|
23 |
$ISOpts = "";
|
|
24 |
$ISOptsUsage = "";
|
|
25 |
|
|
26 |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
27 |
#
|
|
28 |
# &ISUsage() mangle parameters (options, really)
|
|
29 |
#
|
|
30 |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
31 |
|
|
32 |
sub ISUsage() {}
|
|
33 |
|
|
34 |
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
35 |
#
|
|
36 |
# &ISInit(f,xf) init interpolation of field f
|
|
37 |
# f field number
|
|
38 |
# xf x field number or -1 for %RECNO
|
|
39 |
# <ret val> none
|
|
40 |
#
|
|
41 |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
42 |
|
|
43 |
sub ISInit($$) {}
|
|
44 |
|
|
45 |
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
46 |
#
|
|
47 |
# &interpolate(xf,mg,f,lvr,cr) interpolate field f
|
|
48 |
# xf x field or -1 for %RECNO
|
|
49 |
# mg max allowed x gap
|
|
50 |
# f field number to interpolate
|
|
51 |
# lvr last record with valid y val
|
|
52 |
# cr current record
|
|
53 |
# <ret val> interpolated value
|
|
54 |
#
|
|
55 |
# NB:
|
|
56 |
# - handle f == xf
|
|
57 |
# - return undef if interpolation cannot be carried out
|
|
58 |
# - x VALUES MAY NOT BE MONOTONIC
|
|
59 |
#
|
|
60 |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
61 |
|
|
62 |
sub interpolate($$$$$$)
|
|
63 |
{
|
|
64 |
my($xf,$mg,$f,$lvr,$cr) = @_;
|
|
65 |
|
|
66 |
return ($xf == $f) ? $ants_[$cr][$xf] : nan;
|
|
67 |
} # static scope
|
|
68 |
|
|
69 |
#----------------------------------------------------------------------
|
|
70 |
|
|
71 |
1;
|