Hi Tod,
There may be a more elegant way, but you could try:
$work($work->isbad;?) .= $original($work->isbad;?)
or
$ind = $work->isbad->which
$work($ind) .= $original($ind)
the '.=' means the values are assigned inplace (I think).
the ';?' is shorthand for 'where'
Hope that's useful,
Trevor.
On Thu, 01 Nov 2007 21:46:04 -0400
Tod Hagan <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm a PDL novice interested in processing instrument data which has
> several codes for bad data. Since it seems that there can only be a
> single bad data value, I can do this:
>
> my $work = $original->copy;
>
> for my $bv ( -9999, -8888, -7777 )
> {
> $work->inplace->setvaltobad($bv);
> }
>
> # process $work PDL, ignoring bad values
>
> After processing I need to restore the values marked as BAD before
> writing output. Using the above example, how can I copy from the
> $original PDL the values corresponding to the BADs in the $work PDL? Of
> course I could do it in a loop, but is there a PDL function like
>
> merge($a, $b, mask)
> Signature: (a(); b(); mask(); int [o]c())
>
> Copies values from $b if $mask is true, otherwise copies from
> $a.
>
> Thanks.
>
> Tod
>
-----
Dr. Trevor Carey-Smith
National Institute of Water and Atmospheric Research
Private Bag 14-901, Wellington, New Zealand
Ph: +64 4 386 0394 Fax: +64 4 386 2153
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl