#50 add badvalue support to pctover and oddpctover


From the following discussion on the Perldl mailing list covers
the issues and provides the basis for an implementation.

Subject: [Perldl] conditional percentile
From: Chris Marshall
Date: Tue, 07 Oct 2008 07:33:24 -0700

The way I expected to get this to work would be to set the badvalue flag for
the non-positive elements of your arrays and then the oddpctover() would just

(1) the various pctover() routines do not seem to handle bad values so this doesn't work

(2) lack of bad value support is not documented

(3) a bug in pctover() was reported and fixed in PDL-2.4.3cvs but the code for
oddpctover() was not updated with the same fix and is likely present (see the
sourceforge bug tracker for the specific item

(4) it would be nice to fix this before the PDL-2.4.4 release but I don't know
if I'll have time to get to it. It should be straightforward to modify the
current code to stop the pct ranking as soon as BAD is hit from the qsort step
in Basic/Ufunc/ufunc.pd.

The following sequence might help you with the coding:

$a = (random(10,4)*10)->long;
$abad = $a->setbadif($a < 3);
$absort = $abad->qsort;

Now $absort has all the good values from $a in the first part of dim(0) and the
number of good elements in each row is just:

$num = $absort->dim(0) - $absort->nbadover;


  • Chris Marshall

    Chris Marshall - 2011-07-01

    This has been fixed in the latest git using
    the framework from the medover and oddmedover

  • Chris Marshall

    Chris Marshall - 2011-07-01
    • assigned_to: nobody --> marshallch
    • status: open --> pending
  • SourceForge Robot

    • status: pending --> closed
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).


Log in to post a comment.