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.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
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

Reply via email to