[Thread Prev][Thread Next][Index]

Re: [ferret_users] @sum bug ?



Hi Patrick,
I really think this is a precision issue. The numbers involved are down near the limit of single-precision accuracy. The source code for the sum operation has never been changed, since Ferret was first written. Note that the difference between 2526427.250  and 2526434.500 are in the 6th decimal place, and both would be rounded  off to 2526430. at  a precision of 6 decimal places. Single-precision variables are really only this accurate, to 6 or 7 decimal places.  I have to conclude that the differences in the results from one Ferret executable to another are due to slight changes in the way Ferret is compiled and linked.

The reason that the sums of var and  xsequence(var) differ somewhat is again because of computational accuracy.  When computing the sum of the multi-dimensioned variable, the sum over x is first computed, leaving a variable in y, then that is summed over y.  When the one-dimensional variable's sum is computed, that is done in just one step, so there's just a bit of a difference in the way the numbers are added up. We're looking into the possibility of changing the summation routines to make the results of the two computations consistent and perhaps more accurate.

Ansley

On 11/23/2010 4:03 PM, Brockmann Patrick wrote:
Hi all,

I am just discovering that the @sum operator gives different results
from 6.61 and next release 6.62, 6.64.
I haven't any new about this serious bug in release notes.

My test are available from:
http://dods.ipsl.jussieu.fr/brocksce/ferret_bugs/err661_sum.jnl
http://dods.ipsl.jussieu.fr/brocksce/ferret_bugs/err661_sum_file.nc

And gives:
######################################"
$ ferret -script err661_sum.jnl
use err661_sum_file.nc
list/p=10 tas[i=@sum,j=@sum]
            VARIABLE : TAS
            FILENAME : err661_sum_file.nc
            X        : 0.5 to 96.5 (summed)
            Y        : 0.5 to 96.5 (summed)
         2526427.750
let a=xsequence(tas)
list/p=10 a[i=@sum]
            VARIABLE : XSEQUENCE(TAS)
            FILENAME : err661_sum_file.nc
            X        : 0.5 to 9216.5 (summed)
         2526427.750

And with 6.62 and 6.64
######################################"
use err661_sum_file.nc
list/p=10 tas[i=@sum,j=@sum]
            VARIABLE : TAS
            FILENAME : err661_sum_file.nc
            X        : 0.5 to 96.5 (summed)
            Y        : 0.5 to 96.5 (summed)
         2526427.250
let a=xsequence(tas)
list/p=10 a[i=@sum]
            VARIABLE : XSEQUENCE(TAS)
            FILENAME : err661_sum_file.nc
            X        : 0.5 to 9216.5 (summed)
         2526434.500

######################################"
From python/netCDF4/numpy
I know that the sum is really 2526434.500


Other question related: why tas[i=@sum,j=@sum]
and xsequence then i=@sum gives different results.
Both should give 2526434.500

Hope it a bad dream...
Let me know if you can confirm this.

Patrick


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement