[GRASS-dev] matplotlib example script
Michael Barton
michael.barton at asu.edu
Fri Jul 25 19:11:30 EDT 2008
The code is pretty simple. I would guess that NAN data could be
discarded when making the list that is histogrammed. I'm kind of
surprised that it shows up as r.stats is run to discard nulls. But I
guess these aren't seen as nulls by r.stats.
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
More information about the grass-dev
mailing list