[ncl-talk] stat_dispersion and standard deviation

jbuzan jbuzan at purdue.edu
Fri Apr 24 14:25:39 MDT 2015


I don’t know if this has been fixed in 6.3.0, but there was a change in stat_dispersion and the standard deviation is no longer calculated.  it is the variance.

you can change:
$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
(I renamed the file)

and commented out:
     ; statx(1) = moment(1)             ; std. deviation

and replaced with:
      statx(1) = stddev(x)             ; std. deviation


-Jonathan



> On Apr 24, 2015, at 4:20 PM, Rainer Luptowitz <rlupt001 at ucr.edu> wrote:
> 
> Hi ncl-talk,
> 
> Is the standard deviation computed in the "stats_dispersion" function actually a variance?
> 
> I test this and it appears to be variance instead of stats_dispersion as seen in with sample "a" below.
> 
> 
> Variable: a 
> Type: float
> Total Size: 56 bytes
>             14 values
> Number of Dimensions: 1
> Dimensions and sizes:	[ncl_join | 14]    ; I had joined 8 files trends with "addfiles" function
> Coordinates:
> Number Of Attributes: 0
> (0)	-20.46505
> (1)	-4.795454
> (2)	-1.454606
> (3)	-2.677286
> (4)	-1.868608
> (5)	-0.4972475
> (6)	1.18715
> (7)	-1.657706
> (8)	-3.428875
> (9)	-2.766053
> (10)	-1.689298
> (11)	-0.3371645
> (12)	-0.640966
> (13)	-0.7326741
> 
> ; ncl code compare variance to standard deviation
> 
> ; the above data was placed into an array named "a"
> a = (/-20.46505, -4.795454, -1.454606,-2.677286, -1.868608, -0.4972475, 1.18715, -1.657706, -3.428875, -2.766053, -1.689298, -0.3371645, -0.640966, -0.7326741/)
> 
> 
> ; Input
> Var_a = variance(a)  ; calc variance
> print(Var_a)
> StdDev_a = stddev(a) ; calc standard deviation
> print(StdDev_a)
> opt = True
> opt at PrintStat = True
> Stats_a = stat_dispersion(a,opt)
> 
> 
> ; Output
> ; from individually calculating Variance
> Variable: Var_a
> Type: float
> Total Size: 4 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:	[1]
> Coordinates:
> (0)	27.49021
> 
> ; from individually calculating Standard Deviation
> Variable: StdDev_a
> Type: float
> Total Size: 4 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:	[1]
> Coordinates:
> (0)	5.243111
> 
> ; from Stats_Dispersion function.
> (0)
> (0)	   ===> Robust Dispersion Statistics <===
> (0)	 [0]            Mean=-2.98742
> (0)	 [1]          StdDev=27.4902    ; this appears to be variance since
> (0)	 [2]             Min=-20.4651
> (0)	 [3]          LowDec=-20.4651
> (0)	 [4]          LowOct=-20.4651
> (0)	 [5]          LowSex=-4.79545
> (0)	 [6]     LowQuartile=-3.42888
> (0)	 [7]          LowTri=-2.76605
> (0)	 [8]          Median=-1.6735
> (0)	 [9]         HighTri=-1.45461
> (0)	 [10]   HighQuartile=-0.732674
> (0)	 [11]        HighSex=-0.640966
> (0)	 [12]        HighOct=-0.497248
> (0)	 [13]        HighDec=-0.497248
> (0)	 [14]            Max=1.18715
> (0)	 [15]          Range=21.6522
> (0)	 [16]     Dispersion=0.787633
> (0)	 [17]    RMS Anomaly=5.05239
> (0)	 [18]      #   Total=14
> (0)	 [19]      #    Used=14
> (0)	 [20]      # Missing=0
> (0)	 [21]      % Missing=0
> (0)	 [22]     Lower 0.1%=9.96921e+36
> (0)	 [23]     Lower 1.0%=9.96921e+36
> (0)	 [24]     Lower 5.0%=9.96921e+36
> (0)	 [25]     Upper 5.0%=9.96921e+36
> (0)	 [26]     Upper 1.0%=9.96921e+36
> (0)	 [27]     Upper 0.1%=9.96921e+36
> (0)	 [28]       Skewness=-2.57898
> (0)	 [29]       Kurtosis=5.86411
> 
> 
> What do you think?
> 
> Thank you for time and assistance,
> 
> Rainer Luptowitz
> Grad Student 
> Dept Earth Sciences
> UC Riverside
> rlupt001 at ucr.edu <mailto:rlupt001 at ucr.edu>
> 
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150424/87de8889/attachment.html 


More information about the ncl-talk mailing list