Mon, Jun 26 2006
20:59:40
|
|
Request created by guest
|
|
Subject: i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
Glynn wrote on the grass-dev:
> scripts shouldn't modify the WIND file unless persistently changing the
> current region is the script's intended function.
> use either WIND_OVERRIDE or GRASS_REGION (the latter is cleaner, but
> the former is probably easier).
Maciek
|
|
Mon, Jun 26 2006
21:17:25
|
|
Mail sent by neteler@itc.it
|
|
Return-Path |
<neteler@itc.it>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Mon, 26 Jun 2006 21:17:21 +0200
|
From |
Markus Neteler <neteler@itc.it>
|
To |
grass-dev@grass.itc.it
|
Cc |
grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
Message-ID |
<20060626191720.GA18893@bartok.itc.it>
|
Mail-Followup-To |
grass-dev@grass.itc.it, grass-bugs@intevation.de
|
References |
<20060626185940.2837A1005B8@lists.intevation.de>
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Disposition |
inline
|
In-Reply-To |
<20060626185940.2837A1005B8@lists.intevation.de>
|
X-PGP-Key |
http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
|
X-PGP-Fingerprint |
D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
|
User-Agent |
Mutt/1.5.11
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-3.215 tagged_above=-999 required=4 tests=[AWL=1.519, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
|
X-Spam-Level |
|
On Mon, Jun 26, 2006 at 08:59:40PM +0200, Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=4742
> -------------------------------------------------------------------------
>
> Subject: i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
>
> Glynn wrote on the grass-dev:
>
> > scripts shouldn't modify the WIND file unless persistently changing the
> > current region is the script's intended function.
>
> > use either WIND_OVERRIDE or GRASS_REGION (the latter is cleaner, but
> > the former is probably easier).
>
Hi Maciek,
I answer since I am the author of all scripts:
Please look at the algorithm of i.fusion.brovey: it makes no sense
to operate at current resolution. But i.fusion.brovey saves the
region and restores it back.
v.rast.stats: same story.
Same thing with i.in.spotvgt: to perform the algorithm, we have
at least to set to the resolution of the imported map. Again,
also i.in.spotvgt saves and restores the current user region.
Since it is an import command, it should behave differently. GRASS
import commands are expected to import a full map.
We could discuss that the scripts internally only modify the resolution
but would keep the boundary coordinates. Not sure if it is then the
desried behaviour but feel free to implement that. But i.in.spotvgt
should be kept as implemented.
Markus
|
|
Mon, Jun 26 2006
21:40:12
|
|
Mail sent by neteler@itc.it
|
|
Return-Path |
<neteler@itc.it>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Mon, 26 Jun 2006 21:40:08 +0200
|
From |
Markus Neteler <neteler@itc.it>
|
To |
grass-dev@grass.itc.it, grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
Message-ID |
<20060626194008.GB18893@bartok.itc.it>
|
Mail-Followup-To |
grass-dev@grass.itc.it, grass-bugs@intevation.de
|
References |
<20060626185940.2837A1005B8@lists.intevation.de> <20060626191720.GA18893@bartok.itc.it>
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Disposition |
inline
|
In-Reply-To |
<20060626191720.GA18893@bartok.itc.it>
|
X-PGP-Key |
http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
|
X-PGP-Fingerprint |
D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
|
User-Agent |
Mutt/1.5.11
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-3.224 tagged_above=-999 required=4 tests=[AWL=1.510, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
|
X-Spam-Level |
|
On Mon, Jun 26, 2006 at 09:17:21PM +0200, Markus Neteler wrote:
> On Mon, Jun 26, 2006 at 08:59:40PM +0200, Request Tracker wrote:
> > this bug's URL: http://intevation.de/rt/webrt?serial_num=4742
> > -------------------------------------------------------------------------
> >
> > Subject: i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
> >
> > Glynn wrote on the grass-dev:
> >
> > > scripts shouldn't modify the WIND file unless persistently changing the
> > > current region is the script's intended function.
> >
> > > use either WIND_OVERRIDE or GRASS_REGION (the latter is cleaner, but
> > > the former is probably easier).
> >
>
> Hi Maciek,
>
> I answer since I am the author of all scripts:
>
I answer again since I found my last answer confusing :-)
i.in.spotvgt: it is an import script. The GRASS import commands are
expected to import a full map at original resolution. The internal
bit shuffling must therefore be done at the original map region
and resolution. The script saves the current user region and restores
it back.
i.fusion.brovey: Please look at the algorithm, it makes no sense to
to operate at user (random) resolution. But i.fusion.brovey saves the
region and restores it back as well.
Discussion: only fetch raster map resolution, but operate in user
region - feel free to implement this.
v.rast.stats: uses resolution of queried raster map (I don't think
that it makes too much sense to work at arbitray resolutions) but
respects the user defined coordinates. The script saves the current
region and restores it back.
Maybe you want to transfer the resolution management from v.rast.stats
to i.fusion.brovey. But I don't see much other changes to be useful.
Markus
|
|
Mon, Jun 26 2006
21:56:30
|
|
Mail sent by werchowyna@epf.pl
|
|
Return-Path |
<werchowyna@epf.pl>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Mon, 26 Jun 2006 21:56:24 +0200
|
From |
Maciek Sieczka <werchowyna@epf.pl>
|
To |
neteler@itc.it, glynn@gclements.plus.com
|
Cc |
grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
Message-Id |
<20060626215624.2a937ccb.werchowyna@epf.pl>
|
In-Reply-To |
<20060626194012.DCDE61005A4@lists.intevation.de>
|
References |
<20060626194012.DCDE61005A4@lists.intevation.de>
|
X-Mailer |
Sylpheed version 2.1.1 (GTK+ 2.8.6; i486-pc-linux-gnu)
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-3.376 tagged_above=-999 required=4 tests=[AWL=1.573, BAYES_00=-5, RCVD_BY_IP=0.051]
|
X-Spam-Level |
|
Markus,
I have put this report to keep the track of Glynn's observation, which
I stated clearly.
Glynn,
Can you please let us know know what you think about this know in light
of Markus' notes?
Best,
Maciek
------------------------------------------------------------------------
CIEP?E KRAJE - CIEP?E MORZA. Szukasz atrakcyjnego wypoczynku w przyst?pnej cenie,
zapoznaj si? z nasz? ofert?.
ZAPRASZAMY
www.skarpatravel.pl
|
|
Tue, Jun 27 2006
04:04:25
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Tue, 27 Jun 2006 14:04:04 +1200
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Markus Neteler <neteler@itc.it>
|
Cc |
grass-dev@grass.itc.it, grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
Message-Id |
<20060627140404.65384c77.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20060626194008.GB18893@bartok.itc.it>
|
References |
<20060626185940.2837A1005B8@lists.intevation.de> <20060626191720.GA18893@bartok.itc.it> <20060626194008.GB18893@bartok.itc.it>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-1.292 tagged_above=-999 required=4 tests=[AWL=1.613, BAYES_00=-5, FORGED_YAHOO_RCVD=2.095]
|
X-Spam-Level |
|
> > > this bug's URL: http://intevation.de/rt/webrt?serial_num=4742
> > > -----------------------------------------------------------------
> > >
> > > Subject: i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use
> > > g.region
> > >
> > > Glynn wrote on the grass-dev:
> > >
> > > > scripts shouldn't modify the WIND file unless persistently
> > > > changing the current region is the script's intended function.
> > >
> > > > use either WIND_OVERRIDE or GRASS_REGION (the latter is cleaner,
> > > > but the former is probably easier).
in practice WIND_OVERRIDE is actually more work? see below.
Markus:
> i.in.spotvgt: it is an import script. The GRASS import commands are
> expected to import a full map at original resolution. The internal
> bit shuffling must therefore be done at the original map region
> and resolution. The script saves the current user region and restores
> it back.
(guessed) current region usage:
g.region save=region.save
g.region rast=$input
do_stuff()
g.region region.save
g.remove region=region.save
same thing, using WIND_OVERRIDE:
g.region save=region.save
g.region rast=$input
g.region save=region.tmp
g.region region.save
WIND_OVERRIDE=region.tmp
export WIND_OVERRIDE
do_stuff()
unset WIND_OVERRIDE # unneeded if script exits, but good hygiene
g.remove region=region.save,region.tmp
the current way seems simpler to me - with the problem that if the
script exits prematurely you will be left in a different region than the
one you started in.
using g.region is much better than hacking a WIND file directly - parity
checking, etc. This is a danger with using GRASS_REGION=""
> i.fusion.brovey: Please look at the algorithm, it makes no sense to
> to operate at user (random) resolution. But i.fusion.brovey saves the
> region and restores it back as well.
> Discussion: only fetch raster map resolution, but operate in user
> region - feel free to implement this.
but,but,but ... "g.region -a" is needed in this case which can change
the bounds too?
> v.rast.stats: uses resolution of queried raster map (I don't think
> that it makes too much sense to work at arbitray resolutions) but
> respects the user defined coordinates. The script saves the current
> region and restores it back.
again, is "g.region -a" needed here?
For C (and SWIG) modules, I think we need a lib fn like
char * G_window_string(cellhd);
(any better G_() name?)
that will form a GRASS_REGION string from a cell-head structure.
maybe check that it is valid also (rows*nsres=ns_extent etc)??
with scripts I guess you could do
eval `g.region -g`
GRASS_REGION="north:$n;south:$s;..."
or
ORIGINAL_REGION=`g.region -p | tr '\n' ';' | sed -e 's/ //g' -e 's/;$//'`
RES=50
GRASS_REGION=`echo "$ORIGINAL_REGION" | sed -e "s/nsres:[^;]/nsres:$RES/"`
in any case I think (with error checking) we should favour GRASS_REGION
over WIND_OVERRIDE as a cleaner solution. With a C lib fn it shouldn't
be any more work to create.
Hamish
|
|
Tue, Jun 27 2006
17:47:07
|
|
Mail sent by michael.barton@asu.edu
|
|
Return-Path |
<michael.barton@asu.edu>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
User-Agent |
Microsoft-Entourage/11.2.3.060209
|
Date |
Tue, 27 Jun 2006 08:47:01 -0700
|
Subject |
Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
From |
Michael Barton <michael.barton@asu.edu>
|
To |
Hamish <hamish_nospam@yahoo.com>, Markus Neteler <neteler@itc.it>
|
Cc |
Paolo Cavallini via RT <grass-bugs@intevation.de>, <grass-dev@grass.itc.it>
|
Message-ID |
<C0C6A105.BF8B%michael.barton@asu.edu>
|
Thread-Topic |
[GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
Thread-Index |
AcaaAO37LEnWqgX0Edu3UAAKlXAweg==
|
In-Reply-To |
<20060627140404.65384c77.hamish_nospam@yahoo.com>
|
Mime-version |
1.0
|
Content-type |
text/plain; charset="US-ASCII"
|
Content-transfer-encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-2.741 tagged_above=-999 required=4 tests=[AWL=0.911, BAYES_00=-5, RCVD_NUMERIC_HELO=1.348]
|
X-Spam-Level |
|
See below.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
> From: Hamish <hamish_nospam@yahoo.com>
> Date: Tue, 27 Jun 2006 14:04:04 +1200
> To: Markus Neteler <neteler@itc.it>
> Cc: <grass-bugs@intevation.de>, <grass-dev@grass.itc.it>
> Subject: Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt,
> v.rast.stats: don't use g.region
>
> in practice WIND_OVERRIDE is actually more work? see below.
>
>
> Markus:
>> i.in.spotvgt: it is an import script. The GRASS import commands are
>> expected to import a full map at original resolution. The internal
>> bit shuffling must therefore be done at the original map region
>> and resolution. The script saves the current user region and restores
>> it back.
>
> (guessed) current region usage:
>
> g.region save=region.save
> g.region rast=$input
> do_stuff()
> g.region region.save
> g.remove region=region.save
>
> same thing, using WIND_OVERRIDE:
>
> g.region save=region.save
> g.region rast=$input
> g.region save=region.tmp
> g.region region.save
> WIND_OVERRIDE=region.tmp
> export WIND_OVERRIDE
> do_stuff()
> unset WIND_OVERRIDE # unneeded if script exits, but good hygiene
> g.remove region=region.save,region.tmp
Actually, this is making it overly complicated. It should actually be as
follows.
g.region -u save=region.save # save a region but don't change WIND
WIND_OVERRIDE=region.save
export WIND_OVERRIDE # use region.save like WIND but don't change WIND
g.region rast=$input
do_stuff()
unset WIND_OVERRIDE # unneeded if script exits, but good hygiene
g.remove region=region.save
The first way is not a problem for a simple script like this. It becomes a
problem when you are doing a lot of region changes for independent displays
in a GUI and don't want to mess things up for different displays or for
people doing something from the command line.
> g.region rast=$input
|
|
Tue, Jun 27 2006
18:00:10
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17569.22018.926912.775695@cerise.gclements.plus.com>
|
Date |
Tue, 27 Jun 2006 17:00:02 +0100
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
Markus Neteler <neteler@itc.it>, grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
In-Reply-To |
<20060627140404.65384c77.hamish_nospam@yahoo.com>
|
References |
<20060626185940.2837A1005B8@lists.intevation.de> <20060626191720.GA18893@bartok.itc.it> <20060626194008.GB18893@bartok.itc.it> <20060627140404.65384c77.hamish_nospam@yahoo.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-3.15 tagged_above=-999 required=4 tests=[AWL=1.584, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
|
X-Spam-Level |
|
Hamish wrote:
> > > > this bug's URL: http://intevation.de/rt/webrt?serial_num=4742
> > > > -----------------------------------------------------------------
> > > >
> > > > Subject: i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use
> > > > g.region
> > > >
> > > > Glynn wrote on the grass-dev:
> > > >
> > > > > scripts shouldn't modify the WIND file unless persistently
> > > > > changing the current region is the script's intended function.
> > > >
> > > > > use either WIND_OVERRIDE or GRASS_REGION (the latter is cleaner,
> > > > > but the former is probably easier).
>
> in practice WIND_OVERRIDE is actually more work? see below.
>
>
> Markus:
> > i.in.spotvgt: it is an import script. The GRASS import commands are
> > expected to import a full map at original resolution. The internal
> > bit shuffling must therefore be done at the original map region
> > and resolution. The script saves the current user region and restores
> > it back.
>
> (guessed) current region usage:
>
> g.region save=region.save
> g.region rast=$input
> do_stuff()
> g.region region.save
> g.remove region=region.save
>
> same thing, using WIND_OVERRIDE:
>
> g.region save=region.save
> g.region rast=$input
> g.region save=region.tmp
> g.region region.save
> WIND_OVERRIDE=region.tmp
> export WIND_OVERRIDE
> do_stuff()
> unset WIND_OVERRIDE # unneeded if script exits, but good hygiene
> g.remove region=region.save,region.tmp
You don't need to touch the current region at all. Just:
g.region rast=$input save=region.tmp.$$
WIND_OVERRIDE=region.tmp.$$
export WIND_OVERRIDE
do_stuff()
g.remove region=region.tmp.$$
If do_stuff() is a single command, you could use a temporary
environment binding, i.e.:
g.region rast=$input save=region.tmp.$$
WIND_OVERRIDE=region.tmp.$$ do_stuff()
g.remove region=region.tmp.$$
> For C (and SWIG) modules, I think we need a lib fn like
>
> char * G_window_string(cellhd);
>
> (any better G_() name?)
>
> that will form a GRASS_REGION string from a cell-head structure.
> maybe check that it is valid also (rows*nsres=ns_extent etc)??
>
> with scripts I guess you could do
>
> eval `g.region -g`
> GRASS_REGION="north:$n;south:$s;..."
> or
>
> ORIGINAL_REGION=`g.region -p | tr '\n' ';' | sed -e 's/ //g' -e 's/;$//'`
> RES=50
> GRASS_REGION=`echo "$ORIGINAL_REGION" | sed -e "s/nsres:[^;]/nsres:$RES/"`
>
> in any case I think (with error checking) we should favour GRASS_REGION
> over WIND_OVERRIDE as a cleaner solution. With a C lib fn it shouldn't
> be any more work to create.
GRASS_REGION is cleaner in that you don't have to worry about:
a) choosing a region name which doesn't conflict with any existing
region, or
b) the saved region being left behind if the script terminates
prematurely.
It's currently more effort to use GRASS_REGION from within a shell
script; extending g.region to allow output in GRASS_REGION format
would eliminate that issue; you could just do e.g.:
GRASS_REGION=`g.region -e rast=$input`
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Wed, Jun 28 2006
18:35:07
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17570.44979.960021.831401@cerise.gclements.plus.com>
|
Date |
Wed, 28 Jun 2006 17:34:59 +0100
|
To |
Hamish <hamish_nospam@yahoo.com>, Markus Neteler <neteler@itc.it>, grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region
|
In-Reply-To |
<17569.22018.926912.775695@cerise.gclements.plus.com>
|
References |
<20060626185940.2837A1005B8@lists.intevation.de> <20060626191720.GA18893@bartok.itc.it> <20060626194008.GB18893@bartok.itc.it> <20060627140404.65384c77.hamish_nospam@yahoo.com> <17569.22018.926912.775695@cerise.gclements.plus.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-3.165 tagged_above=-999 required=4 tests=[AWL=1.569, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
|
X-Spam-Level |
|
Glynn Clements wrote:
> You don't need to touch the current region at all. Just:
>
> g.region rast=$input save=region.tmp.$$
> WIND_OVERRIDE=region.tmp.$$
> export WIND_OVERRIDE
> do_stuff()
> g.remove region=region.tmp.$$
Oops; the first g.region also needs the -u switch.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Sun, Jul 23 2006
22:59:01
|
|
Taken by mneteler
|
|
Wed, Jul 26 2006
18:52:37
|
|
User changed to tutey@o2.pl by msieczka
|
|