[GRASS-dev] Profiler updates

Michael Barton michael.barton at asu.edu
Sun Feb 11 23:25:44 EST 2007


This sounds like a good assessment and suggestion.

Michael


On 2/11/07 9:20 PM, "Hamish" <hamish_nospam at yahoo.com> wrote:

> Michael Barton wrote:
>> 
>> I committed your patch to profile.tcl with a few modifications. The
>> window placement is a nice improvement. There was already an error
>> trap for profiles with a 0 length, so I deleted your 2nd trap for this
>> condition. I also moved the trap for elevation range = 0 up a bit to
>> immediately after the spot where the procedure for generating
>> elevation range is called.
>> 
>> I thought of another potential problem but haven¹t found a way to trap
>> it. If you send r.profile any coordinates that extend beyond the
>> current region, it will crash and crash the entire GUI‹in spite of the
>> fact that the call to r.profile is trapped with a catch statement. The
>> profiler generates correct coordinates for any place on the display,
>> regardless of whether it extends beyond the region boundaries or not.
>> However, r.profile apparently chokes on coordinates outside the
>> region.
>> 
>> I¹m not sure if this can really be called a bug in r.profile, but it
>> should probably fail more gracefully.
> 
> 
> This is a bug in r.profile. Out of region values are not correct.
> 
> spearfish example:
> 
> d.mon x0
> # stretch the window so it is twice as wide as it is tall
> g.region rast=elevation.dem
> d.erase color=grey
> d.rast elevation.dem
> r.profile -i in=elevation.dem res=300
> 
> If you go off the left edge of the region, the answers are wrong.
> If you go off the right edge, the answers are very wrong, then 0.
> 
> # next re-strech the window so it is taller that wide.
> 
> If you go off the bottom:
> WARNING: [elevation.dem in PERMANENT] - read request for row 471 is
>  outside region
> and a the program exits.
> 
> If you go off the top:
> ERROR: Coordinate request outsite current region settings
> and a the program exits.
> 
> 
> d.what.rast gives a "You are clicking outside the map" warning.
> 
> r.what gives a warning before reporting a NULL ("*"):
> 
> G63> r.what in=elevation.dem east_north=602283,4913294
> ** note ** 602283 4913294 is outside your current window
> 602283|4913294||*
> 
> 
> So it would seem appropriate that r.profile out-of-region should report
> a "NULL" result (to stdout) and warning that the endpoint is out of
> region (G_warning() to stderr).
> 
> 
> 
> Hamish

__________________________________________
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






More information about the grass-dev mailing list