Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-23 Thread Markus Neteler
On Wed, Mar 23, 2016 at 3:50 PM, Vaclav Petras  wrote:
> On Wed, Mar 23, 2016 at 6:44 AM, Markus Neteler  wrote:
>>
>> On Tue, Mar 22, 2016 at 10:37 PM, Markus Metz
>>  wrote:
>> > On Fri, Mar 18, 2016 at 3:10 PM, Markus Neteler 
>> > wrote:
>> ...
>>  GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
>> ...
>> > Is there any reason why this should not work? According to the manual
>> > it should work.
>> >
>> > If neither red or green or blue are given, r.rgb could use
>> > red=${input}.r
>> > green=${input}.g
>> > blue=${input}.b
>>
>> Yes, this would exactly be the user's expectation (at least mine as a
>> user) who has even read the manual :)
>
>
> I though you expected that the names are not generated inside the module
> since you changed the manual according to my commit (r68072) and backported
> both commits.

Yes, to get rid of this behaviour:

GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
syntax error, unexpected $end, expecting VARNAME or NAME or STRING
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

Still the requirement to write 3 times almost the same output name is not ideal.

> I like the current state. Perhaps not so convenient when advanced users work
> in the command line but in all other cases it requires you to be explicit,
> thus better for beginners (who don't have to guess the new name) and the GUI
> (wxGUI can automatically show the new maps only when they are specified in
> the command line).

I see. Too bad that I also like the command line :-)

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-23 Thread Vaclav Petras
On Wed, Mar 23, 2016 at 6:44 AM, Markus Neteler  wrote:

> On Tue, Mar 22, 2016 at 10:37 PM, Markus Metz
>  wrote:
> > On Fri, Mar 18, 2016 at 3:10 PM, Markus Neteler 
> wrote:
> ...
>  GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
> ...
> > Is there any reason why this should not work? According to the manual
> > it should work.
> >
> > If neither red or green or blue are given, r.rgb could use
> > red=${input}.r
> > green=${input}.g
> > blue=${input}.b
>
> Yes, this would exactly be the user's expectation (at least mine as a
> user) who has even read the manual :)


I though you expected that the names are not generated inside the module
since you changed the manual according to my commit (r68072) and backported
both commits.

I like the current state. Perhaps not so convenient when advanced users
work in the command line but in all other cases it requires you to be
explicit, thus better for beginners (who don't have to guess the new name)
and the GUI (wxGUI can automatically show the new maps only when they are
specified in the command line).

https://trac.osgeo.org/grass/changeset/68108
https://trac.osgeo.org/grass/changeset/68077
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-23 Thread Markus Neteler
On Tue, Mar 22, 2016 at 10:37 PM, Markus Metz
 wrote:
> On Fri, Mar 18, 2016 at 3:10 PM, Markus Neteler  wrote:
...
 GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
...
> Is there any reason why this should not work? According to the manual
> it should work.
>
> If neither red or green or blue are given, r.rgb could use
> red=${input}.r
> green=${input}.g
> blue=${input}.b

Yes, this would exactly be the user's expectation (at least mine as a
user) who has even read the manual :)

markusN

> That would be easy to fix.
>
> Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-22 Thread Vaclav Petras
On Tue, Mar 22, 2016 at 5:37 PM, Markus Metz 
wrote:

> Is there any reason why this should not work? According to the manual
> it should work.
>
> If neither red or green or blue are given, r.rgb could use
> red=${input}.r
> green=${input}.g
> blue=${input}.b
>
> That would be easy to fix.
>


I thought we tried to remove this type of default parameters from most of
the modules (with the exception of import/export). Perhaps not.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-22 Thread Markus Metz
On Fri, Mar 18, 2016 at 3:10 PM, Markus Neteler  wrote:
> On Wed, Mar 16, 2016 at 9:24 PM, Vaclav Petras  wrote:
>>
>> On Wed, Mar 16, 2016 at 1:27 PM, Markus Neteler  wrote:
>>>
>>>
>>> I just needed r.rgb and found the script broken: must be a silly bug
>>> but I don't see it..:
>>>
>>> # NC
>>>
>>> GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
>>>
>>> syntax error, unexpected $end, expecting VARNAME or NAME or STRING
>>> Parse error
>>> ERROR: parse error
>>> ERROR: An error occurred while running r.mapcalc
>>>
>>> Any idea?

Is there any reason why this should not work? According to the manual
it should work.

If neither red or green or blue are given, r.rgb could use
red=${input}.r
green=${input}.g
blue=${input}.b

That would be easy to fix.

Markus M

>>
>>
>>
>> Not all options are required but at least one of them:
>>
>> https://trac.osgeo.org/grass/changeset/68072
>
> I see, that now works:
>
> GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
> Description:
>  Splits a raster map into red, green and blue maps.
> Keywords:
> [...]
> ERROR: At least one of the following options is required: ,
>  and 
>
> ok. But another error occurs (missing error handling if the output
> names were selected to be identica):
>
> GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
> red=elevation green=elevation blue=elevation
> syntax error, unexpected '=', expecting '('
> Parse error
> ERROR: parse error
> ERROR: An error occurred while running r.mapcalc
>
> Eventually this works:
> r.rgb input=elevation red=elevation.r green=elevation.g blue=elevation.b
>
> Perhaps there is an elegant solution to catch the (user) error above?
>
> Markus
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-19 Thread Vaclav Petras
On Wed, Mar 16, 2016 at 1:27 PM, Markus Neteler  wrote:

>
> I just needed r.rgb and found the script broken: must be a silly bug
> but I don't see it..:
>
> # NC
>
> GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
>
> syntax error, unexpected $end, expecting VARNAME or NAME or STRING
> Parse error
> ERROR: parse error
> ERROR: An error occurred while running r.mapcalc
>
> Any idea?



Not all options are required but at least one of them:

https://trac.osgeo.org/grass/changeset/68072
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-19 Thread Markus Neteler
On Wed, Mar 16, 2016 at 9:24 PM, Vaclav Petras  wrote:
>
> On Wed, Mar 16, 2016 at 1:27 PM, Markus Neteler  wrote:
>>
>>
>> I just needed r.rgb and found the script broken: must be a silly bug
>> but I don't see it..:
>>
>> # NC
>>
>> GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
>>
>> syntax error, unexpected $end, expecting VARNAME or NAME or STRING
>> Parse error
>> ERROR: parse error
>> ERROR: An error occurred while running r.mapcalc
>>
>> Any idea?
>
>
>
> Not all options are required but at least one of them:
>
> https://trac.osgeo.org/grass/changeset/68072

I see, that now works:

GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
Description:
 Splits a raster map into red, green and blue maps.
Keywords:
[...]
ERROR: At least one of the following options is required: ,
 and 

ok. But another error occurs (missing error handling if the output
names were selected to be identica):

GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation
red=elevation green=elevation blue=elevation
syntax error, unexpected '=', expecting '('
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

Eventually this works:
r.rgb input=elevation red=elevation.r green=elevation.g blue=elevation.b

Perhaps there is an elegant solution to catch the (user) error above?

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-19 Thread Markus Neteler
Hi,

I just needed r.rgb and found the script broken: must be a silly bug
but I don't see it..:

# NC

GRASS 7.1.svn (nc_spm_08_grass7): > r.rgb input=elevation

syntax error, unexpected $end, expecting VARNAME or NAME or STRING
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc

Any idea?

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-19 Thread Glynn Clements

Vaclav Petras wrote:

> > ok. But another error occurs (missing error handling if the output
> > names were selected to be identica):
> > ...
> > Perhaps there is an elegant solution to catch the (user) error above?
> 
> Isn't this an issue for every module? I'm not sure if we have a general
> solution (as in the previous case).

Most modules won't explicitly complain if you use the same map name
for multiple outputs, although it's anyone's guess as to what actually
ends up in the map.

I'm reasonably sure that the primary files (cellhd, cell/fcell, null,
f_{format,quant,range} etc) will be consistent, but metadata files
which are written separately (colour table, categories, history, etc)
may be from a different output.

The fact that r.rgb.py fails in this case is really just a
coincidence. It won't complain about using the same name for all
outputs, only for the case where one of the outputs matches the input. 

The error arises because, in r.mapcalc, using a name on the left-hand
side of an assignment causes the name to be interpreted as a variable
rather than as a map, and the r#/g#/b# modifiers can only be applied
to maps, not variables.

-- 
Glynn Clements 
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] r.rgb: syntax error, unexpected $end, expecting VARNAME or NAME or STRING

2016-03-18 Thread Vaclav Petras
On Fri, Mar 18, 2016 at 10:10 AM, Markus Neteler  wrote:

>
> ok. But another error occurs (missing error handling if the output
> names were selected to be identica):
> ...
>
> Perhaps there is an elegant solution to catch the (user) error above?


Isn't this an issue for every module? I'm not sure if we have a general
solution (as in the previous case).
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev