[GRASS-user] r.mapcalc(nulls into 0)

Hi,

I am trying to do something really simple but not finding the right way to do it.

I need to convert nulls into zeros. I have done this:
r.mapcalc “raster2 = if(raster1 = null(), 0, raster1)”
r.mapcalc “raster2 = if(raster1 == null(), 0, raster1)”

But this convert all cells into nulls.

I have tried another approach with r.reclass, rules:

null/null()/no data/nodata…=0
1=1
2=2
3=2
4=2
5=2

No fun, all I get is an ERROR: null/null()/no data/nodata…=0

What I’m doing wrong?

Eloi Ribeiro
GIS Analyst
39,45º -0,40º
flavors.me/eloiribeiro

Hi,

I think you should do

raster2=if(isnull(raster1),0,raster1)

El 11/07/12 14:02, Eloi Ribeiro escribió:

Hi,

I am trying to do something really simple but not finding the right way to do it.
I need to convert nulls into zeros. I have done this:
/r.mapcalc "raster2 = if(raster1 = null(), 0, raster1)" /
/r.mapcalc "raster2 = if(raster1 == null(), 0, raster1)" //
/
But this convert all cells into nulls.

I have tried another approach with r.reclass, rules:
null/null()/no data/nodata...=0
1=1
2=2
3=2
4=2
5=2

No fun, all I get is an ERROR: null/null()/no data/nodata...=0

What I'm doing wrong?

Eloi Ribeiro
GIS Analyst
39,45º -0,40º
flavors.me/eloiribeiro <http://flavors.me/eloiribeiro&gt;

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--

Alberto Pettazzi

MeteoGalicia - Departamento de Climatología y Observación

Consellería de Medio Ambiente, Territorio e Infraestruturas

Rúa de Roma, 6

15707 Santiago de Compostela. A Coruña

Teléfono: +34-881-999646

e-mail: alberto.pettazzi@meteogalicia.es <mailto:alberto.pettazzi@meteogalicia.es>

or simply: r.null raster1 null=0 (converts the original, not a second copy)

···

On 11/07/2012 15:12, Alberto Pettazzi wrote:

This mail was received via Mail-SeCure System.

-- 
Micha Silver
052-3665918

Hi,

I think you should do

raster2=if(isnull(raster1),0,raster1)

El 11/07/12 14:02, Eloi Ribeiro escribió:

Hi,

I am trying to do something really simple but not finding the right way to do it.

I need to convert nulls into zeros. I have done this:
r.mapcalc “raster2 = if(raster1 = null(), 0, raster1)”
r.mapcalc “raster2 = if(raster1 == null(), 0, raster1)”

But this convert all cells into nulls.

I have tried another approach with r.reclass, rules:

null/null()/no data/nodata…=0
1=1
2=2
3=2
4=2
5=2

No fun, all I get is an ERROR: null/null()/no data/nodata…=0

What I’m doing wrong?

Eloi Ribeiro
GIS Analyst
39,45º -0,40º
flavors.me/eloiribeiro

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

Alberto Pettazzi

MeteoGalicia - Departamento de Climatología y Observación

Consellería de Medio Ambiente, Territorio e Infraestruturas

Rúa de Roma, 6

15707 Santiago de Compostela. A Coruña

Teléfono: +34-881-999646

e-mail: alberto.pettazzi@meteogalicia.es

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

This mail was received via Mail-SeCure System.

Thank you all! Solved.

Eloi Ribeiro
GIS Analyst
39,45º -0,40º
flavors.me/eloiribeiro

2012/7/11 Alberto Pettazzi <alberto.pettazzi@meteogalicia.es>

Hi,

I think you should do

raster2=if(isnull(raster1),0,raster1)

El 11/07/12 14:02, Eloi Ribeiro escribió:

Hi,

I am trying to do something really simple but not finding the right way to do it.

I need to convert nulls into zeros. I have done this:
r.mapcalc “raster2 = if(raster1 = null(), 0, raster1)”
r.mapcalc “raster2 = if(raster1 == null(), 0, raster1)”

But this convert all cells into nulls.

I have tried another approach with r.reclass, rules:

null/null()/no data/nodata…=0
1=1
2=2
3=2
4=2
5=2

No fun, all I get is an ERROR: null/null()/no data/nodata…=0

What I’m doing wrong?

Eloi Ribeiro
GIS Analyst
39,45º -0,40º
flavors.me/eloiribeiro

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

Alberto Pettazzi

MeteoGalicia - Departamento de Climatología y Observación

Consellería de Medio Ambiente, Territorio e Infraestruturas

Rúa de Roma, 6

15707 Santiago de Compostela. A Coruña

Teléfono: +34-881-999646

e-mail: alberto.pettazzi@meteogalicia.es


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user