[GRASS-user] r.mapcalc trouble

Hi,

I'm having some trouble with clipping a group of raster maps. I tried
the following:

na_ecoreg is a vector map covering all of north america
clipper is a manually digitized vector map that touches all the areas
of na_ecoreg that I want to clip the rasters with
wc_mean_temp_dry is a worldclim raster map covering the whole area

#-------
v.select ainput=na_ecoreg binput=clipper output=eco_clip
v.to.rast input=eco_clip output=eco_clip use=val value=1
r.mapcalc mean_temp_dry_clip='if(wc_mean_temp_dry && eco_clip,
  wc_mean_temp_dry, null())'
#-------

I've done this for eight raster maps. Some of the maps I've produced
are fine, but others show null raster pixels in the clipped raster
that are not in the source raster map. The null pixels are not present
in the eco_clip raster map either. What could be causing this?

--
Regards,

Tyler Smith

Tyler Smith wrote:

I'm having some trouble with clipping a group of raster maps. I tried
the following:

na_ecoreg is a vector map covering all of north america
clipper is a manually digitized vector map that touches all the areas
of na_ecoreg that I want to clip the rasters with
wc_mean_temp_dry is a worldclim raster map covering the whole area

#-------
v.select ainput=na_ecoreg binput=clipper output=eco_clip
v.to.rast input=eco_clip output=eco_clip use=val value=1
r.mapcalc mean_temp_dry_clip='if(wc_mean_temp_dry && eco_clip,
  wc_mean_temp_dry, null())'
#-------

I've done this for eight raster maps. Some of the maps I've produced
are fine, but others show null raster pixels in the clipped raster
that are not in the source raster map. The null pixels are not present
in the eco_clip raster map either. What could be causing this?

Are you taking into account that any cells which are zero in
wc_mean_temp_dry will be null in the result?

Or did you mean to use:

  !isnull(wc_mean_temp_dry) && !isnull(eco_clip)

as the test expression?

--
Glynn Clements <glynn@gclements.plus.com>

On Sun, Mar 11, 2007 at 07:05:26PM +0000, Glynn Clements wrote:

> I'm having some trouble with clipping a group of raster maps. I tried
> the following:
>
> r.mapcalc mean_temp_dry_clip='if(wc_mean_temp_dry && eco_clip,
> wc_mean_temp_dry, null())'

Are you taking into account that any cells which are zero in
wc_mean_temp_dry will be null in the result?

Or did you mean to use:

  !isnull(wc_mean_temp_dry) && !isnull(eco_clip)

Thank you, that was the expression I should have used. Another problem
solved!

--
Regards,

Tyler Smith