Standard deviation is shown as NAN
@@ -170,7 +170,6 @@ static void init(grib_accessor* a,const long l, grib_arguments* c)
a->dirty=1;
}
-
static int unpack_double (grib_accessor* a, double* val, size_t *len)
{
grib_accessor_statistics_spectral* self = (grib_accessor_statistics_spectral*)a;
@@ -222,7 +221,7 @@ static int unpack_double (grib_accessor* a, double* val, size_t *len)
sd += values[i]*values[i];
for (i= 2*J; i < size; i+=2)
- sd += values[i]*values[i] - values[i+1]*values[i+1];
+ sd += 2*values[i]*values[i] + 2*values[i+1]*values[i+1];
enorm=sd+avg*avg;
