[GRASS-dev] Re: Profiler updates

Hamish hamish_nospam at yahoo.com
Tue Feb 13 23:47:21 EST 2007


Michael wrote:
> r.profile should simply report NULL values for any coordinates
> that fall outside the region--like many other tools that return
> information about raster cells.

Done in 6.3-cvs. It is too invasive to backport to 6.2, so you should
still try and figure out why gis.m crashes if r.profile exits with a
fatal error. (in 6.2-cvs it now fatal errors instead of returning
incorrect results)

> This could easily be trapped and dealt with in the profiler.

Currently the profile line interpolates over areas of null value.
It would be more correct if the line stopped and then restarted
when the data resumed. e.g.:

  http://bambi.otago.ac.nz/hamish/grass/profile_nulls.png



wish 1: prettify max value on x-axis:

Index: profile.tcl
===================================================================
RCS file:
/home/grass/grassrepository/grass6/gui/tcltk/gis.m/profile.tcl,v
retrieving revision 1.13
diff -u -r1.13 profile.tcl
--- profile.tcl 11 Feb 2007 23:58:53 -0000      1.13
+++ profile.tcl 14 Feb 2007 04:20:06 -0000
@@ -494,7 +494,7 @@
        
        # add label for total transect distance
        $pcan create text $right $xscaletop \
-               -text "$cumdist" \
+               -text "[format %g $cumdist]" \
                -anchor n \
                -justify center


perhaps do the same for x-axis min/max?
 (are the double-quotes around [] redundant?)


wish 2: add units to the axes.
# x-axis: r.profile always return meters
# y-axis get units (plural) from g.proj:
g.proj -p | grep '^units' | cut -f2 -d: | awk '{print $1}'
 * probably want to do that in Tcl not with unix utils :) + rotate 90 deg.
 * nice example of where Python SWIG interface to libgis will be useful.
   Instead of running all of g.proj + parsing you could just get the
   value directly via G_database_unit_name(1). (1==plural)

wish 3: write distance labels for ticks along the x-axis.
I'm not sure how to guarantee that they won't overlap if too close
together.



also-- the display manager is ignoring the color rule for NULL.

For that screenshot I had set up color rules like this:

G63> r.colors elevation.dem col=rules << EOF
nv red
0% green
50% yellow
100% blue
EOF

in a xmon you see the NULL slivers are red, but in the display manager
they are white.



Hamish




More information about the grass-dev mailing list