[GRASS-dev] [GRASS GIS] #2409: last call for options keys consolidation

Hi,

2014-11-28 18:12 GMT+01:00 Vaclav Petras <wenzeslaus@gmail.com>:

Please, keep all of us in the loop with updates on the remaining issues.

the major issue is how to correctly name element for '3D raster maps'.
Till now nobody came with better names as 'raster3d' (than `g.list
rast` will not work), '3draster' (need to be solved as python module
option) and 'volume' (you don't like). Anybody here has any idea?

Thanks, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

2014-11-28 18:12 GMT+01:00 Vaclav Petras <wenzeslaus@gmail.com>:

Please, keep all of us in the loop with updates on the remaining issues.

someone could also please go through [1] and check what parameters
should be also renamed (I skipped at least r.sim.* and v.net.*
modules)...

Thanks, Martin

[1] http://trac.osgeo.org/grass/attachment/ticket/2409/module_params_overview-2014-11-28.csv.gz

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

On Fri, Nov 28, 2014 at 12:56 PM, Martin Landa <landa.martin@gmail.com>
wrote:

2014-11-28 18:12 GMT+01:00 Vaclav Petras <wenzeslaus@gmail.com>:
> Please, keep all of us in the loop with updates on the remaining issues.

someone could also please go through [1] and check what parameters
should be also renamed (I skipped at least r.sim.* and v.net.*

I will look at r.sim.*

Anna

modules)...

Thanks, Martin

[1]
http://trac.osgeo.org/grass/attachment/ticket/2409/module_params_overview-2014-11-28.csv.gz

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Fri, Nov 28, 2014 at 6:09 PM, Anna Petrášová <kratochanna@gmail.com>
wrote:

On Fri, Nov 28, 2014 at 12:56 PM, Martin Landa <landa.martin@gmail.com>
wrote:

2014-11-28 18:12 GMT+01:00 Vaclav Petras <wenzeslaus@gmail.com>:
> Please, keep all of us in the loop with updates on the remaining issues.

someone could also please go through [1] and check what parameters
should be also renamed (I skipped at least r.sim.* and v.net.*

I will look at r.sim.*

Anna

modules)...

Thanks, Martin

[1]
http://trac.osgeo.org/grass/attachment/ticket/2409/module_params_overview-2014-11-28.csv.gz

What about r.stats using uppercase flags:

-A Print averaged values instead of intervals (floating-point maps only)
-N Do not report cells where all maps have no data
-C Report for cats floating-point ranges (floating-point maps only)

Is this something we should remove? Uppercase letters in options are not
supported (there was a discussion about it recently). Personally, I would
changed that to different lowercase letters (the lowercase a, n, c are
taken). We would have to use unrelated letters, because all related ones
are taken, so for example -A > -v, -N > -d, -C > -t (or any of
bdejkmqstuvwyz). But that might not be a big issue, there is already so
many flags, that one has to read the descriptions carefully anyway. Anyone
against renaming?

Thanks,

Anna

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by neteler):

Replying to [comment:65 martinl]:
> Replying to [comment:62 mlennert]:
> > I corrected it in r63211 and r63212, but please watch out for this.
>
> thanks anyway I am going to fix scripts and manuals using a script based
on source:grass/trunk/lib/gis/renamed_options.

For the record: Martin fixed a lot in r63261 (+ backported). Thanks.

Personally I would be happy to see more people submitting examples (...I
wrote many).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:72&gt;
GRASS GIS <http://grass.osgeo.org>

Anna Petrášová wrote:

What about r.stats using uppercase flags:

-A Print averaged values instead of intervals (floating-point maps only)
-N Do not report cells where all maps have no data
-C Report for cats floating-point ranges (floating-point maps only)

This isn't so much of an issue. As flags are limited to a single
character, there are fewer choices available. Modules with many flags,
would end up having to use almost entirely arbitrary flag names once
the first, second, third, ... choices were already taken.

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

On Sat, Nov 29, 2014 at 4:58 PM, Glynn Clements <glynn@gclements.plus.com>
wrote:

Anna Petrášová wrote:

> What about r.stats using uppercase flags:
>
> -A Print averaged values instead of intervals (floating-point maps only)
> -N Do not report cells where all maps have no data
> -C Report for cats floating-point ranges (floating-point maps only)

This isn't so much of an issue. As flags are limited to a single
character, there are fewer choices available. Modules with many flags,
would end up having to use almost entirely arbitrary flag names once
the first, second, third, ... choices were already taken.

Ok then. We should probably try to avoid too many flags in the first place.

Thanks
Anna

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

2014-11-29 0:09 GMT+01:00 Anna Petrášová <kratochanna@gmail.com>:

someone could also please go through [1] and check what parameters
should be also renamed (I skipped at least r.sim.* and v.net.*

I will look at r.sim.*

thanks! Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

Hi,

2014-11-29 23:09 GMT+01:00 Anna Petrášová <kratochanna@gmail.com>:

Ok then. We should probably try to avoid too many flags in the first place.

yes, some modules have a lot of mutually exclusive flags. They could
be replaced by parameter with single or multiple options (in the case
that the flags are not mutually exclusive). See e.g. change in
r.reclass.area [1]. Good candidate is g.region, and many others.

Martin

[1] http://trac.osgeo.org/grass/changeset/63037

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

2014-11-30 10:41 GMT+01:00 Martin Landa <landa.martin@gmail.com>:

Hi,

2014-11-29 23:09 GMT+01:00 Anna Petrášová <kratochanna@gmail.com>:

Ok then. We should probably try to avoid too many flags in the first place.

yes, some modules have a lot of mutually exclusive flags. They could
be replaced by parameter with single or multiple options (in the case

to make live easier for the user we could add to libgis file similar
to `renamed_options` - `replaced_flags`. That the parser could print
info like

Flag -%c has been replaced by option <%s>. Please update your script.

Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by martinl):

Replying to [comment:70 wenzeslaus]:

`rast3d` to `raster3d/3draster/volume`. From what was said I would
especially point out that it

another option could to my mind. To use 'raster3d' and modify the parser
in the way that it would support also 'rast' and 'rast3d' with appropriate
warning

{{{
g.list rast,rast3d
WARNING: Option <rast> has been renamed to <raster>. Please update your
script.
WARNING: Option <rast3d> has been renamed to <raster3d>. Please update
your script.
raster maps...
3d raster maps...
}}}

What do you think about this option?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:73&gt;
GRASS GIS <http://grass.osgeo.org>

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by martinl):

Replying to [comment:73 martinl]:
> another option could to my mind. To use 'raster3d' and modify the parser
in the way that it would support also 'rast' and 'rast3d' with appropriate
warning
>
{{{
> g.list rast,rast3d
> WARNING: Option <rast> has been renamed to <raster>. Please update your
script.
> WARNING: Option <rast3d> has been renamed to <raster3d>. Please update
your script.
> raster maps...
> 3d raster maps...
}}}

Personally I am still for '3draster' (and to solve PyGRASS issue raised by
Anna), so

{{{
  g.list rast,rast3d
  WARNING: Option <rast> has been renamed to <raster>. Please update your
script.
  WARNING: Option <rast3d> has been renamed to <3draster>. Please update
your script.
  raster maps...
  3d raster maps...
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:74&gt;
GRASS GIS <http://grass.osgeo.org>

On Sun, Nov 30, 2014 at 4:41 AM, Martin Landa <landa.martin@gmail.com>
wrote:

Hi,

2014-11-29 23:09 GMT+01:00 Anna Petrášová <kratochanna@gmail.com>:
> Ok then. We should probably try to avoid too many flags in the first
place.

yes, some modules have a lot of mutually exclusive flags. They could
be replaced by parameter with single or multiple options (in the case
that the flags are not mutually exclusive). See e.g. change in
r.reclass.area [1]. Good candidate is g.region, and many others.

I would keep g.region flags, I think this is one of the most frequently
used modules in command line and GRASS users wouldn't really appreciate
changing the interface (even backwards compatible). Flags are faster to
type, too. So we should have a good reason for changing it. Perhaps there
are better candidates for flag -> option change, I don't know now.

Anna

Martin

[1] http://trac.osgeo.org/grass/changeset/63037

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by glynn):

Replying to [comment:73 martinl]:

> another option could to my mind. To use 'raster3d' and modify the parser
in the way that it would support also 'rast' and 'rast3d' with appropriate
warning

I don't think that "rast" should generate a warning. We want the user to
be able to abbreviate option names when running commands interactively. At
the same time, it's preferable for scripts to avoid abbreviations, which
they can't do if the actual option name is itself an abbreviation.

Perhaps we should relax the rule relating to ambiguous abbreviations for
the case where one option name is a prefix of another?

At present, if a module has options named "raster" and "raster3d", "rast"
(or any other abbreviation of "raster") will be rejected as ambiguous. The
option-matching function has to explicitly check for the case where an
option name is given in full, otherwise even the unabbreviated option name
would be rejected as ambiguous.

The change wouldn't be trivial; the function can no longer simply count
matches, it has to record them. But as a side-effect of that, the error
message for ambiguous options could list all of the matches.

If we don't make that change, then we should try to avoid the situation
where one option name is a prefix of another. In particular, that
precludes "raster3d" or "rast3d".

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:75&gt;
GRASS GIS <http://grass.osgeo.org>

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by cmbarton):

Could it cause a problem somewhere down the line to have this term
beginning with a number--e.g. If it is used to name a temp file or
something?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:76&gt;
GRASS GIS <http://grass.osgeo.org>

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by annakrat):

Replying to [comment:76 cmbarton]:
> Could it cause a problem somewhere down the line to have this term
beginning with a number--e.g. If it is used to name a temp file or
something?

As I already said, it causes problems for Python because keyword parameter
can't start with number. This is solvable by adding underscore and some
special handling of this case, which is partially there already. It
violates pep8.

Otherwise, I am not sure if we can expect some problems with temporal
database with 3D raster time series. If the column names stay as they are
now, it shouldn't be problem I think?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:77&gt;
GRASS GIS <http://grass.osgeo.org>

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by cmbarton):

Given this, raster3d seems preferable. I suppose we could switch all to
"volume", which was used inconsistently at some time in the past. Or
perhaps "voxel"?

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:78&gt;
GRASS GIS <http://grass.osgeo.org>

* Martin Landa <landa.martin@gmail.com> [2014-11-25 00:34:59 +0100]:

Ciao Niko,

2014-11-24 20:09 GMT+01:00 Nikos Alexandris <nik@nikosalexandris.net>:
> can I ask for the script, or the way, you extracted the flags and options
> per module?

sure, http://svn.osgeo.org/grass/sandbox/martinl/print_module_parameters_csv.py

Martin, thanks for this one! Slowly, as usual, I am experimenting with
LaTeX, LyX and syntax highlighting. Here an example:

<https://github.com/NikosAlexandris/grassy-listing&gt;

and here definitions and settings for the listings package, maybe useful:

- <https://github.com/NikosAlexandris/grassy-listing/blob/master/listings/grassy_definitions.tex&gt;
- <https://github.com/NikosAlexandris/grassy-listing/blob/master/listings/grassy_lstset.tex&gt;

Nikos

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by glynn):

Replying to [comment:77 annakrat]:
> Replying to [comment:76 cmbarton]:
> > Could it cause a problem somewhere down the line to have this term
beginning with a number--e.g. If it is used to name a temp file or
something?
>
> As I already said, it causes problems for Python because keyword
parameter can't start with number. This is solvable by adding underscore
and some special handling of this case, which is partially there already.
It violates pep8.

PEP8 is a style guide. There is no inherent reason why an argument name
cannot start with an underscore. And we're not even talking about explicit
arguments; such arguments will only ever be obtained via the **kwargs
mechanism.

In fact, I think that this is why I chose to use a leading underscore
rather than a trailing underscore.

Still, I'd rather avoid having option names start with a digit. But unless
we relax the ambiguity check, it wouldn't outweigh my preference to avoid
using an option name which has a very common option name (rast or raster)
as a prefix.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:79&gt;
GRASS GIS <http://grass.osgeo.org>

#2409: last call for options keys consolidation
----------------------------------+-----------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: task | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Default | Version: unspecified
Keywords: standardized options | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------+-----------------------------------------

Comment(by wenzeslaus):

Replying to [comment:79 glynn]:
> Replying to [comment:77 annakrat]:
> > Replying to [comment:76 cmbarton]:
> > > Could it cause a problem somewhere down the line to have this term
beginning with a number--e.g. If it is used to name a temp file or
something?
> >
> > As I already said, it causes problems for Python because keyword
parameter can't start with number. This is solvable by adding underscore
and some special handling of this case, which is partially there already.
It violates pep8.
>
> PEP8 is a style guide. There is no inherent reason why an argument name
cannot start with an underscore. And we're not even talking about explicit
arguments; such arguments will only ever be obtained via the **kwargs
mechanism.

The problem may come once you want to use parameter as an variable or
member variable. In later case underscore would means private which is
technique not limited to Python. I'm also afraid that this can hit us or
somebody else in some other language or system. Almost nothing allows
numbers at the beginning of identifiers. I also think that for 3D raster
it is much more probable that you hit this issue. For example, how should
I name variable in my script which holds 3D raster map name or its
maximum? `_3draster_name`? `_3draster_max`? I can of course name my
variables whatever I want but wouldn't we stick to `rast3d` or `raster3d`
in the GRASS source code anyway?

>
> In fact, I think that this is why I chose to use a leading underscore
rather than a trailing underscore.
>
> Still, I'd rather avoid having option names start with a digit. But
unless we relax the ambiguity check, it wouldn't outweigh my preference to
avoid using an option name which has a very common option name (rast or
raster) as a prefix.

I'm glad you are saying that. I think it is really important to state the
priorities and motivations. If we just want backwards compatibility, then
some special check in the parser can handle old short option names. And if
we value the most backwards compatibility and short options, we probably
should not not shorten at all in these special cases (type names).

Perhaps it is useful to ask why we want short options. It is for manual
typing? Well then we perhaps should use techniques used elsewhere. And we
are actually partially doing it. There is IDE-like auto-complete in GUI,
Python dir completed is implemented for PyGRASS module interface and of
course Linux command line auto-completes module names. So why not to take
it further and auto-complete also parameters and perhaps other things by
implementing auto-complete for shell?

Classic unix-like command line is anyway the only place where short
options really matter if you consider the things above and also that you
should not use shortened option names in scripts because it is not
readable (that's why we are unabbreviating them, right?).

Perhaps we don't have to unabbreviate everything. It seems to me that
there is no will to unabbreviate options for `g.region` or module names
containing rast, vect or rast3d. I'm for explicit long descriptive option
names but if it creates more issues then it solves (`3draster`) and if
everybody would be using the shortened version all the time anyway
(`rast`, ...), I prefer not to change them.

If we want short options for whatever reason, let's standardize them,
rather than standardize the long options and provide ways how to avoid the
standard.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2409#comment:80&gt;
GRASS GIS <http://grass.osgeo.org>