# [GRASS5] Re: d.vect.thematic wish: handle null values

Michael Barton michael.barton at asu.edu
Sat Aug 13 20:12:29 EDT 2005

```I think that this is the place in v.univar.sh that needs to be updated to
deal with null values

# calculate statistics
echo "Calculating statistics..."
cat \$TMP | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0}
NR == 1{min = \$1 ; max = \$1}
{sum += \$1 ; sum2 += \$1 * \$1 ; N++}
{
if (\$1 > max) {max = \$1}
if (\$1 < min) {min = \$1}
}
END{
print ""
print "Number of values:",N
print "Minimum:",min
print "Maximum:",max
print "Range:",max-min
print "-----"
print "Mean:",sum/N
print "Variance:",(sum2 - sum*sum/N)/N
print "Standard deviation:",sqrt((sum2 - sum*sum/N)/N)
print "Coefficient of variation:",(sqrt((sum2 -
sum*sum/N)/N))/(sqrt(sum*sum)/N)
print "-----"
}'

I think there needs to be the equivalent of

for \$1<>""

in the beginning of this. Any awk expert know how to implement this?

Of course if v.univar were expanded to accomplish the same things as
v.univar.sh ...

Michael

On 8/12/05 2:42 AM, "Moritz Lennert" <mlennert at club.worldonline.be> wrote:

> On Fri, August 12, 2005 11:27, Moritz Lennert said:
>> On Fri, August 12, 2005 1:49, Michael Barton said:
>>> Thanks for the clarification Moritz. Is this in the custom breaks section?
>>
>> No, this happens independently of the 'themecalc' choice.
>
> Sorry, I lied: actually the custom breaks are the only ones that work...
>
> All the others fail, with more or less the same error message...
>
> Moritz
>

```