Line data Source code
1 : !-----------------------------------------------------------------------
2 : ! $Id$
3 : !===============================================================================
4 :
5 : module stats_lh_sfc_module
6 :
7 : implicit none
8 :
9 : private ! Set Default Scope
10 :
11 : public :: stats_init_lh_sfc
12 :
13 : ! Constant parameters
14 : integer, parameter, public :: nvarmax_lh_sfc = 10 ! Maximum variables allowed
15 :
16 : contains
17 :
18 : !-----------------------------------------------------------------------
19 0 : subroutine stats_init_lh_sfc( vars_lh_sfc, & ! intent(in)
20 : l_error, & ! intent(inout)
21 : stats_metadata, stats_lh_sfc ) ! intent(inout)
22 :
23 : ! Description:
24 : ! Initializes array indices for stats_lh_sfc
25 : ! References:
26 : ! None
27 : !-----------------------------------------------------------------------
28 :
29 : use constants_clubb, only: &
30 : fstderr ! Constant(s)
31 :
32 : use stats_type_utilities, only: &
33 : stat_assign ! Procedure
34 :
35 : use stats_type, only: &
36 : stats ! Type
37 :
38 : use stats_variables, only: &
39 : stats_metadata_type
40 :
41 : implicit none
42 :
43 : ! External
44 : intrinsic :: trim
45 :
46 : !--------------------- Input Variable ---------------------
47 : character(len= * ), dimension(nvarmax_lh_sfc), intent(in) :: vars_lh_sfc
48 :
49 : !--------------------- InOut Variables ---------------------
50 : type (stats_metadata_type), intent(inout) :: &
51 : stats_metadata
52 :
53 : type (stats), target, intent(inout) :: &
54 : stats_lh_sfc
55 :
56 : logical, intent(inout) :: l_error
57 :
58 : !--------------------- Local Varables ---------------------
59 : integer :: i, k
60 :
61 : !--------------------- Begin Code ---------------------
62 :
63 : ! Default initialization for array indices for stats_sfc is zero (see module
64 : ! stats_variables)
65 :
66 : ! Assign pointers for statistics variables stats_sfc
67 :
68 0 : k = 1
69 0 : do i = 1, stats_lh_sfc%num_output_fields
70 :
71 0 : select case ( trim( vars_lh_sfc(i) ) )
72 :
73 : case ( 'lh_morr_snow_rate' )
74 0 : stats_metadata%ilh_morr_snow_rate = k
75 : call stat_assign( var_index=stats_metadata%ilh_morr_snow_rate, var_name="lh_morr_snow_rate", & !intent(in)
76 : var_description="Snow+Ice+Graupel fallout rate from Morrison scheme [mm/day]", & ! In
77 : var_units="mm/day", l_silhs=.true., & ! intent(in)
78 0 : grid_kind=stats_lh_sfc ) ! intent(inout)
79 0 : k = k + 1
80 :
81 : case ( 'lh_vwp' )
82 0 : stats_metadata%ilh_vwp = k
83 : call stat_assign( var_index=stats_metadata%ilh_vwp, var_name="lh_vwp", & ! intent(in)
84 : var_description="Vapor water path [kg/m^2]", var_units="kg/m^2", & ! intent(in)
85 : l_silhs=.true., & ! intent(in)
86 0 : grid_kind=stats_lh_sfc ) ! intent(inout)
87 0 : k = k + 1
88 :
89 : case ( 'lh_lwp' )
90 0 : stats_metadata%ilh_lwp = k
91 : call stat_assign( var_index=stats_metadata%ilh_lwp, var_name="lh_lwp", & ! intent(in)
92 : var_description="Liquid water path [kg/m^2]", var_units="kg/m^2", & ! intent(in)
93 : l_silhs=.true., & ! intent(in)
94 0 : grid_kind=stats_lh_sfc ) ! intent(inout)
95 0 : k = k + 1
96 :
97 : case ( 'k_lh_start' )
98 0 : stats_metadata%ik_lh_start = k
99 : call stat_assign( var_index=stats_metadata%ik_lh_start, var_name="k_lh_start", & ! intent(in)
100 : var_description="Index of height level for SILHS sampling preferentially within &
101 : &cloud [integer]", var_units="integer", l_silhs=.true., &
102 0 : grid_kind=stats_lh_sfc ) ! intent(inout)
103 0 : k = k + 1
104 :
105 : case ( 'lh_sample_weights_sum' )
106 0 : stats_metadata%ilh_sample_weights_sum = k
107 : call stat_assign( var_index=stats_metadata%ilh_sample_weights_sum, & ! intent(in)
108 : var_name="lh_sample_weights_sum", & ! intent(in)
109 : var_description="Sum of the sample point weights [-]", var_units="-", & ! intent(in)
110 : l_silhs=.true., & ! intent(in)
111 0 : grid_kind=stats_lh_sfc ) ! intent(inout)
112 0 : k = k + 1
113 :
114 : case ( 'lh_sample_weights_avg' )
115 0 : stats_metadata%ilh_sample_weights_avg = k
116 : call stat_assign( var_index=stats_metadata%ilh_sample_weights_avg, & ! intent(in)
117 : var_name="lh_sample_weights_avg", & ! intent(in)
118 : var_description="Average of the sample point weights [-]", & ! intent(in)
119 : var_units="-", & ! intent(in)
120 : l_silhs=.true., & ! intent(in)
121 0 : grid_kind=stats_lh_sfc ) ! intent(inout)
122 0 : k = k + 1
123 :
124 : case default
125 0 : write(fstderr,*) 'Error: unrecognized variable in vars_lh_sfc: ', &
126 0 : trim( vars_lh_sfc(i) )
127 0 : l_error = .true. ! This will stop the run.
128 :
129 : end select
130 :
131 : end do ! i = 1, stats_lh_sfc%num_output_fields
132 :
133 0 : return
134 : end subroutine stats_init_lh_sfc
135 :
136 : end module stats_lh_sfc_module
137 :
|