#!/usr/bin/perl # prefilter.pl # Do some preprocessing to remove non-numeric values, and data outliers. # Copyright 2001 John Ackermann Version: 15 July 2001 # May be freely used provided these notices are retained, and a copy # of any modified version that's distributed to third persons is sent # to jra@febo.com $Value = 0.0; $LastGood = 0.0; $First = 1; while ($RawIn=) { if ($RawIn =~ /^[0-9]/) { $Value = round($RawIn * 100)/100; if ($First) { $LastGood = $Value; $First = 0; } endif; $tmp1 = abs($Value - $PreviousValue); if (!($tmp1 > 1.0 && $tmp1 < 9.0)) { print($Value,"\n"); $LastGood = $Value; } else { print($LastGood,"\n"); } $PreviousValue = $Value; endif; } endif; }; sub round { my($number) = shift; return int($number +.5 * ($number <=> 0) ); };