[GRASS-dev] [GRASS-SVN] r54302 - grass/trunk/scripts/r.mask

Hi Markus,

2012/12/16 <svn_grass@osgeo.org>:

r.mask: fix #1838

great addition! Probably we could also merge `maskcats` with `cats`
parameter. The same syntax could be used for raster and vectors.

maskcats=" 1 2 3 thru 7 *"

would become

cats="1,2,3-7,*"

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Sun, Dec 16, 2012 at 12:42 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi Markus,

2012/12/16 <svn_grass@osgeo.org>:

r.mask: fix #1838

great addition! Probably we could also merge `maskcats` with `cats`
parameter. The same syntax could be used for raster and vectors.

maskcats=" 1 2 3 thru 7 *"

would become

cats="1,2,3-7,*"

This is not possible because r.reclass expects the (raster) maskcats
syntax, not the (vector) cats syntax. Each syntax is well established
and I don't think it's a good idea to sync the two (requiring too many
low-level changes that are neither bug fixes nor performance
improvements).

Markus M

Hi,

On 16 December 2012 01:11, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Sun, Dec 16, 2012 at 12:42 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi Markus,

2012/12/16 <svn_grass@osgeo.org>:

r.mask: fix #1838

great addition! Probably we could also merge `maskcats` with `cats`
parameter. The same syntax could be used for raster and vectors.

maskcats=" 1 2 3 thru 7 *"

would become

cats="1,2,3-7,*"

This is not possible because r.reclass expects the (raster) maskcats
syntax, not the (vector) cats syntax. Each syntax is well established
and I don't think it's a good idea to sync the two (requiring too many
low-level changes that are neither bug fixes nor performance
improvements).

But it is interface improvement. It would be great for novices.

However, it is also interface change. I thought that compatibility
would be the problem. I understand that all calls to r.reclass and
others which are using "thru" syntax need to be changed. What do you
mean by low-level changes?

Maybe, it would be possible to have some backwards compatibility. In
Python (with regular expressions), it would be probably easy to
implement at least some level of compatibility (not sure about C).

Vaclav

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

Hi,

On Sun, Dec 16, 2012 at 8:55 AM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

Hi,

On 16 December 2012 01:11, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Sun, Dec 16, 2012 at 12:42 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi Markus,

2012/12/16 <svn_grass@osgeo.org>:

r.mask: fix #1838

great addition! Probably we could also merge `maskcats` with `cats`
parameter. The same syntax could be used for raster and vectors.

maskcats=" 1 2 3 thru 7 *"

would become

cats="1,2,3-7,*"

This is not possible because r.reclass expects the (raster) maskcats
syntax, not the (vector) cats syntax. Each syntax is well established
and I don't think it's a good idea to sync the two (requiring too many
low-level changes that are neither bug fixes nor performance
improvements).

But it is interface improvement. It would be great for novices.

+1

Moreover I would like to have, the "same" struct that we have for
vectors: map_info, for the raster, something like: rast_info, using as
much as possible the same structure for history, categories, etc...

But maybe is an enhancement for grass8 :slight_smile:

Pietro

Hi,

2012/12/16 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

This is not possible because r.reclass expects the (raster) maskcats
syntax, not the (vector) cats syntax. Each syntax is well established

I was not clear enough, I thought to change r.reclass syntax too.

and I don't think it's a good idea to sync the two (requiring too many
low-level changes that are neither bug fixes nor performance
improvements).

Is there any reason why syntax for raster and vector cats need to be
different? Or it's just historical artifact? Personally speaking,
syntax for vector categories seems to be more natural for me. Keeping
maskcats and cats could be quite misleading for the user. I think it's
good time to think about synchronization of the syntax for categories.
In other words, to change r.reclass to accept also vector cats syntax.
r.reclass could accept the both syntaxes - old (current) and new one
(vector based).

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Sun, Dec 16, 2012 at 10:28 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2012/12/16 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

This is not possible because r.reclass expects the (raster) maskcats
syntax, not the (vector) cats syntax. Each syntax is well established

I was not clear enough, I thought to change r.reclass syntax too.

OK. For r.reclass, only the left-hand part would need to be changed.
The relevant code is specific to r.reclass and looks pretty solid, it
may be not trivial to incorporate a new syntax.

and I don't think it's a good idea to sync the two (requiring too many
low-level changes that are neither bug fixes nor performance
improvements).

Is there any reason why syntax for raster and vector cats need to be
different? Or it's just historical artifact? Personally speaking,
syntax for vector categories seems to be more natural for me. Keeping
maskcats and cats could be quite misleading for the user. I think it's
good time to think about synchronization of the syntax for categories.
In other words, to change r.reclass to accept also vector cats syntax.
r.reclass could accept the both syntaxes - old (current) and new one
(vector based).

AFAICT, there is nothing like a raster categories syntax. Raster
modules working with ranges of categories similar to '1 2 3 5 thru 10'
have their own implementations, e.g. r.reclass and d.rast. All these
differences are most probably due to historical reasons, one module
was added after another. For vectors at least there is only one syntax
(added after the raster implementations I guess).

Markus M