[GRASS-dev] matplotlib example script
michael.barton at asu.edu
Fri Jul 25 19:31:22 EDT 2008
Have you tried this on a dataset without NAN values?
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
voice: 480-965-6262; fax: 480-965-7671
On Jul 25, 2008, at 4:09 PM, Yann Chemin wrote:
> 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>
> File "/home/yann/histogram_mpldemo.py", line 159, in main
> 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?
More information about the grass-dev