[GRASS-dev] g.region print flags combination
Roger Bivand
Roger.Bivand at nhh.no
Fri Jan 5 08:27:29 EST 2007
On Fri, 5 Jan 2007, Glynn Clements wrote:
>
> Martin Landa wrote:
>
> > 3) The -p flag was changed.
> >
> > projection: 99 (Krovak)
> > zone: 0
> > datum: towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56
> >
> > ->
> >
> > projection : 99 (Krovak)
> > zone : 0
> > datum : towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56
> >
> > Not sure what formatting is more appropriate.
>
> Personally, I would have added the padding after the colons, i.e.:
>
> projection: 99 (Krovak)
> zone: 0
> datum: towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56
>
> The reason being that a regexp such as "^([^:]*): *(.*)$" would still
> work as before.
There are some standards here - the one most often used in R for package
management is DCF (Debian Control File):
" DCF is a simple format for storing databases in plain text files
that can easily be directly read and written by humans. DCF is
used in various places to store R system information, like
descriptions and contents of packages.
The DCF rules as implemented in R are:
1. A database consists of one or more records, each with one
or more named fields. Not every record must contain each
field, a field may appear only once in a record.
2. Regular lines start with a non-whitespace character.
3. Regular lines are of form 'tag:value', i.e., have a name
tag and a value for the field, separated by ':' (only the
first ':' counts). The value can be empty (=whitespace
only).
4. Lines starting with whitespace are continuation lines (to
the preceding field) if at least one character in the line
is non-whitespace.
5. Records are separated by one or more empty (=whitespace
only) lines.
"
where most often there is only one record. I have used this for reading in
g.region output (in spgrass6), so would be happy to see something that can
be parsed used. For that, padding is a pain by and large, and if people
need pretty things, then a parsed text file can be fed to a GUI.
Roger
>
> > 4) g.region -g X g.region -pg
>
> Should be equivalent, IMO.
>
> > --- I wanted to make -g flag more
> > universal, e.g. to distinguish
> >
> > g.region -pcl
> > g.region -cl
> >
> > and
> >
> > g.region -pclg instead of g.region -gcl <-- problem
> > g.region -gcl <-- problem
>
> What's the problem? That -g == -pg but -cg != -pcg?
>
> That isn't a problem, IMHO. By making -g a synonym for -pg, you're
> only affecting the behaviour of a case which would otherwise be
> meaningless (the printing format doesn't matter if you don't print
> anything). Several other modules have similar behaviour, and some of
> it is significantly more irrational than this.
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the grass-dev
mailing list