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

Michael Barton michael.barton at asu.edu
Mon Aug 15 16:15:40 EDT 2005


Daniel,

I hope this patch works. However, the problem might come from awk trying to
read the text file and summing a blank/null value.

Moritz, let us know if this works.

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


> From: Daniel Calvelo <daniel.calvelo at minag.gob.pe>
> Reply-To: <daniel.calvelo at minag.gob.pe>
> Date: Mon, 15 Aug 2005 13:50:02 -0500
> To: Michael Barton <michael.barton at asu.edu>, <mlennert at club.worldonline.be>
> Cc: Grass Developers List <grass5 at grass.itc.it>
> Subject: Re: [GRASS5] Re: d.vect.thematic wish: handle null values
> 
> Hi all,
> 
> Sorry for jumping in so late, I've been traveling.
> 
> AFAIR the problem is actually within db.select's output. Moritz, could you
> apply this patch to v.univar.sh and send the result (in /tmp/db.select.out)
> back to me? When I was dealing with this problem I only used the DBF driver,
> which gave zeros for nulls under unspecified cirsumstances.
> 
> I can fix the script to filter out nulls, but I'm pretty sure the problem will
> remain under certain configurations.
> 
> -- Daniel Calvelo Aros
> 
> ---------- Original Message -----------
> From: Michael Barton <michael.barton at asu.edu>
> To: mlennert at club.worldonline.be
> Cc: "daniel.calvelo at minag.gob.pe" <daniel.calvelo at minag.gob.pe>, Grass
> Developers List <grass5 at grass.itc.it>
> Sent: Sat, 13 Aug 2005 17:12:29 -0700
> Subject: Re: [GRASS5] Re: d.vect.thematic wish: handle null values
> 
>> 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
>>> 
>> 
>> _______________________________________________
>> grass5 mailing list
>> grass5 at grass.itc.it
>> http://grass.itc.it/mailman/listinfo/grass5
> ------- End of Original Message -------
> 




More information about the grass-dev mailing list