-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTD_normale_var.m
More file actions
38 lines (32 loc) · 1.03 KB
/
STD_normale_var.m
File metadata and controls
38 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
% Copyright 2020 MeteoSwiss, contributors of the original matlab version of the code listed in ORIGINAL_AUTHORS
%
% Distributed under the terms of the BSD 3-Clause License.
%
% SPDX-License-Identifier: BSD-3-Clause
function Z=STD_normale_var(S,var_S)
% calculate the normal standard variable Z
%input:
% S (integer)= S statistic of the Mann-Kendall test computed from
% S_test
% var_S (float)= variance of the time series taking into account the ties in
% values and time. It is computed by Kendall_var
%output:
% Z (float)= S statistic weighted by the variance
% Source:
% Gilbert 1987
% sanity checks first
if isa(S,'float')==0 || max(size(S))>1
error('the input "S" of STD_normale_var has to be a 1-D float');
end
if isa(var_S,'float')==0 || max(size(var_S))>1
error('the input "var_S" of STD_normale_var has to be a 1-D float');
end
%compute Z
if S==0
Z=0;
elseif S > 0
Z=(S-1)/((var_S)^0.5);
else
Z=(S+1)/((var_S)^0.5);
end
fclose('all');