forked from Richardjmorton/Development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linfill.pro
53 lines (45 loc) · 1.62 KB
/
linfill.pro
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
;-------------------------------------------------------------
;+
; NAME:
; LINFILL
; PURPOSE:
; Fill gaps in array data using linear interpolation.
; CATEGORY:
; CALLING SEQUENCE:
; LINFILL,A,I1,I2
; INPUTS:
; A = array to operate on. in
; I1 = index in A of last good value before gap. in
; I2 = index in A of first good value after gap. in
; KEYWORD PARAMETERS:
; OUTPUTS:
; A = updated array. out
; COMMON BLOCKS:
; NOTES:
; MODIFICATION HISTORY:
; Ray Sterner, 6 Mar, 1985.
; Johns Hopkins University Applied Physics Laboratory.
;
; Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
; This software may be used, copied, or redistributed as long as it is not
; sold and this copyright notice is reproduced on each copy made. This
; routine is provided as is without any express or implied warranties
; whatsoever. Other limitations apply as described in the file disclaimer.txt.
;-
;-------------------------------------------------------------
PRO LINFILL,A,I1,I2, hlp=hlp
if (n_params(0) lt 3) or keyword_set(hlp) then begin
print,' Fill gaps in array data using linear interpolation.
print,' LINFILL,A,I1,I2
print,' A = array to operate on. in'
print,' I1 = index in A of last good value before gap. in'
print,' I2 = index in A of first good value after gap. in'
print,' A = updated array. out'
return
endif
V1 = A(I1)
V2 = A(I2)
SC = (V2-V1)/(I2-I1)
FOR I = I1+1, I2-1 DO A(I) = (I-I1)*SC + V1
RETURN
END