[GRASS5] r.mapcalc bug/64bit?

Markus Neteler neteler at itc.it
Mon May 1 13:11:57 EDT 2006


On Mon, May 01, 2006 at 05:33:41PM +0100, Glynn Clements wrote:
> Markus Neteler wrote:
> 
> > [re-posted to the list as it may be of wider interest, maybe
> > someone knows?]
> > 
> > Glynn, all,
> > 
> > I have discovered a pressing problem (for me) in
> > r.mapcalc as far as I see. I am doing time series
> > processing of satellite data to find frost periods. As
> > far as I see the if() doesn't behave as it should:
> > 
> > # input data, look reasonable:
> > GRASS 6.1.cvs (pat):~ > r.info -r modis_t_a_lst1km20040102.daily_min
> > min=-24.290000
> > max=-16.510000
> >  
> > GRASS 6.1.cvs (pat):~ > r.info -r startday_previous
> > min=1
> > max=1
> >  
> > GRASS 6.1.cvs (pat):~ > r.info -r condition_previous
> > min=1
> > max=1
> > 
> > GRASS 6.1.cvs (pat):~ > r.info -r duration
> > min=1
> > max=1
> > 
> > # filter command to check if a new frost period starts or
> > # an existing one continues:
> > GRASS 6.1.cvs (pat):~ > r.mapcalc 'startday=if(modis_t_a_lst1km20040102.daily_min < -2.0 && (startday_previous == 0 || condition_previous == 0), 2, startday_previous)'
> >  100%
> > 
> > GRASS 6.1.cvs (pat):~ > r.info -r startday
> > min=-2147483648
> > max=-2147483648
> 
> So startday is all null.
> 
> What does the following say:
> 
> r.mapcalc 'test = isnull(modis_t_a_lst1km20040102.daily_min) + isnull(startday_previous) + isnull(condition_previous)'
> r.info -r test
> 

This test:

GRASS 6.1.cvs (pat):~ > r.mapcalc 'test = isnull(modis_t_a_lst1km20040102.daily_min) + isnull(startday_previous) + isnull(condition_previous)'
 100%
GRASS 6.1.cvs (pat):~ > r.info -r test
min=1
max=3
GRASS 6.1.cvs (pat):~ > r.univar test
total null and non-null cells: 1136163
total null cells: 0

Of the non-null cells:
----------------------
n: 1136163
minimum: 1
maximum: 3
range: 2
mean: 2.99634
standard deviation: 0.0730131
variance: 0.00533091
variation coefficient: 2.43674 %
sum: 3404331

There are *some* NULL pixels due to clouds which are propagated to
the other input maps of above if() condition:
GRASS 6.1.cvs (pat):~ > r.univar modis_t_a_lst1km20040102.daily_min

Processing ..  100%

total null and non-null cells: 1136163
total null cells: 1133919

Of the non-null cells:
----------------------
n: 2244
minimum: -24.29
maximum: -16.51
range: 7.78
mean: -20.5391
standard deviation: 1.77196
variance: 3.13983
variation coefficient: -8.62722 %
sum: -46089.82


Then entire thing loops over the maps day by day.

Markus




More information about the grass-dev mailing list