Statistics
Elementary Descriptive Statistics
(Toy example)
% nap "score = f32 {56 75 47 99 49}"
::NAP::38995-932
% $score all
::NAP::38995-932 f32 MissingValue: NaN References: 1 Unit: (NULL)
Dimension 0 Size: 5 Name: (NULL) Coordinate-variable: (NULL)
Value:
56 75 47 99 49
% [nap "am(score)"]; # arithmetic mean
65.2
% [nap "range(score)"]; # min, max
47 99
% [nap "sd(score)"]; # standard deviation
19.5796
% [nap "median(score)"]
56
% [nap "gm(score)"]; # geometric mean
62.5512
% [nap "rms(score)"]; # root mean square
68.0764
% [nap "percentile(score, 0 .. 100 ... 25)"]; # quartiles
47 49.082 56.0391 75.1836 99
% [nap "# {4 1 3 4 0 0 4}"]; # frequencies of 0, 1, 2, ...
2 1 0 1 3
Example using real satellite data
cd /sol/home/dav480/tcl_nap/data
% nap "c1 = [nap_get netcdf modis.nc c1]"; # Read channel 1. (Could use GUI)
::NAP::42178-9292
% $c1 head
::NAP::42178-9292 f32 MissingValue: NaN References: 1 Unit: (NULL)
Dimension 0 Size: 532 Name: latitude Coordinate-variable: ::NAP::42179-78
Dimension 1 Size: 742 Name: longitude Coordinate-variable: ::NAP::42180-2473
% nap "zm_c1 = am(c1,1)"; # zonal mean of channel 1
::NAP::42200-98
% $zm_c1 a; # a = all
::NAP::42200-98 f64 MissingValue: NaN References: 1 Unit: (NULL)
Dimension 0 Size: 532 Name: latitude Coordinate-variable: ::NAP::42179-78
Value:
_ 2367.32 2516.54 2522.22 2543.68 2528.35 ..
% plot_nao zm_c1
.win10
% nap "c2 = [nap_get netcdf modis.nc c2]"; # Read channel 2.
::NAP::43687-4396
% plot_nao "am(c2,1)" -title "zonal mean of channel 2"
.win11
% [nap "moving_correlation(c1, c2)"]; # r = 0.908556 based on n = 287695
0.908556
287695.000000
% nap "dif = c2 - c1"; # difference between channels
::NAP::45219-9984
% plot_nao dif
.win12
% plot_nao "am(dif,1)" -title "zonal mean of c2-c1"
.win13