[GRASS5] d.vect.thematic committed to CVS

I fixed a few small bugs and committed d.vect.thematic and v.univar.sh to the CVS.

Items fixed in this submission:

support (I hope) for non-dbf tables
support for international numeric notation (“,” vs “.” for decimals)
recognition of odd (i.e., not even) medians and 2nd quartile

Thanks for all your help. Now those of you with nifty ideas for further enhancement can go at it.

Cheers,
Michael


Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

I fixed a few small bugs and committed d.vect.thematic and v.univar.sh
to the CVS.

both:

- to "activate" new modules, you need to add them to the parent
Makefile, e.g. grass6/scripts/Makefile.

- Instead of a table= option, parse the output of v.db.connect -g (or -p)
to get the answer automatically. I see you have commented out in thematic:
#v.db.connect map=fields2 -pg
note -pg isn't correct, choose one or the other. If this doesn't show
the correct table then it is a bug & should be fixed.

v.univar.sh:

please keep option names consistent with other modules, e.g. 'db.connect
driver= database=' instead of drv= and db=.

d.vect.thematic:

get rid of "#% key: icon" options line. Why restrict?
G> ls $GISBASE/etc/symbol/*

colorscheme=
I'm a huge fan of blue->cyan->yellow->red. Why not let it be any of the
colorschemes in $GISBASE/etc/colors/? (ok, very hard to parse in a shell
script)

if [ "$OPT_GIS_table" = "" ] ; then
use instead: (probably breaks on cygwin)
if [ -z "$OPT_GIS_table" ] ; then

min="`grep 'Minimum:' TMP1 | sed s/Minimum://`"
max="`grep 'Maximum:' TMP1 | sed s/Maximum://`"
mean="`grep 'Mean:' TMP1 | sed s/Mean://`"
etc.
change TMP1 -> "$TMP1"

Always try to "quote" file names. (spaces in names, etc)

themecolor=$color1":"$color2":"$color3
to
themecolor="$color1:$color2:$color3"

(not a big deal, just cleaner)

.. and that's about as far as I got through an audit.

nice work,

Hamish

Hamish

Thanks much for all the suggestions for a cleaner script. A couple replies
below, but will try to change these tomorrow if I have a few minutes.

On 5/12/05 8:04 PM, "Hamish" <hamish_nospam@yahoo.com> wrote:

I fixed a few small bugs and committed d.vect.thematic and v.univar.sh
to the CVS.

both:

- to "activate" new modules, you need to add them to the parent
Makefile, e.g. grass6/scripts/Makefile.

Oops. I was in a hurry to commit them because people were starting to modify
various versions floating around.

- Instead of a table= option, parse the output of v.db.connect -g (or -p)
to get the answer automatically. I see you have commented out in thematic:
#v.db.connect map=fields2 -pg

Db.select will automatically use the values already set in db.connect, so we
don't need to check this (at least I don't think we do). Previously I had it
default to dbf (a problem). Now it defaults to whatever is already set
unless it is specifically set to something else in the script.

note -pg isn't correct, choose one or the other. If this doesn't show
the correct table then it is a bug & should be fixed.

v.univar.sh:

please keep option names consistent with other modules, e.g. 'db.connect
driver= database=' instead of drv= and db=.

OK. I was trying to avoid confusion with the db.select arguments. But
consistency is nice.

d.vect.thematic:

get rid of "#% key: icon" options line. Why restrict?
G> ls $GISBASE/etc/symbol/*

Because I don't know how to parse this into a g.parser-style interface. This
is indeed a bit of a hack.

I'm working on a way to do this however.

colorscheme=
I'm a huge fan of blue->cyan->yellow->red. Why not let it be any of the
colorschemes in $GISBASE/etc/colors/? (ok, very hard to parse in a shell
script)

Also working on this. It is a bit complicated to do in a way that remains
user-friendly.

if [ "$OPT_GIS_table" = "" ] ; then
use instead: (probably breaks on cygwin)
if [ -z "$OPT_GIS_table" ] ; then

OK

min="`grep 'Minimum:' TMP1 | sed s/Minimum://`"
max="`grep 'Maximum:' TMP1 | sed s/Maximum://`"
mean="`grep 'Mean:' TMP1 | sed s/Mean://`"
etc.
change TMP1 -> "$TMP1"

Quotes inside quotes?? TMP1 is a file, not a variable. I copied this out of
r.univar.sh. Are you sure about this? I'll give it a try.

Always try to "quote" file names. (spaces in names, etc)

themecolor=$color1":"$color2":"$color3
to
themecolor="$color1:$color2:$color3"

(not a big deal, just cleaner)

OK

.. and that's about as far as I got through an audit.

Thanks much.

nice work,

Hamish

____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

Hi Michael

> note -pg isn't correct, choose one or the other. If this doesn't show

the correct table then it is a bug & should be fixed.

v.univar.sh:

please keep option names consistent with other modules, e.g. 'db.connect
driver= database=' instead of drv= and db=.

OK. I was trying to avoid confusion with the db.select arguments. But
consistency is nice.

d.vect.thematic:

get rid of "#% key: icon" options line. Why restrict?
G> ls $GISBASE/etc/symbol/*

Because I don't know how to parse this into a g.parser-style interface. This
is indeed a bit of a hack.

I'm working on a way to do this however.

Why not an icon in GIS Manager?
Select the vector map in the list and press the thematic icon. It have to extract the vector name automatically.

Other future option:
- thematic mapping for TEXT values. Unique values

Great work Michael

--
________________________________________________________________________
|| Lorenzo Moretti e-mail: lorenzo.moretti@bologna.enea.it ||/|/| ENEA prot/idr Web: http://wwwamb.bologna.enea.it/ || | via Don Fiammelli, 2 FTP: ftp://ftpamb.bologna.enea.it/ (ris.)
~~~~~~ 40128 BOLOGNA - ITALY Ph: +39-0516098086 Fax: +39-0516098131
________________________________________________________________________

Fixed in CVS this morning. See below for details.
______________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Fri, 13 May 2005 15:04:55 +1200
To: Michael Barton <michael.barton@asu.edu>
Cc: <grass5@grass.itc.it>
Subject: Re: [GRASS5] d.vect.thematic committed to CVS

I fixed a few small bugs and committed d.vect.thematic and v.univar.sh
to the CVS.

both:

- to "activate" new modules, you need to add them to the parent
Makefile, e.g. grass6/scripts/Makefile.

Fixed

- Instead of a table= option, parse the output of v.db.connect -g (or -p)
to get the answer automatically. I see you have commented out in thematic:
#v.db.connect map=fields2 -pg
note -pg isn't correct, choose one or the other. If this doesn't show
the correct table then it is a bug & should be fixed.

Not needed given how v.univar.sh is done now

v.univar.sh:

please keep option names consistent with other modules, e.g. 'db.connect
driver= database=' instead of drv= and db=.

d.vect.thematic:

get rid of "#% key: icon" options line. Why restrict?
G> ls $GISBASE/etc/symbol/*

No change for now. Working on a more sophisticated way to do this.

colorscheme=
I'm a huge fan of blue->cyan->yellow->red. Why not let it be any of the
colorschemes in $GISBASE/etc/colors/? (ok, very hard to parse in a shell
script)

No change for now. Working on a more sophisticated way to do this.

if [ "$OPT_GIS_table" = "" ] ; then
use instead: (probably breaks on cygwin)
if [ -z "$OPT_GIS_table" ] ; then

Fixed

min="`grep 'Minimum:' TMP1 | sed s/Minimum://`"
max="`grep 'Maximum:' TMP1 | sed s/Maximum://`"
mean="`grep 'Mean:' TMP1 | sed s/Mean://`"
etc.
change TMP1 -> "$TMP1"

Always try to "quote" file names. (spaces in names, etc)

This doesn't work with "$TMP1". Kept TMP1.

themecolor=$color1":"$color2":"$color3
to
themecolor="$color1:$color2:$color3"

(not a big deal, just cleaner)

Fixed

Also fixed 'legend' output to make it more readable.

.. and that's about as far as I got through an audit.

nice work,

Hamish

> d.vect.thematic:

..

> min="`grep 'Minimum:' TMP1 | sed s/Minimum://`"
> max="`grep 'Maximum:' TMP1 | sed s/Maximum://`"
> mean="`grep 'Mean:' TMP1 | sed s/Mean://`"
> etc.
> change TMP1 -> "$TMP1"
>
> Always try to "quote" file names. (spaces in names, etc)

This doesn't work with "$TMP1". Kept TMP1.

You are creating a file called "TMP1" in the current directory,

v.univar.sh -e table=$GIS_OPT_table column=$GIS_OPT_column > TMP1

should be

v.univar.sh -e table=$GIS_OPT_table column=$GIS_OPT_column > "$TMP1"

then the rest should work too.

Hamish

> min="`grep 'Minimum:' TMP1 | sed s/Minimum://`"
> max="`grep 'Maximum:' TMP1 | sed s/Maximum://`"
> mean="`grep 'Mean:' TMP1 | sed s/Mean://`"
> etc.
> change TMP1 -> "$TMP1"

Quotes inside quotes?? TMP1 is a file, not a variable. I copied this
out of r.univar.sh. Are you sure about this? I'll give it a try.

you are correct, no need for quotes inside quotes.
The missing $ stands though.

Hamish