GRASS7 r.mapcalc not working

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

GRASS7 r.mapcalc not working

caesarivs
Hello list,

Is anyone having issues with r.mapcalc on grass7 r59245?

I'm getting:

syntax error, unexpected ',', expecting $end
Parse error
ERROR: parse error

Everytime I try to do an "if(a,b,c)" statement like:

"mapmask = if(mask1 && mask2, mask2, null())"

I found another way to do it by doing:

"mapmask = mask1 + mask2"

But I still think r.mapcalc is misbeheaving on this revision

--
César Augusto Ramírez Franco
Laboratorio de Sistemas Complejos Naturales
Escuela de Geociencias
Facultad de Ciencias
Universidad Nacional de Colombia - Sede Medellín
Teléfono: (57-4) 430 9369 - 301 389 5607

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: GRASS7 r.mapcalc not working

Markus Neteler
Hello Cèsar,

On Thu, Mar 13, 2014 at 2:09 PM, César Augusto Ramírez Franco
<[hidden email]> wrote:

> Hello list,
>
> Is anyone having issues with r.mapcalc on grass7 r59245?
>
> I'm getting:
>
> syntax error, unexpected ',', expecting $end
> Parse error
> ERROR: parse error
>
> Everytime I try to do an "if(a,b,c)" statement like:
>
> "mapmask = if(mask1 && mask2, mask2, null())"
>
> I found another way to do it by doing:
>
> "mapmask = mask1 + mask2"
>
> But I still think r.mapcalc is misbeheaving on this revision

I tried here:

GRASS 7.0.svn (patUTM32):~ > r.mapcalc "mask1 = 1"
 100%
GRASS 7.0.svn (patUTM32):~ > r.mapcalc "mask2 = 2"
 100%
GRASS 7.0.svn (patUTM32):~ > r.mapcalc "mapmask = if(mask1 && mask2,
mask2, null())"
 100%
GRASS 7.0.svn (patUTM32):~/software/grass70 > g.version -g
version=7.0.svn
date=2014
revision=59246M
build_date=2014-03-13

Do you use the wxGUI command line (maybe eating the & chars?) or the terminal?
And which operating system?

Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: GRASS7 r.mapcalc not working

caesarivs
Hello Markus, I'm using the terminal on Debian Testing/SID

I'm trying to make a mask for the pixels of a landsat 8 image inside a basin

mask1 is my basin, and mask2 is the cloudmask of the landsat image

I calculated the cloudmask with

r.mapcalc "cloudmask = if( (BQA ==1 || BQA >= 49152), null(), 1)"

Maybe I'm using the wrong logic inside the if statement? How do I get r.mapcalc to make an intersection of the two masks other than summing them?

Thanks

2014-03-13 10:47 GMT-05:00 Markus Neteler <[hidden email]>:
Hello Cèsar,

On Thu, Mar 13, 2014 at 2:09 PM, César Augusto Ramírez Franco
<[hidden email]> wrote:
> Hello list,
>
> Is anyone having issues with r.mapcalc on grass7 r59245?
>
> I'm getting:
>
> syntax error, unexpected ',', expecting $end
> Parse error
> ERROR: parse error
>
> Everytime I try to do an "if(a,b,c)" statement like:
>
> "mapmask = if(mask1 && mask2, mask2, null())"
>
> I found another way to do it by doing:
>
> "mapmask = mask1 + mask2"
>
> But I still think r.mapcalc is misbeheaving on this revision

I tried here:

GRASS 7.0.svn (patUTM32):~ > r.mapcalc "mask1 = 1"
 100%
GRASS 7.0.svn (patUTM32):~ > r.mapcalc "mask2 = 2"
 100%
GRASS 7.0.svn (patUTM32):~ > r.mapcalc "mapmask = if(mask1 && mask2,
mask2, null())"
 100%
GRASS 7.0.svn (patUTM32):~/software/grass70 > g.version -g
version=7.0.svn
date=2014
revision=59246M
build_date=2014-03-13

Do you use the wxGUI command line (maybe eating the & chars?) or the terminal?
And which operating system?

Markus



--
César Augusto Ramírez Franco
Laboratorio de Sistemas Complejos Naturales
Escuela de Geociencias
Facultad de Ciencias
Universidad Nacional de Colombia - Sede Medellín
Teléfono: (57-4) 430 9369 - 301 389 5607

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: GRASS7 r.mapcalc not working

Markus Neteler
On Thu, Mar 13, 2014 at 5:28 PM, César Augusto Ramírez Franco
<[hidden email]> wrote:

> Hello Markus, I'm using the terminal on Debian Testing/SID
>
> I'm trying to make a mask for the pixels of a landsat 8 image inside a basin
>
> mask1 is my basin, and mask2 is the cloudmask of the landsat image
>
> I calculated the cloudmask with
>
> r.mapcalc "cloudmask = if( (BQA ==1 || BQA >= 49152), null(), 1)"
>
> Maybe I'm using the wrong logic inside the if statement? How do I get
> r.mapcalc to make an intersection of the two masks other than summing them?

I would use the bitpatterns of the QA file. Some example you can find here:

http://courses.neteler.org/processing-landsat8-data-in-grass-gis-7/
--> 8. Applying the Landsat 8 Quality Assessment (QA) Band

Best
Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: GRASS7 r.mapcalc not working

Glynn Clements
In reply to this post by caesarivs

César Augusto Ramírez Franco wrote:

> Is anyone having issues with r.mapcalc on grass7 r59245?

The last change to the r.mapcalc code (as opposed to the HTML
documentation) was 7 months ago (r57334), which fixed a typo in an
error message.

The last change to the grammar was 12 months ago (r55504), and that
just implemented the error rule explicitly (rather than relying upon
flex implementing it as an extension).

First, I suggest ensuring that your working copy is clean, and
re-compiling from scratch. If the issue persists, please provide a
test case which uses one of the standard data sets (or an empty
mapset).

--
Glynn Clements <[hidden email]>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: GRASS7 r.mapcalc not working

Glynn Clements
In reply to this post by caesarivs

César Augusto Ramírez Franco wrote:

> I'm getting:
>
> syntax error, unexpected ',', expecting $end
> Parse error
> ERROR: parse error
>
> Everytime I try to do an "if(a,b,c)" statement like:
>
> "mapmask = if(mask1 && mask2, mask2, null())"

FWIW, I have no problem running that exact command (having first
generated random raster maps named "mask1" and "mask2").

Is this via wxGUI or the shell?

--
Glynn Clements <[hidden email]>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: GRASS7 r.mapcalc not working

caesarivs
I was using the shell, but I solved it by making mask1 == 1 && mask2 == 1

​Thank you​


2014-03-15 9:32 GMT-05:00 Glynn Clements <[hidden email]>:

César Augusto Ramírez Franco wrote:

> I'm getting:
>
> syntax error, unexpected ',', expecting $end
> Parse error
> ERROR: parse error
>
> Everytime I try to do an "if(a,b,c)" statement like:
>
> "mapmask = if(mask1 && mask2, mask2, null())"

FWIW, I have no problem running that exact command (having first
generated random raster maps named "mask1" and "mask2").

Is this via wxGUI or the shell?

--
Glynn Clements <[hidden email]>



--
César Augusto Ramírez Franco
Laboratorio de Sistemas Complejos Naturales
Escuela de Geociencias
Facultad de Ciencias
Universidad Nacional de Colombia - Sede Medellín
Teléfono: (57-4) 430 9369 - 301 389 5607

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user