On Thu, 2010-08-26 at 17:20 -0500, P Kishor wrote:
> Thanks for great advice as it got me going on a day's worth of
> programming. However, wrt the following
> 
> On Thu, Aug 26, 2010 at 10:42 AM, Derek Lamb <[email protected]> wrote:
> > Correct, but they will take the BAD values into account when calculating
> > the average:
> >
> > p pdl(BAD,BAD,BAD,1)->avg
> > 0.25
> >
> 
> The above is not my experience. Consider
> 
> PDL> $a = pdl(3, 5, -999, 7)
> PDL> p $a
> [3 5 -999 7]
> PDL> $a->badvalue(-999)
> PDL> $a->badflag(1)
> PDL> p $a->average
> 5
> PDL> p $a->avg
> 5
> 
> 
> So, it seems that BAD values are actually discounted when calculating
> the averages, so I don't have to monkey around with them.
> 
> 

You are correct.  Apparently BAD, when passed as a value to the pdl
constructor, doesn't produce a badval, it just produces a 0.  So the
following also produces my erroneous output:

p pdl(cow,cow,cow,1)->avg
0.25

The piddle never has its badflag set, so the cows are interpreted as 0,
leading to 0.25.

Derek


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to