[GRASS-dev] matplotlib example script

Yann Chemin yann.chemin at gmail.com
Sat Jul 26 04:42:27 EDT 2008


Hi Michael,

I got a nice CASC2D water depth histogram, in a different color...
It nicely work for other datasets... without NAN, which are different
from NULL values, I wish we had a G_set_nan_null_value() function
too...

Yann


2008/7/26 Michael Barton <michael.barton at asu.edu>:
> Yann,
>
> Have you tried this on a dataset without NAN values?
>
> Michael
> ______________________________
> C. Michael Barton, Professor of Anthropology
> Director of Graduate Studies
> School of Human Evolution & Social Change
> Center for Social Dynamics & Complexity
> Arizona State University
> Tempe, AZ  85287-2402
> USA
>
> voice: 480-965-6262; fax: 480-965-7671
> www: http://www.public.asu.edu/~cmbarton
>
> On Jul 25, 2008, at 4:09 PM, Yann Chemin wrote:
>
>> Hi,
>>
>> after chmod +x, it created a nice histogram of elevation.10m.
>> So I tried on floating point image created by some process.
>>
>> here is the problem:
>> Traceback (most recent call last):
>>  File "/home/yann/histogram_mpldemo.py", line 173, in <module>
>>   main()
>>  File "/home/yann/histogram_mpldemo.py", line 159, in main
>>   alpha=0.75)
>>  File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 6035, in
>> hist
>>   normed=bool(normed), new=True)
>>  File "/usr/lib/python2.5/site-packages/numpy/lib/function_base.py",
>> line 236, in histogram
>>   range = (a.min(), a.max())
>> ValueError: zero-size array to ufunc.reduce without identity
>>
>>
>> this happens because the data has NAN (see r.info output):
>> Range of data:    min = nan  max = nan
>>
>> Is there a way to discard NAN in a.min() and a.max() calculations?
>> Or is there a NAN-resistant mode in matplotlib?
>>
>> Yann
>
>



-- 
Yann Chemin
International Rice Research Institute
Office: http://www.irri.org/gis
Perso: http://www.freewebs.com/ychemin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myhistogram.png
Type: image/png
Size: 32256 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20080726/5e3c1e39/myhistogram-0001.png


More information about the grass-dev mailing list