On Fri, Nov 23, 2012 at 10:13:01AM -0800, Alan Irwin wrote:
> On 2012-11-23 07:39-0800 phil rosenberg wrote:
>
> > Hi
> > I'm just emailing with a suggestion for the various plshade routines. I
> > often have data which is nearly regular in that it is on a regular grid
> > with some points missing, either because the data doesn't fill the whole
> > domain or because some data has been flagged as bad. Up to now I'd been
> > padding these points with MAX_DOUBLE, which takes these regions off scale
> > and they don't get plotted, except around the edges of the gaps where I get
> > a line with the maximum value of my colourscale. I just had a case where
> > this was particularly ugly so have had a look at the plshade code to see if
> > I could see a better way. A solution I came up with was to?flag bad data or
> > gaps?with nans by changing setcond to:
> > ?
> > static void
> > set_cond( register int *cond, register PLFLT *a, register PLINT n )
> > {
> > ??? while ( n-- )
> > ??? {
> > ??????? if ( *a < sh_min )
> > ??????????? *cond++ = NEG;
> > ??????? else if ( *a > sh_max )
> > ??????????? *cond++ = POS;
> > ??????? else if ( *a != *a )??????????? //check for nans and set cond to
> > undefined
> > ??????????? *cond++ = UNDEF;
> > ??????? else
> > ??????????? *cond++ = OK;
> > ??????? a++;
> > ??? }
> > }
> > ?
> > A comparison of the two methods for my case can be found at
> > http://homepages.see.leeds.ac.uk/~earpros/plplottest/shade_maxdbl.png
> > http://homepages.see.leeds.ac.uk/~earpros/plplottest/shade_nan.png
> > ?
> > Any thoughts?
>
> To Phil and Andrew:
>
> @Phil: I have similar issues with undefined regions so I am keenly interested
> in your solution. I don't completely understand the internal workings
> of the plshade.c code, but looking very quickly through it, setting to
> UNDEF appears to be what should happen for undefined regions, and
> clearly your plot using your new nan method to mark undefined/bad
> regions looks _much_ better.
>
> @Andrew: I encourage you to go ahead and make this simple change
> unless your own technical review of the change turns up some concerns.
Phil,
I like this idea. I've tried to make plplot more NaN-aware over the years
since it is immensely useful for many scientific applications. I've
implemented your suggestion, with one change to use the isnan function
rather than checking *a != *a. There is already cmake code in place to
check for isnan and define a local implementation if required.
Thanks
Andrew
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel