SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
average2_cti.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #######################
6  SUBROUTINE average2_cti
7 ! #######################
8 !
9 !!**** *AVERAGE2_CTI* computes the topo index stats
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !! METHOD
15 !! ------
16 !!
17 !! EXTERNAL
18 !! --------
19 !!
20 !! IMPLICIT ARGUMENTS
21 !! ------------------
22 !!
23 !! REFERENCE
24 !! ---------
25 !!
26 !! AUTHOR
27 !! ------
28 !!
29 !! B. Decharme Meteo-France
30 !!
31 !! MODIFICATION
32 !! ------------
33 !!
34 !! Original 06/2009
35 !!
36 !----------------------------------------------------------------------------
37 !
38 !* 0. DECLARATION
39 ! -----------
40 !
41 USE modd_pgdwork, ONLY : nsize, xsumval, xsumval2, xsumval3, &
42  xmean_work, xstd_work, xskew_work, &
43  xmin_work, xmax_work
44 !
45 !
46 USE yomhook ,ONLY : lhook, dr_hook
47 USE parkind1 ,ONLY : jprb
48 !
49 IMPLICIT NONE
50 !
51 !* 0.1 Declaration of arguments
52 ! ------------------------
53 !
54 !* 0.2 Declaration of other local variables
55 ! ------------------------------------
56 !
57 REAL, DIMENSION(SIZE(NSIZE)) :: zsize
58 !
59 integer :: i
60 REAL(KIND=JPRB) :: zhook_handle
61 !----------------------------------------------------------------------------
62 !
63 IF (lhook) CALL dr_hook('AVERAGE2_CTI',0,zhook_handle)
64 zsize(:)=REAL(nsize(:))
65 !
66 WHERE (nsize(:)>=36)
67 !
68 !----------------------------------------------------------------------------
69 !
70 !* 1. Mean CTI
71 ! --------------
72 !
73  xmean_work(:)=xsumval(:)/zsize(:)
74 !
75 !-------------------------------------------------------------------------------
76 !
77 !* 2. Standard deviation
78 ! ------------------
79 !
80  WHERE (xmax_work(:)-xmin_work(:)>=1.0)
81  xstd_work(:)=sqrt( max(0.,xsumval2(:)/nsize(:) - xmean_work(:)*xmean_work(:)) )
82  ELSEWHERE
83  xstd_work(:)=0.0
84  END WHERE
85 !
86 !-------------------------------------------------------------------------------
87 !
88 !* 3. Skewness
89 ! --------
90 !
91  WHERE(xstd_work(:)>0.0)
92 !
93  xskew_work(:)=xsumval3(:)-zsize(:)*xmean_work(:)*xmean_work(:)*xmean_work(:) &
94  -3.0*zsize(:)*xmean_work(:)*xstd_work(:)*xstd_work(:)
95 !
96  xskew_work(:)=xskew_work(:)/(zsize(:)*xstd_work(:)*xstd_work(:)*xstd_work(:))
97 !
98  END WHERE
99 !
100 !----------------------------------------------------------------------------
101 !
102 END WHERE
103 IF (lhook) CALL dr_hook('AVERAGE2_CTI',1,zhook_handle)
104 !
105 !-------------------------------------------------------------------------------
106 !
107 END SUBROUTINE average2_cti
subroutine average2_cti
Definition: average2_cti.F90:6