[GRASS-dev] g.region print flags combination

Martin Landa landa.martin at gmail.com
Fri Jan 5 03:06:20 EST 2007


Hi,

I have modified g.region:

1) the warning (g.region -g) is disabled
2) g.region -g (or g.region -pg) prints the same lines as before

In the result there still small minor consistency

g.region -g -> g.region -pg
g.region -gcl is not the same as g.region -pgcl

So -g[3] == -pg[3] only without other print flags.

add 2) I am still thinking that these kind of changes (i.e. different
number of lines in g.region -g) can be done in 6.x. In G7.x should be
cleaned the connection between g.region + g.proj + [r|v].info as Paul
suggested.

Best regards, Martin

2007/1/2, Maciej Sieczka <tutey at o2.pl>:
> Martin Landa wrote:
>
> > 2007/1/2, Maciej Sieczka <tutey at o2.pl>:
> >
> >> "g.region -g" works OK now, but it prints a WARNING message on the top.
> >> It also prints few extra lines, compared to before, namely:
> >>
> >> projection=1
> >> zone=34
> >> datum=wgs84
> >> ellipsoid=wgs84
> >>
> >> Your WARNING message is correct and desired, as well as the extra info
> >>  is usefull, but those several additional lines might brake some user's
> >> scripts.
> >
> > So should I disable this warning, right?
>
> I guess so. But somebody more knowledgable should decide.
>
> > I think the additional lines would not break any scripts, which parse
> > `g.region -g` output in a reasonable way (eval, awk) (?).
>
> Those extra lines might brake all scripts that don't use eval, I
> suppose. Eg. parsing with awk by line number will fail now:
>
> # grab the current region settings
> g.region -g > $TMP.${PROG}.region
>
> # extract variables from the grabbed region
> north=`awk 'BEGIN {FS="="} (NR==1) {print $2}' $TMP.${PROG}.region`
> south=`awk 'BEGIN {FS="="} (NR==2) {print $2}' $TMP.${PROG}.region`
> west=`awk 'BEGIN {FS="="} (NR==3) {print $2}' $TMP.${PROG}.region`
> east=`awk 'BEGIN {FS="="} (NR==4) {print $2}' $TMP.${PROG}.region`
> nsres=`awk 'BEGIN {FS="="} (NR==5) {print $2}' $TMP.${PROG}.region`
> ewres=`awk 'BEGIN {FS="="} (NR==6) {print $2}' $TMP.${PROG}.region`
> rows=`awk 'BEGIN {FS="="} (NR==7) {print $2}' $TMP.${PROG}.region`
> cols=`awk 'BEGIN {FS="="} (NR==8) {print $2}' $TMP.${PROG}.region`
>
> Is that "reasonable" I don't know, but it used to work with g.region -g
> before your recent changes, and now it fails, because top 4 lines of
> g.region -g output are different now.
>
> I personally don't care too much, I have fixed my script to use eval,
> but what with other users?
>
> I absolutely agree you are doing a Good Thing fixing g.region -g as you
> do, but I'm affraid it should wait till GRASS 7, for legacy reasons.
>
> Maciek
>


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




More information about the grass-dev mailing list