[GRASS-user] v.rast.stats2 bug?

Markus Neteler neteler at osgeo.org
Wed Mar 2 10:15:17 EST 2011


On Tue, Mar 1, 2011 at 2:02 AM, Mark Seibel <mseibel at gmail.com> wrote:
> I just checked out v.rast.stats2 (Feb.28) and when I run it I get the
> following error.
>
> Do I need to file a ticket, or am I missing something obvious?  While
> it says 'done', the table is unpopulated.
>
>
> awk: {printf "\nUPDATE acoe_jd SET dist_n
> awk:         ^ unterminated string
> sed: couldn't write 176 items to stdout: Broken pipe

I can confirm this bug.

The offending line is
sed -e '1d' "$STATSTMP" | awk -F "|" '{printf "\nUPDATE '${TABLE}' SET
'${col[0]}' = %i , '${col[1]}' = %.2f , '${col[2]}' = %.2f ,
'${col[3]}' = %.2f , '${col[4]}' = %.2f , '${col[5]}' = %.2f ,
'${col[6]}' = %.2f , '${col[7]}' = %.2f , '${col[8]}' = %.2f WHERE
'${KEYCOL}' = %i;", $2,$3,$4,$5,$6,$7,$8,$9,$10,$1}'

which fails due to a bad management of the used array:

++ cat /home/neteler/grassdata/spearfish60/neteler/.tmp/north/12201.0.col
++ tr '\n' ' '
+ col='dem_n dem_min dem_max dem_range dem_mean dem_stddev dem_varian
dem_cf_var dem_sum '
+ g.message -v 'Creating SQL file ...'
+ '[' 0 -eq 1 ']'
+ sed -e 1d /home/neteler/grassdata/spearfish60/neteler/.tmp/north/12201.0.csv
+ awk -F '|' '{printf "\nUPDATE myfields SET dem_n' dem_min dem_max
dem_range dem_mean dem_stddev dem_varian dem_cf_var dem_sum ' = %i ,
= %.2f ,  = %.2f ,  = %.2f ,  = %.2f ,  = %.2f ,  = %.2f ,  = %.2f ,
= %.2f WHERE cat = %i;", $2,$3,$4,$5,$6,$7,$8,$9,$10,$1}'
awk: {printf "\nUPDATE myfields SET dem_n
awk:         ^ unterminated string

Actually I don't know how to fix the use of col[1] etc. (I tried a while).

Markus


More information about the grass-user mailing list