LCOV - code coverage report
Current view: top level - physics/clubb/src/CLUBB_core - stats_zm_module.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 997 0.0 %
Date: 2024-12-17 17:57:11 Functions: 0 1 0.0 %

          Line data    Source code
       1             : !-----------------------------------------------------------------------
       2             : ! $Id$
       3             : !===============================================================================
       4             : module stats_zm_module
       5             : 
       6             :   implicit none
       7             : 
       8             :   private ! Default Scope
       9             : 
      10             :   public :: stats_init_zm
      11             : 
      12             :   ! Constant parameters
      13             :   integer, parameter, public :: nvarmax_zm = 350  ! Maximum variables allowed
      14             : 
      15             :   contains
      16             : 
      17             : !-----------------------------------------------------------------------
      18           0 :   subroutine stats_init_zm( hydromet_dim, sclr_dim, edsclr_dim, & ! intent(in)
      19           0 :                             hydromet_list, l_mix_rat_hm,        & ! intent(in)
      20           0 :                             vars_zm,                            & ! intent(in)
      21             :                             l_error,                            & ! intent(inout)
      22             :                             stats_metadata, stats_zm )            ! intent(inout)
      23             : 
      24             : ! Description:
      25             : !   Initializes array indices for stats_zm
      26             : 
      27             : ! Note:
      28             : !   All code that is within subroutine stats_init_zm, including variable
      29             : !   allocation code, is not called if l_stats is false.  This subroutine is
      30             : !   called only when l_stats is true.
      31             : 
      32             : !-----------------------------------------------------------------------
      33             : 
      34             :     use constants_clubb, only: &
      35             :         fstderr ! Constant(s)
      36             : 
      37             :     use stats_type_utilities, only: &
      38             :         stat_assign ! Procedure
      39             : 
      40             :     use stats_type, only: &
      41             :         stats ! Type
      42             : 
      43             :     use stats_variables, only: &
      44             :         stats_metadata_type
      45             : 
      46             :     implicit none
      47             : 
      48             :     ! External
      49             :     intrinsic :: trim
      50             : 
      51             :     !--------------------- Input Variables ---------------------
      52             :     integer, intent(in) :: &
      53             :       hydromet_dim, &
      54             :       sclr_dim, &
      55             :       edsclr_dim
      56             : 
      57             :     character(len=10), dimension(hydromet_dim), intent(in) :: & 
      58             :       hydromet_list
      59             : 
      60             :     logical, dimension(hydromet_dim), intent(in) :: &
      61             :       l_mix_rat_hm   ! if true, then the quantity is a hydrometeor mixing ratio
      62             : 
      63             :     character(len= * ), dimension(nvarmax_zm), intent(in) :: &
      64             :       vars_zm ! stats_zm variable names
      65             : 
      66             :     !--------------------- InOut Variables ---------------------      
      67             :     type (stats_metadata_type), intent(inout) :: &
      68             :       stats_metadata
      69             : 
      70             :     type (stats), target, intent(inout) :: &
      71             :       stats_zm
      72             : 
      73             :     logical, intent(inout) :: l_error
      74             : 
      75             :     !--------------------- Local Varables ---------------------
      76             :     integer :: tot_zm_loops
      77             : 
      78             :     integer :: hm_idx, hmx_idx, hmy_idx
      79             : 
      80             :     character(len=10) :: hm_type, hmx_type, hmy_type
      81             : 
      82             :     integer :: i, j, k
      83             : 
      84             :     character(len=50) :: sclr_idx
      85             : 
      86             :     !--------------------- Begin Code ---------------------
      87             : 
      88             :     ! The default initialization for array indices for stats_zm is zero (see module
      89             :     ! stats_variables)
      90             : 
      91             :     ! If any of the index arrays are allocated, then we have called this before
      92             :     ! to set up stats_metadata, so all we want to do is set stats_zm via stats_assign
      93           0 :     if ( .not. allocated(stats_metadata%ihydrometp2) ) then
      94             : 
      95           0 :       allocate( stats_metadata%ihydrometp2(1:hydromet_dim) )
      96           0 :       allocate( stats_metadata%iwphydrometp(1:hydromet_dim) )
      97           0 :       allocate( stats_metadata%irtphmp(1:hydromet_dim) )
      98           0 :       allocate( stats_metadata%ithlphmp(1:hydromet_dim) )
      99           0 :       allocate( stats_metadata%ihmxphmyp(1:hydromet_dim,1:hydromet_dim) )
     100           0 :       allocate( stats_metadata%iK_hm(1:hydromet_dim) )
     101             : 
     102           0 :       stats_metadata%ihydrometp2(:) = 0
     103           0 :       stats_metadata%iwphydrometp(:) = 0
     104           0 :       stats_metadata%irtphmp(:) = 0
     105           0 :       stats_metadata%ithlphmp(:) = 0
     106           0 :       stats_metadata%ihmxphmyp(:,:) = 0
     107           0 :       stats_metadata%iK_hm(:) = 0
     108             : 
     109             :       ! Allocate and then zero out passive scalar arrays on the stats_zm grid (fluxes,
     110             :       ! variances and other high-order moments)
     111           0 :       allocate( stats_metadata%isclrprtp(1:sclr_dim) )
     112           0 :       allocate( stats_metadata%isclrp2(1:sclr_dim) )
     113           0 :       allocate( stats_metadata%isclrpthvp(1:sclr_dim) )
     114           0 :       allocate( stats_metadata%isclrpthlp(1:sclr_dim) )
     115           0 :       allocate( stats_metadata%isclrprcp(1:sclr_dim) )
     116           0 :       allocate( stats_metadata%iwpsclrp(1:sclr_dim) )
     117           0 :       allocate( stats_metadata%iwp2sclrp(1:sclr_dim) )
     118           0 :       allocate( stats_metadata%iwpsclrp2(1:sclr_dim) )
     119           0 :       allocate( stats_metadata%iwpsclrprtp(1:sclr_dim) )
     120           0 :       allocate( stats_metadata%iwpsclrpthlp(1:sclr_dim) )
     121           0 :       allocate( stats_metadata%iwpedsclrp(1:edsclr_dim) )
     122             : 
     123           0 :       stats_metadata%isclrprtp(:)    = 0
     124           0 :       stats_metadata%isclrp2(:)      = 0
     125           0 :       stats_metadata%isclrpthvp(:)   = 0
     126           0 :       stats_metadata%isclrpthlp(:)   = 0
     127           0 :       stats_metadata%isclrprcp(:)    = 0
     128           0 :       stats_metadata%iwpsclrp(:)     = 0
     129           0 :       stats_metadata%iwp2sclrp(:)    = 0
     130           0 :       stats_metadata%iwpsclrp2(:)    = 0
     131           0 :       stats_metadata%iwpsclrprtp(:)  = 0
     132           0 :       stats_metadata%iwpsclrpthlp(:) = 0
     133           0 :       stats_metadata%iwpedsclrp(:)   = 0
     134             : 
     135             :     end if
     136             : 
     137             :     ! Assign pointers for statistics variables stats_zm using stat_assign
     138             : 
     139           0 :     tot_zm_loops = stats_zm%num_output_fields
     140             : 
     141           0 :     if ( any( vars_zm == "hydrometp2" ) ) then
     142             :        ! Correct for number of variables found under "hydrometp2".
     143             :        ! Subtract 1 from the loop size for each hydrometeor.
     144           0 :        tot_zm_loops = tot_zm_loops - hydromet_dim
     145             :        ! Add 1 for "hydrometp2" to the loop size.
     146           0 :        tot_zm_loops = tot_zm_loops + 1
     147             :     endif
     148             : 
     149           0 :     if ( any( vars_zm == "wphydrometp" ) ) then
     150             :        ! Correct for number of variables found under "wphydrometp".
     151             :        ! Subtract 1 from the loop size for each hydrometeor.
     152           0 :        tot_zm_loops = tot_zm_loops - hydromet_dim
     153             :        ! Add 1 for "wphydrometp" to the loop size.
     154           0 :        tot_zm_loops = tot_zm_loops + 1
     155             :     endif
     156             : 
     157           0 :     if ( any( vars_zm == "rtphmp" ) ) then
     158             :        ! Correct for number of variables found under "rtphmp".
     159             :        ! Subtract 1 from the loop size for each hydrometeor.
     160           0 :        tot_zm_loops = tot_zm_loops - hydromet_dim
     161             :        ! Add 1 for "rtphmp" to the loop size.
     162           0 :        tot_zm_loops = tot_zm_loops + 1
     163             :     endif
     164             : 
     165           0 :     if ( any( vars_zm == "thlphmp" ) ) then
     166             :        ! Correct for number of variables found under "thlphmp".
     167             :        ! Subtract 1 from the loop size for each hydrometeor.
     168           0 :        tot_zm_loops = tot_zm_loops - hydromet_dim
     169             :        ! Add 1 for "thlphmp" to the loop size.
     170           0 :        tot_zm_loops = tot_zm_loops + 1
     171             :     endif
     172             : 
     173           0 :     if ( any( vars_zm == "hmxphmyp" ) ) then
     174             :        ! Correct for number of variables found under "hmxphmyp".
     175             :        ! Subtract the number of overall covariances of two hydrometeors, which
     176             :        ! is found by:  (1/2) * hydromet_dim * ( hydromet_dim - 1 );
     177             :        ! from the loop size.
     178           0 :        tot_zm_loops = tot_zm_loops - hydromet_dim * ( hydromet_dim - 1 ) / 2
     179             :        ! Add 1 for "hmxphmyp" to the loop size.
     180           0 :        tot_zm_loops = tot_zm_loops + 1
     181             :     endif
     182             : 
     183           0 :     if ( any( vars_zm == "K_hm" ) ) then
     184             :        ! Correct for number of variables found under "K_hm".
     185             :        ! Subtract 1 from the loop size for each hydrometeor.
     186           0 :        tot_zm_loops = tot_zm_loops - hydromet_dim
     187             :        ! Add 1 for "K_hm" to the loop size.
     188           0 :        tot_zm_loops = tot_zm_loops + 1
     189             :     endif
     190             : 
     191           0 :      if ( any( vars_zm == "sclrprtp" ) ) then
     192             :        ! Correct for number of variables found under "sclrprtp".
     193             :        ! Subtract 1 from the loop size for each scalar.
     194           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     195             :        ! Add 1 for "sclrprtp" to the loop size.
     196           0 :        tot_zm_loops = tot_zm_loops + 1
     197             :     endif
     198             : 
     199           0 :     if ( any( vars_zm == "sclrp2" ) ) then
     200             :        ! Correct for number of variables found under "sclrp2".
     201             :        ! Subtract 1 from the loop size for each scalar.
     202           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     203             :        ! Add 1 for "sclrp2" to the loop size.
     204           0 :        tot_zm_loops = tot_zm_loops + 1
     205             :     endif
     206             : 
     207           0 :     if ( any( vars_zm == "sclrpthvp" ) ) then
     208             :        ! Correct for number of variables found under "sclrpthvp".
     209             :        ! Subtract 1 from the loop size for each scalar.
     210           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     211             :        ! Add 1 for "sclrpthvp" to the loop size.
     212           0 :        tot_zm_loops = tot_zm_loops + 1
     213             :     endif
     214             : 
     215           0 :     if ( any( vars_zm == "sclrpthlp" ) ) then
     216             :        ! Correct for number of variables found under "sclrpthlp".
     217             :        ! Subtract 1 from the loop size for each scalar.
     218           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     219             :        ! Add 1 for "sclrpthlp" to the loop size.
     220           0 :        tot_zm_loops = tot_zm_loops + 1
     221             :     endif
     222             : 
     223           0 :     if ( any( vars_zm == "sclrprcp" ) ) then
     224             :        ! Correct for number of variables found under "sclrprcp".
     225             :        ! Subtract 1 from the loop size for each scalar.
     226           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     227             :        ! Add 1 for "sclrprcp" to the loop size.
     228           0 :        tot_zm_loops = tot_zm_loops + 1
     229             :     endif
     230             : 
     231           0 :     if ( any( vars_zm == "wpsclrp" ) ) then
     232             :        ! Correct for number of variables found under "wpsclrp".
     233             :        ! Subtract 1 from the loop size for each scalar.
     234           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     235             :        ! Add 1 for "wpsclrp" to the loop size.
     236           0 :        tot_zm_loops = tot_zm_loops + 1
     237             :     endif
     238             : 
     239           0 :     if ( any( vars_zm == "wpsclrp2" ) ) then
     240             :        ! Correct for number of variables found under "wpsclrp2".
     241             :        ! Subtract 1 from the loop size for each scalar.
     242           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     243             :        ! Add 1 for "wpsclrp2" to the loop size.
     244           0 :        tot_zm_loops = tot_zm_loops + 1
     245             :     endif
     246             : 
     247           0 :     if ( any( vars_zm == "wp2sclrp" ) ) then
     248             :        ! Correct for number of variables found under "wp2sclrp".
     249             :        ! Subtract 1 from the loop size for each scalar.
     250           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     251             :        ! Add 1 for "wp2sclrp" to the loop size.
     252           0 :        tot_zm_loops = tot_zm_loops + 1
     253             :     endif
     254             : 
     255           0 :     if ( any( vars_zm == "wpsclrprtp" ) ) then
     256             :        ! Correct for number of variables found under "wpsclrprtp".
     257             :        ! Subtract 1 from the loop size for each scalar.
     258           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     259             :        ! Add 1 for "wpsclrprtp" to the loop size.
     260           0 :        tot_zm_loops = tot_zm_loops + 1
     261             :     endif
     262             : 
     263           0 :     if ( any( vars_zm == "wpsclrpthlp" ) ) then
     264             :        ! Correct for number of variables found under "wpsclrpthlp".
     265             :        ! Subtract 1 from the loop size for each scalar.
     266           0 :        tot_zm_loops = tot_zm_loops - sclr_dim
     267             :        ! Add 1 for "wpsclrpthlp" to the loop size.
     268           0 :        tot_zm_loops = tot_zm_loops + 1
     269             :     endif
     270             : 
     271           0 :     if ( any( vars_zm == "wpedsclrp" ) ) then
     272             :        ! Correct for number of variables found under "wpedsclrp".
     273             :        ! Subtract 1 from the loop size for each scalar.
     274           0 :        tot_zm_loops = tot_zm_loops - edsclr_dim
     275             :        ! Add 1 for "wpedsclrp" to the loop size.
     276           0 :        tot_zm_loops = tot_zm_loops + 1
     277             :   endif
     278             : 
     279             : 
     280             : 
     281           0 :     k = 1
     282             : 
     283           0 :     do i = 1, tot_zm_loops
     284             : 
     285           0 :       select case ( trim( vars_zm(i) ) )
     286             : 
     287             :       case ('wp2')
     288           0 :         stats_metadata%iwp2 = k
     289             :         call stat_assign( var_index=stats_metadata%iwp2, var_name="wp2", &
     290             :              var_description="w'^2, Variance of vertical air velocity", &
     291           0 :              var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
     292           0 :         k = k + 1
     293             : 
     294             :       case ('rtp2')
     295           0 :         stats_metadata%irtp2 = k
     296             :         call stat_assign( var_index=stats_metadata%irtp2, var_name="rtp2", &
     297             :              var_description="rt'^2, Variance of total water, rt", var_units="(kg/kg)^2", &
     298           0 :              l_silhs=.false., grid_kind=stats_zm )
     299           0 :         k = k + 1
     300             : 
     301             :       case ('thlp2')
     302           0 :         stats_metadata%ithlp2 = k
     303             :         call stat_assign( var_index=stats_metadata%ithlp2, var_name="thlp2", &
     304             :              var_description="thl'^2, Variance of theta_l", var_units="K^2", l_silhs=.false., &
     305           0 :              grid_kind=stats_zm )
     306           0 :         k = k + 1
     307             : 
     308             :       case ('rtpthlp')
     309           0 :         stats_metadata%irtpthlp = k
     310             :         call stat_assign( var_index=stats_metadata%irtpthlp, var_name="rtpthlp", &
     311             :              var_description="rt'thl', Covariance of rt and theta_l", &
     312           0 :              var_units="(kg K)/kg", l_silhs=.false., grid_kind=stats_zm )
     313           0 :         k = k + 1
     314             : 
     315             :       case ('wprtp')
     316           0 :         stats_metadata%iwprtp = k
     317             : 
     318             :         call stat_assign( var_index=stats_metadata%iwprtp, var_name="wprtp", &
     319             :              var_description="w'rt', Vertical turbulent flux of total water, rt", &
     320           0 :              var_units="(m kg)/(s kg)", l_silhs=.false., grid_kind=stats_zm )
     321           0 :         k = k + 1
     322             : 
     323             :       case ('wpthlp')
     324           0 :         stats_metadata%iwpthlp = k
     325             : 
     326             :         call stat_assign( var_index=stats_metadata%iwpthlp, var_name="wpthlp", &
     327             :              var_description="w'thl', Vertical turbulent flux of theta_l", &
     328           0 :              var_units="(m K)/s", l_silhs=.false., grid_kind=stats_zm )
     329           0 :         k = k + 1
     330             : 
     331             :       case ('wp3_zm')
     332           0 :         stats_metadata%iwp3_zm = k
     333             :         call stat_assign( var_index=stats_metadata%iwp3_zm, var_name="wp3_zm", &
     334             :              var_description="w'^3_zm, w'^3 interpolated to moment. levels", &
     335           0 :              var_units="(m^3)/(s^3)", l_silhs=.false., grid_kind=stats_zm )
     336           0 :         k = k + 1
     337             : 
     338             :       case ('thlp3_zm')
     339           0 :         stats_metadata%ithlp3_zm = k
     340             :         call stat_assign( var_index=stats_metadata%ithlp3_zm, var_name="thlp3_zm", &
     341             :              var_description="thl'^3 interpolated to moment. levels", &
     342           0 :              var_units="K^3", l_silhs=.false., grid_kind=stats_zm )
     343           0 :         k = k + 1
     344             : 
     345             :       case ('rtp3_zm')
     346           0 :         stats_metadata%irtp3_zm = k
     347             :         call stat_assign( var_index=stats_metadata%irtp3_zm, var_name="rtp3_zm", &
     348             :              var_description="rt'^3 interpolated to moment. levels", &
     349           0 :              var_units="(kg^3)/(kg^3)", l_silhs=.false., grid_kind=stats_zm )
     350           0 :         k = k + 1
     351             : 
     352             :       case ('wp2up2')
     353           0 :         stats_metadata%iwp2up2 = k
     354             :         call stat_assign( var_index=stats_metadata%iwp2up2, var_name="wp2up2", &
     355             :              var_description="w'^2u'^2, 4th-order moment of vertical and zonal air velocity", &
     356           0 :              var_units="(m^4)/(s^4)", l_silhs=.false., grid_kind=stats_zm )
     357           0 :         k = k + 1
     358             : 
     359             :       case ('wp2vp2')
     360           0 :         stats_metadata%iwp2vp2 = k
     361             :         call stat_assign( var_index=stats_metadata%iwp2vp2, var_name="wp2vp2", &
     362             :              var_description &
     363             :                ="w'^2v'^2, 4th-order moment of vert. and merid. air velocity", &
     364           0 :              var_units="(m^4)/(s^4)", l_silhs=.false., grid_kind=stats_zm )
     365           0 :         k = k + 1
     366             : 
     367             :       case ('wp4')
     368           0 :         stats_metadata%iwp4 = k
     369             :         call stat_assign( var_index=stats_metadata%iwp4, var_name="wp4", &
     370             :              var_description="w'^4, Fourth-order moment of vertical air velocity", &
     371           0 :              var_units="(m^4)/(s^4)", l_silhs=.false., grid_kind=stats_zm )
     372           0 :         k = k + 1
     373             : 
     374             :       case ('wpthvp')
     375           0 :         stats_metadata%iwpthvp = k
     376             :         call stat_assign( var_index=stats_metadata%iwpthvp, var_name="wpthvp", &
     377             :              var_description="w'thv', Buoyancy flux", var_units="K m/s", l_silhs=.false., &
     378           0 :              grid_kind=stats_zm )
     379           0 :         k = k + 1
     380             : 
     381             :       case ('rtpthvp')
     382           0 :         stats_metadata%irtpthvp = k
     383             :         call stat_assign( var_index=stats_metadata%irtpthvp, var_name="rtpthvp", &
     384             :              var_description="rt'thv', Covariance of rt and theta_v", var_units="(kg/kg) K", &
     385             :              l_silhs=.false., &
     386           0 :              grid_kind=stats_zm )
     387           0 :         k = k + 1
     388             : 
     389             :       case ('thlpthvp')
     390           0 :         stats_metadata%ithlpthvp = k
     391             :         call stat_assign( var_index=stats_metadata%ithlpthvp, var_name="thlpthvp", &
     392             :           var_description="thl'thv', Covariance of theta_l and theta_v", var_units="K^2", &
     393           0 :           l_silhs=.false., grid_kind=stats_zm )
     394           0 :         k = k + 1
     395             : 
     396             :       case ('tau_zm')
     397           0 :         stats_metadata%itau_zm = k
     398             : 
     399             :         call stat_assign( var_index=stats_metadata%itau_zm, var_name="tau_zm", &
     400             :              var_description="tau_zm, Time-scale tau on momentum levels", var_units="s", &
     401           0 :              l_silhs=.false., grid_kind=stats_zm )
     402           0 :         k = k + 1
     403             : 
     404             :       case ('invrs_tau_zm')
     405           0 :         stats_metadata%iinvrs_tau_zm = k
     406             : 
     407             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_zm, var_name="invrs_tau_zm", &
     408             :              var_description="invrs tau on momentum levels [s-1]", &
     409           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     410           0 :         k = k + 1
     411             : 
     412             :       case ('invrs_tau_xp2_zm')
     413           0 :         stats_metadata%iinvrs_tau_xp2_zm = k
     414             : 
     415             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_xp2_zm, var_name="invrs_tau_xp2_zm", &
     416             :              var_description="invrs tau xp2 on momentum levels [s-1]", &
     417           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     418           0 :         k = k + 1
     419             : 
     420             :       case ('invrs_tau_wp2_zm')
     421           0 :         stats_metadata%iinvrs_tau_wp2_zm = k
     422             : 
     423             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_wp2_zm, var_name="invrs_tau_wp2_zm", &
     424             :              var_description="invrs tau wp2 on momentum levels [s-1]", &
     425           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     426           0 :         k = k + 1
     427             : 
     428             :       case ('invrs_tau_wpxp_zm')
     429           0 :         stats_metadata%iinvrs_tau_wpxp_zm = k
     430             : 
     431             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_wpxp_zm, var_name="invrs_tau_wpxp_zm", &
     432             :              var_description="invrs tau wpxp on momentum levels [s-1]", &
     433           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     434           0 :         k = k + 1
     435             : 
     436             :       case ('invrs_tau_wp3_zm')
     437           0 :         stats_metadata%iinvrs_tau_wp3_zm = k
     438             : 
     439             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_wp3_zm, var_name="invrs_tau_wp3_zm", &
     440             :              var_description="invrs tau wp3 on momentum levels [s-1]", &
     441           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     442           0 :         k = k + 1
     443             : 
     444             :       case ('invrs_tau_no_N2_zm')
     445           0 :         stats_metadata%iinvrs_tau_no_N2_zm = k
     446             : 
     447             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_no_N2_zm, var_name="invrs_tau_no_N2_zm", &
     448             :              var_description="invrs tau_no_N2 on momentum levels [s-1]", &
     449           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     450           0 :         k = k + 1
     451             : 
     452             :       case ('invrs_tau_bkgnd')
     453           0 :         stats_metadata%iinvrs_tau_bkgnd = k
     454             : 
     455             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_bkgnd, var_name="invrs_tau_bkgnd", &
     456             :              var_description="invrs tau of bkgnd on momentum levels [s-1]", &
     457           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     458           0 :         k = k + 1
     459             : 
     460             :       case ('invrs_tau_sfc')
     461           0 :         stats_metadata%iinvrs_tau_sfc = k
     462             : 
     463             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_sfc, var_name="invrs_tau_sfc", &
     464             :              var_description="invrs tau of surface on momentum levels [s-1]", &
     465           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     466           0 :         k = k + 1
     467             : 
     468             :       case ('invrs_tau_shear')
     469           0 :         stats_metadata%iinvrs_tau_shear = k
     470             : 
     471             :         call stat_assign( var_index=stats_metadata%iinvrs_tau_shear, var_name="invrs_tau_shear", &
     472             :              var_description="invrs tau of shear on momentum levels [s-1]", &
     473           0 :              var_units="s^-1", l_silhs=.false., grid_kind=stats_zm )
     474           0 :         k = k + 1
     475             : 
     476             :       case ('Kh_zm')
     477           0 :         stats_metadata%iKh_zm = k
     478             : 
     479             :         call stat_assign( var_index=stats_metadata%iKh_zm, var_name="Kh_zm", &
     480             :              var_description="Kh_zm, Eddy diffusivity on momentum levels", &
     481           0 :              var_units="m^2/s", l_silhs=.false., grid_kind=stats_zm )
     482           0 :         k = k + 1
     483             : 
     484             :       case ('K_hm')
     485             : 
     486           0 :          do hm_idx = 1, hydromet_dim, 1
     487             : 
     488           0 :             hm_type = hydromet_list(hm_idx)
     489             : 
     490           0 :             stats_metadata%iK_hm(hm_idx) = k
     491             : 
     492             : 
     493           0 :             call stat_assign( var_index=stats_metadata%iK_hm(hm_idx), &
     494             :                                  var_name="K_hm_"//trim( hm_type(1:2) ), &
     495             :                                  var_description="Eddy. diff. coef. of "  &
     496             :                                  // trim(hm_type(1:2)) &
     497             :                                  // " [m^2/s]", &
     498             :                                  var_units="[m^2/s]", &
     499           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     500             : 
     501           0 :             k = k + 1
     502             : 
     503             :           end do
     504             : 
     505             : 
     506             :       case ('wprcp')
     507           0 :         stats_metadata%iwprcp = k
     508             :         call stat_assign( var_index=stats_metadata%iwprcp, var_name="wprcp", &
     509             :              var_description="w'rc'", var_units="(m/s) (kg/kg)", &
     510           0 :              l_silhs=.false., grid_kind=stats_zm )
     511           0 :         k = k + 1
     512             : 
     513             :       case ('rc_coef_zm')
     514           0 :         stats_metadata%irc_coef_zm = k
     515             :         call stat_assign( var_index=stats_metadata%irc_coef_zm, var_name="rc_coef_zm", &
     516             :              var_description="rc_coef_zm, Coefficient of X'r_c'", &
     517           0 :              var_units="K/(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
     518           0 :         k = k + 1
     519             : 
     520             :       case ('thlprcp')
     521           0 :         stats_metadata%ithlprcp = k
     522             :         call stat_assign( var_index=stats_metadata%ithlprcp, var_name="thlprcp", &
     523             :              var_description="thl'rc'", var_units="K (kg/kg)", l_silhs=.false., &
     524           0 :              grid_kind=stats_zm )
     525           0 :         k = k + 1
     526             : 
     527             :       case ('rtprcp')
     528           0 :         stats_metadata%irtprcp = k
     529             : 
     530             :         call stat_assign( var_index=stats_metadata%irtprcp, var_name="rtprcp", &
     531             :              var_description="rt'rc'", var_units="(kg^2)/(kg^2)", &
     532           0 :              l_silhs=.false., grid_kind=stats_zm )
     533           0 :         k = k + 1
     534             : 
     535             :       case ('rcp2')
     536           0 :         stats_metadata%ircp2 = k
     537             :         call stat_assign( var_index=stats_metadata%ircp2, var_name="rcp2", &
     538             :              var_description="rc'^2, Variance of cloud water mixing ratio", &
     539             :              var_units="(kg^2)/(kg^2)", l_silhs=.false., &
     540           0 :              grid_kind=stats_zm )
     541           0 :         k = k + 1
     542             :       case ('upwp')
     543           0 :         stats_metadata%iupwp = k
     544             :         call stat_assign( var_index=stats_metadata%iupwp, var_name="upwp", &
     545             :              var_description="u'w', Vertical turbulent flux of eastward (u) wind", &
     546           0 :              var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
     547           0 :         k = k + 1
     548             :       case ('vpwp')
     549           0 :         stats_metadata%ivpwp = k
     550             :         call stat_assign( var_index=stats_metadata%ivpwp, var_name="vpwp", &
     551             :              var_description="v'w', Vertical turbulent flux of northward (v) wind", &
     552           0 :              var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
     553           0 :         k = k + 1
     554             :       case ('upthlp')
     555           0 :         stats_metadata%iupthlp = k
     556             :         call stat_assign( var_index=stats_metadata%iupthlp, var_name="upthlp", &
     557             :              var_description="u'thl', Eastward theta_l flux", &
     558           0 :              var_units="(m/s)K", l_silhs=.false., grid_kind=stats_zm )
     559           0 :         k = k + 1
     560             :       case ('uprtp')
     561           0 :         stats_metadata%iuprtp = k
     562             :         call stat_assign( var_index=stats_metadata%iuprtp, var_name="uprtp", &
     563             :              var_description="u'rt', Eastward total water flux", &
     564           0 :              var_units="(m/s)(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
     565           0 :         k = k + 1
     566             :       case ('vpthlp')
     567           0 :         stats_metadata%ivpthlp = k
     568             :         call stat_assign( var_index=stats_metadata%ivpthlp, var_name="vpthlp", &
     569             :              var_description="v'thl', Northward theta_l flux", &
     570           0 :              var_units="(m/s)K", l_silhs=.false., grid_kind=stats_zm )
     571           0 :         k = k + 1
     572             :       case ('vprtp')
     573           0 :         stats_metadata%ivprtp = k
     574             :         call stat_assign( var_index=stats_metadata%ivprtp, var_name="vprtp", &
     575             :              var_description="v'rt', Northward total water flux", &
     576           0 :              var_units="(m/s)(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
     577           0 :         k = k + 1
     578             :       case ('upthvp')
     579           0 :         stats_metadata%iupthvp = k
     580             :         call stat_assign( var_index=stats_metadata%iupthvp, var_name="upthvp", &
     581             :              var_description="u'thv', Eastward theta_v flux", &
     582           0 :              var_units="(m/s)K", l_silhs=.false., grid_kind=stats_zm )
     583           0 :         k = k + 1
     584             :       case ('uprcp')
     585           0 :         stats_metadata%iuprcp = k
     586             :         call stat_assign( var_index=stats_metadata%iuprcp, var_name="uprcp", &
     587             :              var_description="u'rc', Eastward liquid water flux", &
     588           0 :              var_units="(m/s)(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
     589           0 :         k = k + 1
     590             :       case ('vpthvp')
     591           0 :         stats_metadata%ivpthvp = k
     592             :         call stat_assign( var_index=stats_metadata%ivpthvp, var_name="vpthvp", &
     593             :              var_description="v'thv', Northward theta_v flux", &
     594           0 :              var_units="(m/s)K", l_silhs=.false., grid_kind=stats_zm )
     595           0 :         k = k + 1
     596             :       case ('vprcp')
     597           0 :         stats_metadata%ivprcp = k
     598             :         call stat_assign( var_index=stats_metadata%ivprcp, var_name="vprcp", &
     599             :              var_description="v'rc', Northward liquid water flux", &
     600           0 :              var_units="(m/s)(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
     601           0 :         k = k + 1
     602             :       case ('rho_zm')
     603           0 :         stats_metadata%irho_zm = k
     604             :         call stat_assign( var_index=stats_metadata%irho_zm, var_name="rho_zm", &
     605             :              var_description="rho_zm, Density on momentum levels", var_units="kg m^{-3}", &
     606           0 :              l_silhs=.false., grid_kind=stats_zm )
     607           0 :         k = k + 1
     608             :       case ('sigma_sqd_w')
     609           0 :         stats_metadata%isigma_sqd_w = k
     610             :         call stat_assign( var_index=stats_metadata%isigma_sqd_w, var_name="sigma_sqd_w", &
     611             :              var_description="sigma_sqd_w, Nondim w variance of Gaussian component", &
     612           0 :              var_units="-", l_silhs=.false., grid_kind=stats_zm )
     613           0 :         k = k + 1
     614             :       case ('rho_ds_zm')
     615           0 :         stats_metadata%irho_ds_zm = k
     616             :         call stat_assign( var_index=stats_metadata%irho_ds_zm, var_name="rho_ds_zm", &
     617             :              var_description="rho_ds_zm, Dry static, base-state density", var_units="kg m^{-3}", &
     618           0 :              l_silhs=.false., grid_kind=stats_zm )
     619           0 :         k = k + 1
     620             :       case ('thv_ds_zm')
     621           0 :         stats_metadata%ithv_ds_zm = k
     622             :         call stat_assign( var_index=stats_metadata%ithv_ds_zm, var_name="thv_ds_zm", &
     623             :              var_description="thv_ds_zm, Dry, base-state theta_v", var_units="K", l_silhs=.false.,&
     624           0 :              grid_kind=stats_zm )
     625           0 :         k = k + 1
     626             :       case ('em')
     627           0 :         stats_metadata%iem = k
     628             :         call stat_assign( var_index=stats_metadata%iem, var_name="em", &
     629             :              var_description="em, Turbulent kinetic energy, usu. 0.5*(u'^2+v'^2+w'^2)", &
     630           0 :              var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
     631           0 :         k = k + 1
     632             :       case ('shear')      ! Brian
     633           0 :         stats_metadata%ishear = k
     634             :         call stat_assign( var_index=stats_metadata%ishear, var_name="shear", &
     635             :              var_description="shear, Wind shear production term", var_units="m^2/s^3", &
     636           0 :              l_silhs=.false., grid_kind=stats_zm )
     637           0 :         k = k + 1
     638             :       case ('mean_w_up')
     639           0 :         stats_metadata%imean_w_up = k
     640             :         call stat_assign( var_index=stats_metadata%imean_w_up, var_name="mean_w_up", &
     641             :              var_description="mean_w_up, Mean w >= w_ref", var_units="m/s", l_silhs=.false., &
     642           0 :              grid_kind=stats_zm )
     643           0 :         k = k + 1
     644             :       case ('mean_w_down')
     645           0 :         stats_metadata%imean_w_down = k
     646             :         call stat_assign( var_index=stats_metadata%imean_w_down, var_name="mean_w_down", &
     647             :              var_description="mean_w_down, Mean w <= w_ref", var_units="m/s", l_silhs=.false., &
     648           0 :              grid_kind=stats_zm )
     649           0 :         k = k + 1
     650             :       case ('Frad')
     651           0 :         stats_metadata%iFrad = k
     652             :         call stat_assign( var_index=stats_metadata%iFrad, var_name="Frad", &
     653             :              var_description="Frad, Total (sw+lw) net (up+down) radiative flux", &
     654           0 :              var_units="W/m^2", l_silhs=.false., grid_kind=stats_zm )
     655           0 :         k = k + 1
     656             :       case ('Frad_LW')    ! Brian
     657           0 :         stats_metadata%iFrad_LW = k
     658             :         call stat_assign( var_index=stats_metadata%iFrad_LW, var_name="Frad_LW", &
     659             :              var_description="Frad_LW, Net long-wave radiative flux", var_units="W/m^2", &
     660           0 :              l_silhs=.false., grid_kind=stats_zm )
     661           0 :         k = k + 1
     662             :       case ('Frad_SW')    ! Brian
     663           0 :         stats_metadata%iFrad_SW = k
     664             : 
     665             :         call stat_assign( var_index=stats_metadata%iFrad_SW, var_name="Frad_SW", &
     666             :              var_description="Frad_SW, Net short-wave radiative flux", var_units="W/m^2", &
     667           0 :              l_silhs=.false., grid_kind=stats_zm )
     668           0 :         k = k + 1
     669             : 
     670             :       case ('Frad_LW_up')    ! Brian
     671           0 :         stats_metadata%iFrad_LW_up = k
     672             :         call stat_assign( var_index=stats_metadata%iFrad_LW_up, var_name="Frad_LW_up", &
     673             :              var_description="Frad_LW_up, Long-wave upwelling radiative flux", &
     674             :              var_units="W/m^2", &
     675           0 :              l_silhs=.false., grid_kind=stats_zm )
     676           0 :         k = k + 1
     677             :       case ('Frad_SW_up')    ! Brian
     678           0 :         stats_metadata%iFrad_SW_up = k
     679             : 
     680             :         call stat_assign( var_index=stats_metadata%iFrad_SW_up, var_name="Frad_SW_up", &
     681             :              var_description="Frad_SW_up, Short-wave upwelling radiative flux", &
     682             :              var_units="W/m^2", &
     683           0 :              l_silhs=.false., grid_kind=stats_zm )
     684           0 :         k = k + 1
     685             : 
     686             :       case ('Frad_LW_down')    ! Brian
     687           0 :         stats_metadata%iFrad_LW_down = k
     688             :         call stat_assign( var_index=stats_metadata%iFrad_LW_down, var_name="Frad_LW_down", &
     689             :              var_description="Frad_LW_down, Long-wave downwelling radiative flux", &
     690             :              var_units="W/m^2", &
     691           0 :              l_silhs=.false., grid_kind=stats_zm )
     692           0 :         k = k + 1
     693             :       case ('Frad_SW_down')    ! Brian
     694           0 :         stats_metadata%iFrad_SW_down = k
     695             : 
     696             :         call stat_assign( var_index=stats_metadata%iFrad_SW_down, var_name="Frad_SW_down", &
     697             :              var_description="Frad_SW_down, Short-wave downwelling radiative flux", &
     698             :              var_units="W/m^2", &
     699           0 :              l_silhs=.false., grid_kind=stats_zm )
     700           0 :         k = k + 1
     701             : 
     702             : 
     703             :       case ('Fprec')      ! Brian
     704           0 :         stats_metadata%iFprec = k
     705             : 
     706             :         call stat_assign( var_index=stats_metadata%iFprec, var_name="Fprec", &
     707             :              var_description="Fprec, Rain flux", var_units="W/m^2", l_silhs=.false., &
     708           0 :              grid_kind=stats_zm )
     709           0 :         k = k + 1
     710             : 
     711             :       case ('Fcsed')      ! Brian
     712           0 :         stats_metadata%iFcsed = k
     713             : 
     714             :         call stat_assign( var_index=stats_metadata%iFcsed, var_name="Fcsed", &
     715             :              var_description="Fcsed, cloud water sedimentation flux", &
     716           0 :              var_units="kg/(s*m^2)", l_silhs=.false., grid_kind=stats_zm )
     717           0 :         k = k + 1
     718             : 
     719             :       case('hydrometp2')
     720             : 
     721           0 :          do hm_idx = 1, hydromet_dim, 1
     722             : 
     723           0 :             hm_type = hydromet_list(hm_idx)
     724             : 
     725             :             ! The overall variance of the hydrometeor.
     726           0 :             stats_metadata%ihydrometp2(hm_idx) = k
     727             : 
     728           0 :             if ( l_mix_rat_hm(hm_idx) ) then
     729             : 
     730           0 :                call stat_assign( var_index=stats_metadata%ihydrometp2(hm_idx), &
     731             :                                  var_name=trim( hm_type(1:2) )//"p2", &
     732             :                                  var_description="<" &
     733             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     734             :                                  // "'^2> [(kg/kg)^2]", &
     735             :                                  var_units="(kg/kg)^2", &
     736           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     737             : 
     738             :             else ! Concentration
     739             : 
     740           0 :                call stat_assign( var_index=stats_metadata%ihydrometp2(hm_idx), &
     741             :                                  var_name=trim( hm_type(1:2) )//"p2", &
     742             :                                  var_description="<" &
     743             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     744             :                                  // "'^2> [(num/kg)^2]", &
     745             :                                  var_units="(num/kg)^2", &
     746           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     747             : 
     748             :             endif ! l_mix_rat_hm(hm_idx)
     749             : 
     750           0 :             k = k + 1
     751             : 
     752             :          enddo ! hm_idx = 1, hydromet_dim, 1
     753             : 
     754             :       case ('wphydrometp')
     755             : 
     756           0 :          do hm_idx = 1, hydromet_dim, 1
     757             : 
     758           0 :             hm_type = hydromet_list(hm_idx)
     759             : 
     760           0 :             stats_metadata%iwphydrometp(hm_idx) = k
     761             : 
     762           0 :             if ( l_mix_rat_hm(hm_idx) ) then
     763             : 
     764           0 :                call stat_assign( var_index=stats_metadata%iwphydrometp(hm_idx), &
     765             :                                  var_name="wp"//trim( hm_type(1:2) )//"p", &
     766             :                                  var_description="Covariance of w and " &
     767             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     768             :                                  // " [(m/s) kg/kg]", &
     769             :                                  var_units="(m/s) kg/kg", &
     770           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     771             : 
     772             :             else ! Concentration
     773             : 
     774           0 :                call stat_assign( var_index=stats_metadata%iwphydrometp(hm_idx), &
     775             :                                  var_name="wp"//trim( hm_type(1:2) )//"p", &
     776             :                                  var_description="Covariance of w and " &
     777             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     778             :                                  // " [(m/s) num/kg]", &
     779             :                                  var_units="(m/s) num/kg", &
     780           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     781             : 
     782             :             endif ! l_mix_rat_hm(hm_idx)
     783             : 
     784           0 :             k = k + 1
     785             : 
     786             :          enddo ! hm_idx = 1, hydromet_dim, 1
     787             : 
     788             :       case ('wpNcp')
     789           0 :         stats_metadata%iwpNcp = k
     790             : 
     791             :         call stat_assign( var_index=stats_metadata%iwpNcp, var_name="wpNcp", &
     792             :                           var_description="w'Nc', Covariance of w and " &
     793             :                                           // "N_c", &
     794             :                           var_units="(m/s) num/kg", &
     795           0 :                           l_silhs=.false., grid_kind=stats_zm )
     796           0 :         k = k + 1
     797             : 
     798             :       case ('rtphmp')
     799             : 
     800           0 :          do hm_idx = 1, hydromet_dim, 1
     801             : 
     802           0 :             hm_type = hydromet_list(hm_idx)
     803             : 
     804           0 :             stats_metadata%irtphmp(hm_idx) = k
     805             : 
     806           0 :             if ( l_mix_rat_hm(hm_idx) ) then
     807             : 
     808           0 :                call stat_assign( var_index=stats_metadata%irtphmp(hm_idx), &
     809             :                                  var_name="rtp"//trim( hm_type(1:2) )//"p", &
     810             :                                  var_description="Covariance of r_t and " &
     811             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     812             :                                  // " [kg^2/kg^2]", &
     813             :                                  var_units="kg^2/kg^2", &
     814           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     815             : 
     816             :             else ! Concentration
     817             : 
     818           0 :                call stat_assign( var_index=stats_metadata%irtphmp(hm_idx), &
     819             :                                  var_name="rtp"//trim( hm_type(1:2) )//"p", &
     820             :                                  var_description="Covariance of r_t and " &
     821             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     822             :                                  // " [(kg/kg) num/kg]", &
     823             :                                  var_units="(kg/kg) num/kg", &
     824           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     825             : 
     826             :             endif ! l_mix_rat_hm(hm_idx)
     827             : 
     828           0 :             k = k + 1
     829             : 
     830             :          enddo ! hm_idx = 1, hydromet_dim, 1
     831             : 
     832             :       case ('thlphmp')
     833             : 
     834           0 :          do hm_idx = 1, hydromet_dim, 1
     835             : 
     836           0 :             hm_type = hydromet_list(hm_idx)
     837             : 
     838           0 :             stats_metadata%ithlphmp(hm_idx) = k
     839             : 
     840           0 :             if ( l_mix_rat_hm(hm_idx) ) then
     841             : 
     842           0 :                call stat_assign( var_index=stats_metadata%ithlphmp(hm_idx), &
     843             :                                  var_name="thlp"//trim( hm_type(1:2) )//"p", &
     844             :                                  var_description="Covariance of th_l and " &
     845             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     846             :                                  // " [K kg/kg]", &
     847             :                                  var_units="K kg/kg", &
     848           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     849             : 
     850             :             else ! Concentration
     851             : 
     852           0 :                call stat_assign( var_index=stats_metadata%ithlphmp(hm_idx), &
     853             :                                  var_name="thlp"//trim( hm_type(1:2) )//"p", &
     854             :                                  var_description="Covariance of th_l and " &
     855             :                                  // hm_type(1:1)//"_"//trim( hm_type(2:2) ) &
     856             :                                  // " [K num/kg]", &
     857             :                                  var_units="K num/kg", &
     858           0 :                                  l_silhs=.false., grid_kind=stats_zm )
     859             : 
     860             :             endif ! l_mix_rat_hm(hm_idx)
     861             : 
     862           0 :             k = k + 1
     863             : 
     864             :          enddo ! hm_idx = 1, hydromet_dim, 1
     865             : 
     866             :       case ('hmxphmyp')
     867             : 
     868           0 :          do hmx_idx = 1, hydromet_dim, 1
     869             : 
     870           0 :             hmx_type = hydromet_list(hmx_idx)
     871             : 
     872           0 :             do hmy_idx = hmx_idx+1, hydromet_dim, 1
     873             : 
     874           0 :                hmy_type = hydromet_list(hmy_idx)
     875             : 
     876             :                ! The covariance (overall) of hmx and hmy.
     877           0 :                stats_metadata%ihmxphmyp(hmy_idx,hmx_idx) = k
     878             : 
     879           0 :                if ( l_mix_rat_hm(hmx_idx) .and. l_mix_rat_hm(hmy_idx) ) then
     880             : 
     881             :                   ! Both hydrometeors are mixing ratios.
     882           0 :                   call stat_assign( var_index=stats_metadata%ihmxphmyp(hmy_idx,hmx_idx), &
     883             :                                     var_name=trim( hmx_type(1:2) )//"p" &
     884             :                                     // trim( hmy_type(1:2) )//"p", &
     885             :                                     var_description="Covariance of " &
     886             :                                     // hmx_type(1:1)//"_"//trim(hmx_type(2:2)) &
     887             :                                     // " and " &
     888             :                                     // hmy_type(1:1)//"_"//trim(hmy_type(2:2)) &
     889             :                                     // " [(kg/kg)^2]", &
     890             :                                     var_units="(kg/kg)^2", l_silhs=.false., &
     891           0 :                                     grid_kind=stats_zm )
     892             : 
     893             :                elseif ( ( .not. l_mix_rat_hm(hmx_idx) ) &
     894           0 :                         .and. ( .not. l_mix_rat_hm(hmy_idx) ) ) then
     895             : 
     896             :                   ! Both hydrometeors are concentrations.
     897           0 :                   call stat_assign( var_index=stats_metadata%ihmxphmyp(hmy_idx,hmx_idx), &
     898             :                                     var_name=trim( hmx_type(1:2) )//"p" &
     899             :                                     // trim( hmy_type(1:2) )//"p", &
     900             :                                     var_description="Covariance of " &
     901             :                                     // hmx_type(1:1)//"_"//trim(hmx_type(2:2)) &
     902             :                                     // " and " &
     903             :                                     // hmy_type(1:1)//"_"//trim(hmy_type(2:2)) &
     904             :                                     // " [(num/kg)^2]", &
     905             :                                     var_units="(num/kg)^2", l_silhs=.false., &
     906           0 :                                     grid_kind=stats_zm )
     907             : 
     908             :                else
     909             : 
     910             :                   ! One hydrometeor is a mixing ratio and the other hydrometeor
     911             :                   ! is a concentration.
     912           0 :                   call stat_assign( var_index=stats_metadata%ihmxphmyp(hmy_idx,hmx_idx), &
     913             :                                     var_name=trim( hmx_type(1:2) )//"p" &
     914             :                                     // trim( hmy_type(1:2) )//"p", &
     915             :                                     var_description="Covariance of " &
     916             :                                     // hmx_type(1:1)//"_"//trim(hmx_type(2:2)) &
     917             :                                     // " and " &
     918             :                                     // hmy_type(1:1)//"_"//trim(hmy_type(2:2)) &
     919             :                                     // " [(kg/kg) num/kg]", &
     920             :                                     var_units="(kg/kg) num/kg", &
     921           0 :                                     l_silhs=.false., grid_kind=stats_zm )
     922             : 
     923             :                endif
     924             : 
     925           0 :                k = k + 1
     926             : 
     927             :             enddo ! hmy_idx = hmx_idx+1, hydromet_dim, 1
     928             : 
     929             :          enddo ! hmx_idx = 1, hydromet_dim, 1
     930             : 
     931             :       case ('VNr')
     932           0 :         stats_metadata%iVNr = k
     933             : 
     934             :         call stat_assign( var_index=stats_metadata%iVNr, var_name="VNr", &
     935             :              var_description="VNr, rrm concentration fallspeed", var_units="m/s", &
     936           0 :              l_silhs=.false., grid_kind=stats_zm )
     937           0 :         k = k + 1
     938             : 
     939             :       case ('Vrr')
     940           0 :         stats_metadata%iVrr = k
     941             : 
     942             :         call stat_assign( var_index=stats_metadata%iVrr, var_name="Vrr", &
     943             :              var_description="Vrr, rrm mixing ratio fallspeed", var_units="m/s", &
     944           0 :              l_silhs=.false., grid_kind=stats_zm )
     945           0 :         k = k + 1
     946             : 
     947             :       case ('VNc')
     948           0 :         stats_metadata%iVNc = k
     949             : 
     950             :         call stat_assign( var_index=stats_metadata%iVNc, var_name="VNc", &
     951             :              var_description="VNc, Nrm concentration fallspeed", var_units="m/s", &
     952           0 :              l_silhs=.false., grid_kind=stats_zm )
     953           0 :         k = k + 1
     954             : 
     955             :       case ('Vrc')
     956           0 :         stats_metadata%iVrc = k
     957             : 
     958             :         call stat_assign( var_index=stats_metadata%iVrc, var_name="Vrc", &
     959             :              var_description="Vrc, Nrm mixing ratio fallspeed", var_units="m/s", &
     960           0 :              l_silhs=.false., grid_kind=stats_zm )
     961           0 :         k = k + 1
     962             : 
     963             :       case ('VNs')
     964           0 :         stats_metadata%iVNs = k
     965             : 
     966             :         call stat_assign( var_index=stats_metadata%iVNs, var_name="VNs", &
     967             :              var_description="VNs, Snow concentration fallspeed", var_units="m/s", &
     968           0 :              l_silhs=.false., grid_kind=stats_zm )
     969           0 :         k = k + 1
     970             : 
     971             :       case ('Vrs')
     972           0 :         stats_metadata%iVrs = k
     973             : 
     974             :         call stat_assign( var_index=stats_metadata%iVrs, var_name="Vrs", &
     975             :              var_description="Vrs, Snow mixing ratio fallspeed", var_units="m/s", &
     976           0 :              l_silhs=.false., grid_kind=stats_zm )
     977           0 :         k = k + 1
     978             : 
     979             :       case ('Vrg')
     980           0 :         stats_metadata%iVrg = k
     981             : 
     982             :         call stat_assign( var_index=stats_metadata%iVrg, var_name="Vrg", &
     983             :              var_description="Vrg, Graupel sedimentation velocity", var_units="m/s", &
     984           0 :              l_silhs=.false., grid_kind=stats_zm )
     985           0 :         k = k + 1
     986             : 
     987             :       case ('VNi')
     988           0 :         stats_metadata%iVNi = k
     989             : 
     990             :         call stat_assign( var_index=stats_metadata%iVNi, var_name="VNi", &
     991             :              var_description="VNi, Cloud ice concentration fallspeed", var_units="m/s", &
     992           0 :              l_silhs=.false., grid_kind=stats_zm )
     993           0 :         k = k + 1
     994             : 
     995             :       case ('Vri')
     996           0 :         stats_metadata%iVri = k
     997             : 
     998             :         call stat_assign( var_index=stats_metadata%iVri, var_name="Vri", &
     999             :              var_description="Vri, Cloud ice mixing ratio fallspeed", var_units="m/s", &
    1000           0 :              l_silhs=.false., grid_kind=stats_zm )
    1001           0 :         k = k + 1
    1002             : 
    1003             :       case ('Vrrprrp')
    1004           0 :         stats_metadata%iVrrprrp = k
    1005             : 
    1006             :         call stat_assign( var_index=stats_metadata%iVrrprrp, var_name="Vrrprrp", &
    1007             :              var_description="Vrr'rr', Covariance of V_rr (r_r sed. vel.) and r_r", &
    1008           0 :              var_units="(m/s)(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
    1009           0 :         k = k + 1
    1010             : 
    1011             :       case ('VNrpNrp')
    1012           0 :         stats_metadata%iVNrpNrp = k
    1013             : 
    1014             :         call stat_assign( var_index=stats_metadata%iVNrpNrp, var_name="VNrpNrp", &
    1015             :              var_description="VNr'Nr', Covariance of V_Nr (N_r sed. vel.) and N_r", &
    1016           0 :              var_units="(m/s)(num/kg)", l_silhs=.false., grid_kind=stats_zm )
    1017           0 :         k = k + 1
    1018             : 
    1019             :       case ('Vrrprrp_expcalc')
    1020           0 :         stats_metadata%iVrrprrp_expcalc = k
    1021             : 
    1022             :         call stat_assign( var_index=stats_metadata%iVrrprrp_expcalc, var_name="Vrrprrp_expcalc", &
    1023             :              var_description="Vrr'rr'_expcalc, completely explicit calculation", &
    1024           0 :              var_units="(m/s)(kg/kg)", l_silhs=.false., grid_kind=stats_zm )
    1025           0 :         k = k + 1
    1026             : 
    1027             :       case ('VNrpNrp_expcalc')
    1028           0 :         stats_metadata%iVNrpNrp_expcalc = k
    1029             : 
    1030             :         call stat_assign( var_index=stats_metadata%iVNrpNrp_expcalc, var_name="VNrpNrp_expcalc", &
    1031             :              var_description="VNr'Nr'_expcalc, V_Nr'N_r' completely explicit calculation", &
    1032           0 :              var_units="(m/s)(num/kg)", l_silhs=.false., grid_kind=stats_zm )
    1033           0 :         k = k + 1
    1034             : 
    1035             :       case ('wp2_bt')
    1036           0 :         stats_metadata%iwp2_bt = k
    1037             : 
    1038             :         call stat_assign( var_index=stats_metadata%iwp2_bt, var_name="wp2_bt", &
    1039             :              var_description="w'^2_bt, wp2 budget: wp2 time tendency", var_units="m^2/s^3", &
    1040           0 :              l_silhs=.false., grid_kind=stats_zm )
    1041           0 :         k = k + 1
    1042             : 
    1043             :       case ('wp2_ma')
    1044           0 :         stats_metadata%iwp2_ma = k
    1045             : 
    1046             :         call stat_assign( var_index=stats_metadata%iwp2_ma, var_name="wp2_ma", &
    1047             :              var_description="w'^2_ma, wp2 budget: wp2 vertical mean advection", &
    1048           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1049           0 :         k = k + 1
    1050             : 
    1051             :       case ('wp2_ta')
    1052           0 :         stats_metadata%iwp2_ta = k
    1053             : 
    1054             :         call stat_assign( var_index=stats_metadata%iwp2_ta, var_name="wp2_ta", &
    1055             :              var_description="w'^2_ta, wp2 budget: wp2 turbulent advection", &
    1056           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1057           0 :         k = k + 1
    1058             : 
    1059             :       case ('wp2_ac')
    1060           0 :         stats_metadata%iwp2_ac = k
    1061             : 
    1062             :         call stat_assign( var_index=stats_metadata%iwp2_ac, var_name="wp2_ac", &
    1063             :              var_description="w'^2_ac, wp2 budget: wp2 accumulation term", var_units="m^2/s^3", &
    1064           0 :              l_silhs=.false., grid_kind=stats_zm )
    1065           0 :         k = k + 1
    1066             : 
    1067             :       case ('wp2_bp')
    1068           0 :         stats_metadata%iwp2_bp = k
    1069             : 
    1070             :         call stat_assign( var_index=stats_metadata%iwp2_bp, var_name="wp2_bp", &
    1071             :              var_description="w'^2_bp, wp2 budget: wp2 buoyancy production", &
    1072           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1073           0 :         k = k + 1
    1074             : 
    1075             :       case ('wp2_pr1')
    1076           0 :         stats_metadata%iwp2_pr1 = k
    1077             : 
    1078             :         call stat_assign( var_index=stats_metadata%iwp2_pr1, var_name="wp2_pr1", &
    1079             :              var_description="w'^2_pr1, wp2 budget: wp2 pressure term 1", var_units="m^2/s^3", &
    1080           0 :              l_silhs=.false., grid_kind=stats_zm )
    1081           0 :         k = k + 1
    1082             : 
    1083             :       case ('wp2_pr2')
    1084           0 :         stats_metadata%iwp2_pr2 = k
    1085             :         call stat_assign( var_index=stats_metadata%iwp2_pr2, var_name="wp2_pr2", &
    1086             :              var_description="w'^2_pr2, wp2 budget: wp2 pressure term 2", var_units="m^2/s^3", &
    1087           0 :              l_silhs=.false., grid_kind=stats_zm )
    1088           0 :         k = k + 1
    1089             : 
    1090             :       case ('wp2_pr3')
    1091           0 :         stats_metadata%iwp2_pr3 = k
    1092             :         call stat_assign( var_index=stats_metadata%iwp2_pr3, var_name="wp2_pr3", &
    1093             :              var_description="w'^2_pr3, wp2 budget: wp2 pressure term 3", var_units="m^2/s^3", &
    1094           0 :              l_silhs=.false., grid_kind=stats_zm )
    1095             : 
    1096           0 :         k = k + 1
    1097             : 
    1098             :       case ('wp2_pr_dfsn')
    1099           0 :         stats_metadata%iwp2_pr_dfsn = k
    1100             :         call stat_assign( var_index=stats_metadata%iwp2_pr_dfsn, var_name="wp2_pr_dfsn", &
    1101             :              var_description="w'^2_pr_dfsn, wp2 budget: wp2 pressure diffusion term", &
    1102             :               var_units="m^2/s^3", &
    1103           0 :              l_silhs=.false., grid_kind=stats_zm )
    1104             : 
    1105           0 :         k = k + 1
    1106             : 
    1107             :       case ('wp2_dp1')
    1108           0 :         stats_metadata%iwp2_dp1 = k
    1109             :         call stat_assign( var_index=stats_metadata%iwp2_dp1, var_name="wp2_dp1", &
    1110             :              var_description="w'^2_dp1, wp2 budget: wp2 dissipation term 1", &
    1111             :              var_units="m^2/s^3", &
    1112           0 :              l_silhs=.false., grid_kind=stats_zm )
    1113           0 :         k = k + 1
    1114             : 
    1115             :       case ('wp2_dp2')
    1116           0 :         stats_metadata%iwp2_dp2 = k
    1117             :         call stat_assign( var_index=stats_metadata%iwp2_dp2, var_name="wp2_dp2", &
    1118             :              var_description="w'^2_d'^2, wp2 budget: wp2 dissipation term 2", &
    1119             :              var_units="m^2/s^3", &
    1120           0 :              l_silhs=.false., grid_kind=stats_zm )
    1121             : 
    1122           0 :         k = k + 1
    1123             : 
    1124             :       case ('wp2_sdmp')
    1125           0 :         stats_metadata%iwp2_sdmp = k
    1126             :         call stat_assign( var_index=stats_metadata%iwp2_sdmp, var_name="wp2_sdmp", &
    1127             :              var_description="w'^2_sdmp, wp2 budget: wp2 sponge damping term", &
    1128             :              var_units="m^2/s^3", &
    1129           0 :              l_silhs=.false., grid_kind=stats_zm )
    1130           0 :         k = k + 1
    1131             : 
    1132             :       case ('wp2_cl')
    1133           0 :         stats_metadata%iwp2_cl = k
    1134             : 
    1135             :         call stat_assign( var_index=stats_metadata%iwp2_cl, var_name="wp2_cl", &
    1136             :              var_description="w'^2_cl, wp2 budget: wp2 clipping term", var_units="m^2/s^3", &
    1137           0 :              l_silhs=.false., grid_kind=stats_zm )
    1138             : 
    1139           0 :         k = k + 1
    1140             : 
    1141             :       case ('wp2_pd')
    1142           0 :         stats_metadata%iwp2_pd = k
    1143             : 
    1144             :         call stat_assign( var_index=stats_metadata%iwp2_pd, var_name="wp2_pd", &
    1145             :              var_description="w'^2_pd, wp2 budget: wp2 positive definite adjustment", &
    1146           0 :              var_units="m2/s3", l_silhs=.false., grid_kind=stats_zm )
    1147             : 
    1148           0 :         k = k + 1
    1149             : 
    1150             :       case ('wp2_sf')
    1151           0 :         stats_metadata%iwp2_sf = k
    1152             : 
    1153             :         call stat_assign( var_index=stats_metadata%iwp2_sf, var_name="wp2_sf", &
    1154             :              var_description="w'^2_sf, wp2 budget: wp2 surface variance", var_units="m2/s3", &
    1155           0 :              l_silhs=.false., grid_kind=stats_zm )
    1156             : 
    1157           0 :         k = k + 1
    1158             : 
    1159             :       case ('wp2_splat')
    1160           0 :         stats_metadata%iwp2_splat = k
    1161             : 
    1162             :         call stat_assign( var_index=stats_metadata%iwp2_splat, var_name="wp2_splat", &
    1163             :              var_description="w'^2_splat, wp2 budget: wp2 splatting", &
    1164           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1165             : 
    1166           0 :         k = k + 1
    1167             : 
    1168             :       case ('wprtp_bt')
    1169           0 :         stats_metadata%iwprtp_bt = k
    1170             :         call stat_assign( var_index=stats_metadata%iwprtp_bt, var_name="wprtp_bt", &
    1171             :              var_description="w'rt'_bt, wprtp budget: wprtp time tendency", &
    1172           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1173           0 :         k = k + 1
    1174             : 
    1175             :       case ('wprtp_ma')
    1176           0 :         stats_metadata%iwprtp_ma = k
    1177             : 
    1178             :         call stat_assign( var_index=stats_metadata%iwprtp_ma, var_name="wprtp_ma", &
    1179             :              var_description="w'rt'_ma, wprtp budget: wprtp mean advection", &
    1180           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1181           0 :         k = k + 1
    1182             : 
    1183             :       case ('wprtp_ta')
    1184           0 :         stats_metadata%iwprtp_ta = k
    1185             : 
    1186             :         call stat_assign( var_index=stats_metadata%iwprtp_ta, var_name="wprtp_ta", &
    1187             :              var_description="w'rt'_ta, wprtp budget: wprtp turbulent advection", &
    1188           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1189           0 :         k = k + 1
    1190             : 
    1191             :       case ('wprtp_tp')
    1192           0 :         stats_metadata%iwprtp_tp = k
    1193             : 
    1194             :         call stat_assign( var_index=stats_metadata%iwprtp_tp, var_name="wprtp_tp", &
    1195             :              var_description="w'rt'_t', wprtp budget: wprtp turbulent production", &
    1196           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1197           0 :         k = k + 1
    1198             : 
    1199             :       case ('wprtp_ac')
    1200           0 :         stats_metadata%iwprtp_ac = k
    1201             : 
    1202             :         call stat_assign( var_index=stats_metadata%iwprtp_ac, var_name="wprtp_ac", &
    1203             :              var_description="w'rt'_ac, wprtp budget: wprtp accumulation term", &
    1204           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1205           0 :         k = k + 1
    1206             : 
    1207             :       case ('wprtp_bp')
    1208           0 :         stats_metadata%iwprtp_bp = k
    1209             : 
    1210             :         call stat_assign( var_index=stats_metadata%iwprtp_bp, var_name="wprtp_bp", &
    1211             :              var_description="w'rt'_b', wprtp budget: wprtp buoyancy production", &
    1212           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1213           0 :         k = k + 1
    1214             : 
    1215             :       case ('wprtp_pr1')
    1216           0 :         stats_metadata%iwprtp_pr1 = k
    1217             : 
    1218             :         call stat_assign( var_index=stats_metadata%iwprtp_pr1, var_name="wprtp_pr1", &
    1219             :              var_description="w'rt'_pr1, wprtp budget: wprtp pressure term 1", &
    1220           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1221           0 :         k = k + 1
    1222             : 
    1223             :       case ('wprtp_pr2')
    1224           0 :         stats_metadata%iwprtp_pr2 = k
    1225             : 
    1226             :         call stat_assign( var_index=stats_metadata%iwprtp_pr2, var_name="wprtp_pr2", &
    1227             :              var_description="w'rt'_pr2, wprtp budget: wprtp pressure term 2", &
    1228           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1229           0 :         k = k + 1
    1230             : 
    1231             :       case ('wprtp_pr3')
    1232           0 :         stats_metadata%iwprtp_pr3 = k
    1233             : 
    1234             :         call stat_assign( var_index=stats_metadata%iwprtp_pr3, var_name="wprtp_pr3", &
    1235             :              var_description="w'rt'_pr3, wprtp budget: wprtp pressure term 3", &
    1236           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1237           0 :         k = k + 1
    1238             : 
    1239             :       case ('wprtp_dp1')
    1240           0 :         stats_metadata%iwprtp_dp1 = k
    1241             : 
    1242             :         call stat_assign( var_index=stats_metadata%iwprtp_dp1, var_name="wprtp_dp1", &
    1243             :              var_description="w'rt'_dp1, wprtp budget: wprtp dissipation term 1", &
    1244           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1245           0 :         k = k + 1
    1246             : 
    1247             :       case ('wprtp_mfl')
    1248           0 :         stats_metadata%iwprtp_mfl = k
    1249             : 
    1250             :         call stat_assign( var_index=stats_metadata%iwprtp_mfl, var_name="wprtp_mfl", &
    1251             :              var_description="w'rt'_mfl, wprtp budget: wprtp monotonic flux limiter", &
    1252           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1253           0 :         k = k + 1
    1254             : 
    1255             :       case ('wprtp_cl')
    1256           0 :         stats_metadata%iwprtp_cl = k
    1257             : 
    1258             :         call stat_assign( var_index=stats_metadata%iwprtp_cl, var_name="wprtp_cl", &
    1259             :              var_description="w'rt'_cl, wprtp budget: wprtp clipping term", &
    1260           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1261           0 :         k = k + 1
    1262             : 
    1263             :       case ('wprtp_sicl')
    1264           0 :         stats_metadata%iwprtp_sicl = k
    1265             : 
    1266             :         call stat_assign( var_index=stats_metadata%iwprtp_sicl, var_name="wprtp_sicl", &
    1267             :              var_description="w'rt'_sicl, wprtp budget: wprtp semi-implicit clipping term", &
    1268           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1269           0 :         k = k + 1
    1270             : 
    1271             :       case ('wprtp_pd')
    1272           0 :         stats_metadata%iwprtp_pd = k
    1273             : 
    1274             :         call stat_assign( var_index=stats_metadata%iwprtp_pd, var_name="wprtp_pd", &
    1275             :              var_description="w'rt'_pd, wprtp budget: wprtp flux corrected trans. term", &
    1276           0 :              var_units="(m kg)/(s^2 kg)", l_silhs=.false., grid_kind=stats_zm )
    1277           0 :         k = k + 1
    1278             : 
    1279             :       case ('wprtp_forcing')
    1280           0 :         stats_metadata%iwprtp_forcing = k
    1281             : 
    1282             :         call stat_assign( var_index=stats_metadata%iwprtp_forcing, var_name="wprtp_forcing", &
    1283             :              var_description="w'rt'_forcing, wprtp budget: wprtp forcing " &
    1284             :              // "(includes microphysics tendency)", &
    1285           0 :              var_units="(m kg/kg)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1286           0 :         k = k + 1
    1287             : 
    1288             :       case ('wprtp_mc')
    1289           0 :         stats_metadata%iwprtp_mc = k
    1290             : 
    1291             :         call stat_assign( var_index=stats_metadata%iwprtp_mc, var_name="wprtp_mc", &
    1292             :              var_description="w'rt'_mc, Microphysics tendency for wprtp (not in budget)", &
    1293           0 :              var_units="(m kg/kg)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1294           0 :         k = k + 1
    1295             : 
    1296             :       case ('wpthlp_bt')
    1297           0 :         stats_metadata%iwpthlp_bt = k
    1298             : 
    1299             :         call stat_assign( var_index=stats_metadata%iwpthlp_bt, var_name="wpthlp_bt", &
    1300             :              var_description="w'thl'_bt, wpthlp budget", var_units="(m K)/s^2", &
    1301           0 :              l_silhs=.false., grid_kind=stats_zm )
    1302           0 :         k = k + 1
    1303             : 
    1304             :       case ('wpthlp_ma')
    1305           0 :         stats_metadata%iwpthlp_ma = k
    1306             :         call stat_assign( var_index=stats_metadata%iwpthlp_ma, var_name="wpthlp_ma", &
    1307             :              var_description="w'thl'_ma, wpthlp budget: wpthlp mean advection", &
    1308           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1309             : 
    1310           0 :         k = k + 1
    1311             : 
    1312             :       case ('wpthlp_ta')
    1313           0 :         stats_metadata%iwpthlp_ta = k
    1314             :         call stat_assign( var_index=stats_metadata%iwpthlp_ta, var_name="wpthlp_ta", &
    1315             :              var_description="w'thl'_ta, wpthlp budget: wpthlp turbulent advection", &
    1316           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1317             : 
    1318           0 :         k = k + 1
    1319             : 
    1320             :       case ('wpthlp_tp')
    1321           0 :         stats_metadata%iwpthlp_tp = k
    1322             :         call stat_assign( var_index=stats_metadata%iwpthlp_tp, var_name="wpthlp_tp", &
    1323             :              var_description="w'thl'_tp, wpthlp budget: wpthlp turbulent production", &
    1324           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1325             : 
    1326           0 :         k = k + 1
    1327             : 
    1328             :       case ('wpthlp_ac')
    1329           0 :         stats_metadata%iwpthlp_ac = k
    1330             :         call stat_assign( var_index=stats_metadata%iwpthlp_ac, var_name="wpthlp_ac", &
    1331             :              var_description="w'thl'_ac, wpthlp budget: wpthlp accumulation term", &
    1332           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1333             : 
    1334           0 :         k = k + 1
    1335             : 
    1336             :       case ('wpthlp_bp')
    1337           0 :         stats_metadata%iwpthlp_bp = k
    1338             :         call stat_assign( var_index=stats_metadata%iwpthlp_bp, var_name="wpthlp_bp", &
    1339             :              var_description="w'thl'_b', wpthlp budget: wpthlp buoyancy production", &
    1340           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1341           0 :         k = k + 1
    1342             : 
    1343             :       case ('wpthlp_pr1')
    1344           0 :         stats_metadata%iwpthlp_pr1 = k
    1345             : 
    1346             :         call stat_assign( var_index=stats_metadata%iwpthlp_pr1, var_name="wpthlp_pr1", &
    1347             :              var_description="w'thl'_pr1, wpthlp budget: wpthlp pressure term 1", &
    1348           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1349           0 :         k = k + 1
    1350             : 
    1351             :       case ('wpthlp_pr2')
    1352           0 :         stats_metadata%iwpthlp_pr2 = k
    1353             : 
    1354             :         call stat_assign( var_index=stats_metadata%iwpthlp_pr2, var_name="wpthlp_pr2", &
    1355             :              var_description="w'thl'_pr2, wpthlp budget: wpthlp pressure term 2", &
    1356           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1357           0 :         k = k + 1
    1358             : 
    1359             :       case ('wpthlp_pr3')
    1360           0 :         stats_metadata%iwpthlp_pr3 = k
    1361             :         call stat_assign( var_index=stats_metadata%iwpthlp_pr3, var_name="wpthlp_pr3", &
    1362             :              var_description="w'thl'_pr3, wpthlp budget: wpthlp pressure term 3", &
    1363           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1364           0 :         k = k + 1
    1365             : 
    1366             :       case ('wpthlp_dp1')
    1367           0 :         stats_metadata%iwpthlp_dp1 = k
    1368             :         call stat_assign( var_index=stats_metadata%iwpthlp_dp1, var_name="wpthlp_dp1", &
    1369             :              var_description="w'thl'_dp1, wpthlp budget: wpthlp dissipation term 1", &
    1370           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1371           0 :         k = k + 1
    1372             : 
    1373             :       case ('wpthlp_mfl')
    1374           0 :         stats_metadata%iwpthlp_mfl = k
    1375             :         call stat_assign( var_index=stats_metadata%iwpthlp_mfl, var_name="wpthlp_mfl", &
    1376             :              var_description="w'thl'_mfl, wpthlp budget: wpthlp monotonic flux limiter", &
    1377           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1378           0 :         k = k + 1
    1379             : 
    1380             :       case ('wpthlp_cl')
    1381           0 :         stats_metadata%iwpthlp_cl = k
    1382             :         call stat_assign( var_index=stats_metadata%iwpthlp_cl, var_name="wpthlp_cl", &
    1383             :              var_description="w'thl'_cl, wpthlp budget: wpthlp clipping term", &
    1384           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1385           0 :         k = k + 1
    1386             : 
    1387             :       case ('wpthlp_sicl')
    1388           0 :         stats_metadata%iwpthlp_sicl = k
    1389             :         call stat_assign( var_index=stats_metadata%iwpthlp_sicl, var_name="wpthlp_sicl", &
    1390             :              var_description="w'thl'_sicl, wpthlp budget: wpthlp semi-implicit clipping term", &
    1391           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1392           0 :         k = k + 1
    1393             : 
    1394             :       case ('wpthlp_forcing')
    1395           0 :         stats_metadata%iwpthlp_forcing = k
    1396             : 
    1397             :         call stat_assign( var_index=stats_metadata%iwpthlp_forcing, var_name="wpthlp_forcing", &
    1398             :              var_description="w'thl'_forcing, wpthlp budget: wpthlp forcing " &
    1399             :              // "(includes microphysics tendency)", &
    1400           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1401           0 :         k = k + 1
    1402             : 
    1403             :       case ('wpthlp_mc')
    1404           0 :         stats_metadata%iwpthlp_mc = k
    1405             : 
    1406             :         call stat_assign( var_index=stats_metadata%iwpthlp_mc, var_name="wpthlp_mc", &
    1407             :              var_description="w'thl'_mc, Microphysics tendency for wpthlp (not in budget)", &
    1408           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    1409           0 :         k = k + 1
    1410             : 
    1411             :       case ('upwp_bt')
    1412           0 :         stats_metadata%iupwp_bt = k
    1413             :         call stat_assign( var_index=stats_metadata%iupwp_bt, var_name="upwp_bt", &
    1414             :              var_description="u'w'_bt, upwp budget: upwp time tendency", &
    1415           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1416           0 :         k = k + 1
    1417             : 
    1418             :       case ('upwp_ma')
    1419           0 :         stats_metadata%iupwp_ma = k
    1420             :         call stat_assign( var_index=stats_metadata%iupwp_ma, var_name="upwp_ma", &
    1421             :              var_description="u'w'_ma, upwp budget: upwp mean advection", &
    1422           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1423           0 :         k = k + 1
    1424             : 
    1425             :       case ('upwp_ta')
    1426           0 :         stats_metadata%iupwp_ta = k
    1427             :         call stat_assign( var_index=stats_metadata%iupwp_ta, var_name="upwp_ta", &
    1428             :              var_description="u'w'_ta, upwp budget: upwp turbulent advection", &
    1429           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1430           0 :         k = k + 1
    1431             : 
    1432             :       case ('upwp_tp')
    1433           0 :         stats_metadata%iupwp_tp = k
    1434             :         call stat_assign( var_index=stats_metadata%iupwp_tp, var_name="upwp_tp", &
    1435             :              var_description="u'w'_t', upwp budget: upwp turbulent production", &
    1436           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1437           0 :         k = k + 1
    1438             : 
    1439             :       case ('upwp_ac')
    1440           0 :         stats_metadata%iupwp_ac = k
    1441             :         call stat_assign( var_index=stats_metadata%iupwp_ac, var_name="upwp_ac", &
    1442             :              var_description="u'w'_ac, upwp budget: upwp accumulation term", &
    1443           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1444           0 :         k = k + 1
    1445             : 
    1446             :       case ('upwp_bp')
    1447           0 :         stats_metadata%iupwp_bp = k
    1448             :         call stat_assign( var_index=stats_metadata%iupwp_bp, var_name="upwp_bp", &
    1449             :              var_description="u'w'_b', upwp budget: upwp buoyancy production", &
    1450           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1451           0 :         k = k + 1
    1452             : 
    1453             :       case ('upwp_pr1')
    1454           0 :         stats_metadata%iupwp_pr1 = k
    1455             :         call stat_assign( var_index=stats_metadata%iupwp_pr1, var_name="upwp_pr1", &
    1456             :              var_description="u'w'_pr1, upwp budget: upwp pressure term 1", &
    1457           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1458           0 :         k = k + 1
    1459             : 
    1460             :       case ('upwp_pr2')
    1461           0 :         stats_metadata%iupwp_pr2 = k
    1462             :         call stat_assign( var_index=stats_metadata%iupwp_pr2, var_name="upwp_pr2", &
    1463             :              var_description="u'w'_pr2, upwp budget: upwp pressure term 2", &
    1464           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1465           0 :         k = k + 1
    1466             : 
    1467             :       case ('upwp_pr3')
    1468           0 :         stats_metadata%iupwp_pr3 = k
    1469             :         call stat_assign( var_index=stats_metadata%iupwp_pr3, var_name="upwp_pr3", &
    1470             :              var_description="u'w'_pr3, upwp budget: upwp pressure term 3", &
    1471           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1472           0 :         k = k + 1
    1473             : 
    1474             :       case ('upwp_pr4')
    1475           0 :         stats_metadata%iupwp_pr4 = k
    1476             :         call stat_assign( var_index=stats_metadata%iupwp_pr4, var_name="upwp_pr4", &
    1477             :              var_description="u'w'_pr4, upwp budget: upwp pressure term 4", &
    1478           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1479           0 :         k = k + 1
    1480             : 
    1481             :       case ('upwp_dp1')
    1482           0 :         stats_metadata%iupwp_dp1 = k
    1483             :         call stat_assign( var_index=stats_metadata%iupwp_dp1, var_name="upwp_dp1", &
    1484             :              var_description="u'w'_dp1, upwp budget: upwp dissipation term 1", &
    1485           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1486           0 :         k = k + 1
    1487             : 
    1488             :       case ('upwp_mfl')
    1489           0 :         stats_metadata%iupwp_mfl = k
    1490             :         call stat_assign( var_index=stats_metadata%iupwp_mfl, var_name="upwp_mfl", &
    1491             :              var_description="u'w'_mfl, upwp budget: upwp monotonic flux limiter", &
    1492           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1493           0 :         k = k + 1
    1494             : 
    1495             :       case ('upwp_cl')
    1496           0 :         stats_metadata%iupwp_cl = k
    1497             :         call stat_assign( var_index=stats_metadata%iupwp_cl, var_name="upwp_cl", &
    1498             :              var_description="u'w'_cl, upwp budget: upwp clipping term", &
    1499           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1500           0 :         k = k + 1
    1501             : 
    1502             :       case ('vpwp_bt')
    1503           0 :         stats_metadata%ivpwp_bt = k
    1504             :         call stat_assign( var_index=stats_metadata%ivpwp_bt, var_name="vpwp_bt", &
    1505             :              var_description="v'w'_bt, vpwp budget: vpwp time tendency", &
    1506           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1507           0 :         k = k + 1
    1508             : 
    1509             :       case ('vpwp_ma')
    1510           0 :         stats_metadata%ivpwp_ma = k
    1511             :         call stat_assign( var_index=stats_metadata%ivpwp_ma, var_name="vpwp_ma", &
    1512             :              var_description="v'w'_ma, vpwp budget: vpwp mean advection", &
    1513           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1514           0 :         k = k + 1
    1515             : 
    1516             :       case ('vpwp_ta')
    1517           0 :         stats_metadata%ivpwp_ta = k
    1518             :         call stat_assign( var_index=stats_metadata%ivpwp_ta, var_name="vpwp_ta", &
    1519             :              var_description="v'w'_ta, vpwp budget: vpwp turbulent advection", &
    1520           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1521           0 :         k = k + 1
    1522             : 
    1523             :       case ('vpwp_tp')
    1524           0 :         stats_metadata%ivpwp_tp = k
    1525             :         call stat_assign( var_index=stats_metadata%ivpwp_tp, var_name="vpwp_tp", &
    1526             :              var_description="v'w'_t', vpwp budget: vpwp turbulent production", &
    1527           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1528           0 :         k = k + 1
    1529             : 
    1530             :       case ('vpwp_ac')
    1531           0 :         stats_metadata%ivpwp_ac = k
    1532             :         call stat_assign( var_index=stats_metadata%ivpwp_ac, var_name="vpwp_ac", &
    1533             :              var_description="v'w'_ac, vpwp budget: vpwp accumulation term", &
    1534           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1535           0 :         k = k + 1
    1536             : 
    1537             :       case ('vpwp_bp')
    1538           0 :         stats_metadata%ivpwp_bp = k
    1539             :         call stat_assign( var_index=stats_metadata%ivpwp_bp, var_name="vpwp_bp", &
    1540             :              var_description="v'w'_b', vpwp budget: vpwp buoyancy production", &
    1541           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1542           0 :         k = k + 1
    1543             : 
    1544             :       case ('vpwp_pr1')
    1545           0 :         stats_metadata%ivpwp_pr1 = k
    1546             :         call stat_assign( var_index=stats_metadata%ivpwp_pr1, var_name="vpwp_pr1", &
    1547             :              var_description="v'w'_pr1, vpwp budget: vpwp pressure term 1", &
    1548           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1549           0 :         k = k + 1
    1550             : 
    1551             :       case ('vpwp_pr2')
    1552           0 :         stats_metadata%ivpwp_pr2 = k
    1553             :         call stat_assign( var_index=stats_metadata%ivpwp_pr2, var_name="vpwp_pr2", &
    1554             :              var_description="v'w'_pr2, vpwp budget: vpwp pressure term 2", &
    1555           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1556           0 :         k = k + 1
    1557             : 
    1558             :       case ('vpwp_pr3')
    1559           0 :         stats_metadata%ivpwp_pr3 = k
    1560             :         call stat_assign( var_index=stats_metadata%ivpwp_pr3, var_name="vpwp_pr3", &
    1561             :              var_description="v'w'_pr3, vpwp budget: vpwp pressure term 3", &
    1562           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1563           0 :         k = k + 1
    1564             : 
    1565             :       case ('vpwp_pr4')
    1566           0 :         stats_metadata%ivpwp_pr4 = k
    1567             :         call stat_assign( var_index=stats_metadata%ivpwp_pr4, var_name="vpwp_pr4", &
    1568             :              var_description="v'w'_pr4, vpwp budget: vpwp pressure term 4", &
    1569           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1570           0 :         k = k + 1
    1571             : 
    1572             :       case ('vpwp_dp1')
    1573           0 :         stats_metadata%ivpwp_dp1 = k
    1574             :         call stat_assign( var_index=stats_metadata%ivpwp_dp1, var_name="vpwp_dp1", &
    1575             :              var_description="v'w'_dp1, vpwp budget: vpwp dissipation term 1", &
    1576           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1577           0 :         k = k + 1
    1578             : 
    1579             :       case ('vpwp_mfl')
    1580           0 :         stats_metadata%ivpwp_mfl = k
    1581             :         call stat_assign( var_index=stats_metadata%ivpwp_mfl, var_name="vpwp_mfl", &
    1582             :              var_description="v'w'_mfl, vpwp budget: vpwp monotonic flux limiter", &
    1583           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1584           0 :         k = k + 1
    1585             : 
    1586             :       case ('vpwp_cl')
    1587           0 :         stats_metadata%ivpwp_cl = k
    1588             :         call stat_assign( var_index=stats_metadata%ivpwp_cl, var_name="vpwp_cl", &
    1589             :              var_description="v'w'_cl, vpwp budget: vpwp clipping term", &
    1590           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1591           0 :         k = k + 1
    1592             : 
    1593             :         ! Variance budgets
    1594             :       case ('rtp2_bt')
    1595           0 :         stats_metadata%irtp2_bt = k
    1596             :         call stat_assign( var_index=stats_metadata%irtp2_bt, var_name="rtp2_bt", &
    1597             :              var_description="rt'^2_bt, rt'2 budget: rtp2 time tendency", &
    1598           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1599           0 :         k = k + 1
    1600             :       case ('rtp2_ma')
    1601           0 :         stats_metadata%irtp2_ma = k
    1602             :         call stat_assign( var_index=stats_metadata%irtp2_ma, var_name="rtp2_ma", &
    1603             :              var_description="rt'^2_ma, rtp2 budget: rtp2 mean advection", &
    1604           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1605           0 :         k = k + 1
    1606             :       case ('rtp2_ta')
    1607           0 :         stats_metadata%irtp2_ta = k
    1608             :         call stat_assign( var_index=stats_metadata%irtp2_ta, var_name="rtp2_ta", &
    1609             :              var_description="rt'^2_ta, rtp2 budget: rtp2 turbulent advection", &
    1610           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1611           0 :         k = k + 1
    1612             :       case ('rtp2_tp')
    1613           0 :         stats_metadata%irtp2_tp = k
    1614             :         call stat_assign( var_index=stats_metadata%irtp2_tp, var_name="rtp2_tp", &
    1615             :              var_description="rt'^2_tp, rtp2 budget: rtp2 turbulent production", &
    1616           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1617           0 :         k = k + 1
    1618             :       case ('rtp2_dp1')
    1619           0 :         stats_metadata%irtp2_dp1 = k
    1620             :         call stat_assign( var_index=stats_metadata%irtp2_dp1, var_name="rtp2_dp1", &
    1621             :              var_description="rt'^2_dp1, rtp2 budget: rtp2 dissipation term 1", &
    1622           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1623           0 :         k = k + 1
    1624             :       case ('rtp2_dp2')
    1625           0 :         stats_metadata%irtp2_dp2 = k
    1626             :         call stat_assign( var_index=stats_metadata%irtp2_dp2, var_name="rtp2_dp2", &
    1627             :              var_description="rt'^2_dp2, rtp2 budget: rtp2 dissipation term 2", &
    1628           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1629           0 :         k = k + 1
    1630             :       case ('rtp2_cl')
    1631           0 :         stats_metadata%irtp2_cl = k
    1632             :         call stat_assign( var_index=stats_metadata%irtp2_cl, var_name="rtp2_cl", &
    1633             :              var_description="rt'^2_cl, rtp2 budget: rtp2 clipping term", &
    1634           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1635           0 :         k = k + 1
    1636             : 
    1637             :       case ('rtp2_pd')
    1638           0 :         stats_metadata%irtp2_pd = k
    1639             :         call stat_assign( var_index=stats_metadata%irtp2_pd, var_name="rtp2_pd", &
    1640             :              var_description="rt'^2_pd, rtp2 budget: rtp2 positive definite adjustment", &
    1641           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1642           0 :         k = k + 1
    1643             : 
    1644             :       case ('rtp2_sf')
    1645           0 :         stats_metadata%irtp2_sf = k
    1646             :         call stat_assign( var_index=stats_metadata%irtp2_sf, var_name="rtp2_sf", &
    1647             :              var_description="rt'^2_sf, rtp2 budget: rtp2 surface variance", &
    1648           0 :              var_units="(kg^2)/(kg^2 s)", l_silhs=.false., grid_kind=stats_zm )
    1649           0 :         k = k + 1
    1650             : 
    1651             :       case ('rtp2_forcing')
    1652           0 :         stats_metadata%irtp2_forcing = k
    1653             : 
    1654             :         call stat_assign( var_index=stats_metadata%irtp2_forcing, var_name="rtp2_forcing", &
    1655             :              var_description="rt'^2_forcing, rtp2 budget: rtp2 forcing " &
    1656             :              // "(includes microphysics tendency)", &
    1657           0 :              var_units="(kg/kg)^2/s", l_silhs=.false., grid_kind=stats_zm )
    1658           0 :         k = k + 1
    1659             : 
    1660             :       case ('rtp2_mc')
    1661           0 :         stats_metadata%irtp2_mc = k
    1662             : 
    1663             :         call stat_assign( var_index=stats_metadata%irtp2_mc, var_name="rtp2_mc", &
    1664             :              var_description="rt'^2_mc, Microphysics tendency for rtp2 (not in budget)", &
    1665           0 :              var_units="(kg/kg)^2/s", l_silhs=.false., grid_kind=stats_zm )
    1666           0 :         k = k + 1
    1667             : 
    1668             :       case ('thlp2_bt')
    1669           0 :         stats_metadata%ithlp2_bt = k
    1670             :         call stat_assign( var_index=stats_metadata%ithlp2_bt, var_name="thlp2_bt", &
    1671             :              var_description="thl'^2_bt, thlp2 budget: thlp2 time tendency", &
    1672             :              var_units="(K^2)/s", &
    1673           0 :              l_silhs=.false., grid_kind=stats_zm )
    1674           0 :         k = k + 1
    1675             :       case ('thlp2_ma')
    1676           0 :         stats_metadata%ithlp2_ma = k
    1677             :         call stat_assign( var_index=stats_metadata%ithlp2_ma, var_name="thlp2_ma", &
    1678             :              var_description="thl'^2_ma, thlp2 budget: thlp2 mean advection", &
    1679             :              var_units="(K^2)/s", &
    1680           0 :              l_silhs=.false., grid_kind=stats_zm )
    1681           0 :         k = k + 1
    1682             :       case ('thlp2_ta')
    1683           0 :         stats_metadata%ithlp2_ta = k
    1684             :         call stat_assign( var_index=stats_metadata%ithlp2_ta, var_name="thlp2_ta", &
    1685             :              var_description="thl'^2_ta, thlp2 budget: thlp2 turbulent advection", &
    1686           0 :              var_units="(K^2)/s", l_silhs=.false., grid_kind=stats_zm )
    1687           0 :         k = k + 1
    1688             :       case ('thlp2_tp')
    1689           0 :         stats_metadata%ithlp2_tp = k
    1690             :         call stat_assign( var_index=stats_metadata%ithlp2_tp, var_name="thlp2_tp", &
    1691             :              var_description="thl'^2_t', thlp2 budget: thlp2 turbulent production", &
    1692           0 :              var_units="(K^2)/s", l_silhs=.false., grid_kind=stats_zm )
    1693           0 :         k = k + 1
    1694             :       case ('thlp2_dp1')
    1695           0 :         stats_metadata%ithlp2_dp1 = k
    1696             :         call stat_assign( var_index=stats_metadata%ithlp2_dp1, var_name="thlp2_dp1", &
    1697             :              var_description="thl'^2_dp1, thlp2 budget: thlp2 dissipation term 1", &
    1698           0 :              var_units="(K^2)/s", l_silhs=.false., grid_kind=stats_zm )
    1699           0 :         k = k + 1
    1700             :       case ('thlp2_dp2')
    1701           0 :         stats_metadata%ithlp2_dp2 = k
    1702             :         call stat_assign( var_index=stats_metadata%ithlp2_dp2, var_name="thlp2_dp2", &
    1703             :              var_description="thl'^2_dp2, thlp2 budget: thlp2 dissipation term 2", &
    1704           0 :              var_units="(K^2)/s", l_silhs=.false., grid_kind=stats_zm )
    1705           0 :         k = k + 1
    1706             :       case ('thlp2_cl')
    1707           0 :         stats_metadata%ithlp2_cl = k
    1708             :         call stat_assign( var_index=stats_metadata%ithlp2_cl, var_name="thlp2_cl", &
    1709             :              var_description="thl'^2_cl, thlp2 budget: thlp2 clipping term", &
    1710             :              var_units="(K^2)/s", &
    1711           0 :              l_silhs=.false., grid_kind=stats_zm )
    1712           0 :         k = k + 1
    1713             : 
    1714             :       case ('thlp2_pd')
    1715           0 :         stats_metadata%ithlp2_pd = k
    1716             :         call stat_assign( var_index=stats_metadata%ithlp2_pd, var_name="thlp2_pd", &
    1717             :              var_description="thl'^2_pd, thlp2 budget: thlp2 positive definite adjustment", &
    1718           0 :              var_units="K^2/s", l_silhs=.false., grid_kind=stats_zm )
    1719           0 :         k = k + 1
    1720             : 
    1721             :       case ('thlp2_sf')
    1722           0 :         stats_metadata%ithlp2_sf = k
    1723             :         call stat_assign( var_index=stats_metadata%ithlp2_sf, var_name="thlp2_sf", &
    1724             :              var_description="thl'^2_sf, thl'^2 budget: thlp2 surface variance", &
    1725             :              var_units="K^2/s", &
    1726           0 :              l_silhs=.false., grid_kind=stats_zm )
    1727           0 :         k = k + 1
    1728             :       case ('thlp2_forcing')
    1729           0 :         stats_metadata%ithlp2_forcing = k
    1730             :         call stat_assign( var_index=stats_metadata%ithlp2_forcing, var_name="thlp2_forcing", &
    1731             :              var_description="thlp2 budget: thlp2 forcing (includes microphysics tendency) &
    1732             :              &[K^2/s]", &
    1733           0 :              var_units="K^2/s", l_silhs=.false., grid_kind=stats_zm )
    1734           0 :         k = k + 1
    1735             :       case ('thlp2_mc')
    1736           0 :         stats_metadata%ithlp2_mc = k
    1737             :         call stat_assign( var_index=stats_metadata%ithlp2_mc, var_name="thlp2_mc", &
    1738             :              var_description="thl'^2_mc, Microphysics tendency for thlp2 (not in budget)", &
    1739           0 :              var_units="K^2/s", l_silhs=.false., grid_kind=stats_zm )
    1740           0 :         k = k + 1
    1741             : 
    1742             :       case ('rtpthlp_bt')
    1743           0 :         stats_metadata%irtpthlp_bt = k
    1744             :         call stat_assign( var_index=stats_metadata%irtpthlp_bt, var_name="rtpthlp_bt", &
    1745             :              var_description="rt'thl'_bt, rtpthlp budget: rtpthlp time tendency", &
    1746           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1747           0 :         k = k + 1
    1748             :       case ('rtpthlp_ma')
    1749           0 :         stats_metadata%irtpthlp_ma = k
    1750             :         call stat_assign( var_index=stats_metadata%irtpthlp_ma, var_name="rtpthlp_ma", &
    1751             :              var_description="rt'thl'_ma, rtpthlp budget: rtpthlp mean advection", &
    1752           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1753           0 :         k = k + 1
    1754             :       case ('rtpthlp_ta')
    1755           0 :         stats_metadata%irtpthlp_ta = k
    1756             :         call stat_assign( var_index=stats_metadata%irtpthlp_ta, var_name="rtpthlp_ta", &
    1757             :              var_description="rt'thl'_ta, rtpthlp budget: rtpthlp turbulent advection", &
    1758           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1759           0 :         k = k + 1
    1760             :       case ('rtpthlp_tp1')
    1761           0 :         stats_metadata%irtpthlp_tp1 = k
    1762             :         call stat_assign( var_index=stats_metadata%irtpthlp_tp1, var_name="rtpthlp_tp1", &
    1763             :              var_description="rt'thl'_tp1, rtpthlp budget: rtpthlp turbulent production 1", &
    1764           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1765           0 :         k = k + 1
    1766             :       case ('rtpthlp_tp2')
    1767           0 :         stats_metadata%irtpthlp_tp2 = k
    1768             :         call stat_assign( var_index=stats_metadata%irtpthlp_tp2, var_name="rtpthlp_tp2", &
    1769             :              var_description="rt'thl'_t'^2, rtpthlp budget: rtpthlp turbulent production 2", &
    1770           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1771           0 :         k = k + 1
    1772             :       case ('rtpthlp_dp1')
    1773           0 :         stats_metadata%irtpthlp_dp1 = k
    1774             :         call stat_assign( var_index=stats_metadata%irtpthlp_dp1, var_name="rtpthlp_dp1", &
    1775             :              var_description="rt'thl'_d'1, rtpthlp budget: rtpthlp dissipation term 1", &
    1776           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1777           0 :         k = k + 1
    1778             :       case ('rtpthlp_dp2')
    1779           0 :         stats_metadata%irtpthlp_dp2 = k
    1780             :         call stat_assign( var_index=stats_metadata%irtpthlp_dp2, var_name="rtpthlp_dp2", &
    1781             :              var_description="rt'thl'_dp2, rtpthlp budget: rtpthlp dissipation term 2", &
    1782           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1783           0 :         k = k + 1
    1784             :       case ('rtpthlp_cl')
    1785           0 :         stats_metadata%irtpthlp_cl = k
    1786             :         call stat_assign( var_index=stats_metadata%irtpthlp_cl, var_name="rtpthlp_cl", &
    1787             :              var_description="rt'thl'_cl, rtpthlp budget: rtpthlp clipping term", &
    1788           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1789           0 :         k = k + 1
    1790             :       case ('rtpthlp_sf')
    1791           0 :         stats_metadata%irtpthlp_sf = k
    1792             :         call stat_assign( var_index=stats_metadata%irtpthlp_sf, var_name="rtpthlp_sf", &
    1793             :              var_description="rt'thl'_sf, rtpthlp budget: rtpthlp surface variance", &
    1794           0 :              var_units="(kg K)/(kg s)", l_silhs=.false., grid_kind=stats_zm )
    1795           0 :         k = k + 1
    1796             :       case ('rtpthlp_forcing')
    1797           0 :         stats_metadata%irtpthlp_forcing = k
    1798             :         call stat_assign( var_index=stats_metadata%irtpthlp_forcing, var_name="rtpthlp_forcing", &
    1799             :              var_description="rt'thl'_forcing, rtpthlp budget: rtpthlp forcing "&
    1800             :              // "(includes microphysics tendency)", &
    1801           0 :              var_units="(K kg/kg)/s", l_silhs=.false., grid_kind=stats_zm )
    1802           0 :         k = k + 1
    1803             :       case ('rtpthlp_mc')
    1804           0 :         stats_metadata%irtpthlp_mc = k
    1805             :         call stat_assign( var_index=stats_metadata%irtpthlp_mc, var_name="rtpthlp_mc", &
    1806             :              var_description="rt'thl'_mc, Microphysics tendency for rtpthlp (not in budget)", &
    1807           0 :              var_units="(K kg/kg)/s", l_silhs=.false., grid_kind=stats_zm )
    1808           0 :         k = k + 1
    1809             : 
    1810             :       case ('up2')
    1811           0 :         stats_metadata%iup2 = k
    1812             :         call stat_assign( var_index=stats_metadata%iup2, var_name="up2", &
    1813             :              var_description="u'^2, Variance of eastward (u) wind", var_units="m^2/s^2", &
    1814           0 :              l_silhs=.false., grid_kind=stats_zm )
    1815           0 :         k = k + 1
    1816             : 
    1817             :       case ('vp2')
    1818           0 :         stats_metadata%ivp2 = k
    1819             :         call stat_assign( var_index=stats_metadata%ivp2, var_name="vp2", &
    1820             :              var_description="v'^2, Variance of northward (v) wind", var_units="m^2/s^2", &
    1821           0 :              l_silhs=.false., grid_kind=stats_zm )
    1822           0 :         k = k + 1
    1823             : 
    1824             :       case ('up2_bt')
    1825           0 :         stats_metadata%iup2_bt = k
    1826             :         call stat_assign( var_index=stats_metadata%iup2_bt, var_name="up2_bt", &
    1827             :              var_description="u'^2_bt, up2 budget: up2 time tendency", var_units="m^2/s^3", &
    1828           0 :              l_silhs=.false., grid_kind=stats_zm )
    1829           0 :         k = k + 1
    1830             : 
    1831             :       case ('up2_ma')
    1832           0 :         stats_metadata%iup2_ma = k
    1833             :         call stat_assign( var_index=stats_metadata%iup2_ma, var_name="up2_ma", &
    1834             :              var_description="u'^2_ma, up2 budget: up2 mean advection", var_units="m^2/s^3", &
    1835           0 :              l_silhs=.false., grid_kind=stats_zm )
    1836           0 :         k = k + 1
    1837             : 
    1838             :       case ('up2_ta')
    1839           0 :         stats_metadata%iup2_ta = k
    1840             :         call stat_assign( var_index=stats_metadata%iup2_ta, var_name="up2_ta", &
    1841             :              var_description="u'^2_ta, up2 budget: up2 turbulent advection", &
    1842           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1843           0 :         k = k + 1
    1844             : 
    1845             :       case ('up2_tp')
    1846           0 :         stats_metadata%iup2_tp = k
    1847             :         call stat_assign( var_index=stats_metadata%iup2_tp, var_name="up2_tp", &
    1848             :              var_description="u'^2_tp, up2 budget: up2 turbulent production", &
    1849           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1850           0 :         k = k + 1
    1851             : 
    1852             :       case ('up2_dp1')
    1853           0 :         stats_metadata%iup2_dp1 = k
    1854             :         call stat_assign( var_index=stats_metadata%iup2_dp1, var_name="up2_dp1", &
    1855             :              var_description="u'^2_dp1, up2 budget: up2 dissipation term 1", &
    1856             :              var_units="m^2/s^3", &
    1857           0 :              l_silhs=.false., grid_kind=stats_zm )
    1858           0 :         k = k + 1
    1859             : 
    1860             :       case ('up2_dp2')
    1861           0 :         stats_metadata%iup2_dp2 = k
    1862             :         call stat_assign( var_index=stats_metadata%iup2_dp2, var_name="up2_dp2", &
    1863             :              var_description="u'^2_d'^2, up2 budget: up2 dissipation term 2", &
    1864             :              var_units="m^2/s^3", &
    1865           0 :              l_silhs=.false., grid_kind=stats_zm )
    1866           0 :         k = k + 1
    1867             : 
    1868             :       case ('up2_pr1')
    1869           0 :         stats_metadata%iup2_pr1 = k
    1870             :         call stat_assign( var_index=stats_metadata%iup2_pr1, var_name="up2_pr1", &
    1871             :              var_description="u'^2_pr1, up2 budget: up2 pressure term 1", var_units="m^2/s^3", &
    1872           0 :              l_silhs=.false., grid_kind=stats_zm )
    1873           0 :         k = k + 1
    1874             : 
    1875             :       case ('up2_pr2')
    1876           0 :         stats_metadata%iup2_pr2 = k
    1877             :         call stat_assign( var_index=stats_metadata%iup2_pr2, var_name="up2_pr2", &
    1878             :              var_description="u'^2_pr2, up2 budget: up2 pressure term 2", var_units="m^2/s^3", &
    1879           0 :              l_silhs=.false., grid_kind=stats_zm )
    1880           0 :         k = k + 1
    1881             : 
    1882             :       case ('up2_sdmp')
    1883           0 :         stats_metadata%iup2_sdmp = k
    1884             :         call stat_assign( var_index=stats_metadata%iup2_sdmp, var_name="up2_sdmp", &
    1885             :              var_description="u'^2_sdmp, up2 budget: up2 sponge damping term", &
    1886             :              var_units="m^2/s^3", &
    1887           0 :              l_silhs=.false., grid_kind=stats_zm )
    1888           0 :         k = k + 1
    1889             : 
    1890             :       case ('up2_cl')
    1891           0 :         stats_metadata%iup2_cl = k
    1892             :         call stat_assign( var_index=stats_metadata%iup2_cl, var_name="up2_cl", &
    1893             :              var_description="u'^2_cl, up2 budget: up2 clipping", var_units="m^2/s^3", &
    1894           0 :              l_silhs=.false., grid_kind=stats_zm )
    1895           0 :         k = k + 1
    1896             : 
    1897             :       case ('up2_pd')
    1898           0 :         stats_metadata%iup2_pd = k
    1899             :         call stat_assign( var_index=stats_metadata%iup2_pd, var_name="up2_pd", &
    1900             :              var_description="u'^2_pd, up2 budget: up2 positive definite adjustment", &
    1901           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1902           0 :         k = k + 1
    1903             : 
    1904             :       case ('up2_sf')
    1905           0 :         stats_metadata%iup2_sf = k
    1906             :         call stat_assign( var_index=stats_metadata%iup2_sf, var_name="up2_sf", &
    1907             :              var_description="u'^2_sf, up2 budget: up2 surface variance", var_units="m^2/s^3", &
    1908           0 :              l_silhs=.false., grid_kind=stats_zm )
    1909           0 :         k = k + 1
    1910             : 
    1911             :       case ('up2_splat')
    1912           0 :         stats_metadata%iup2_splat = k
    1913             :         call stat_assign( var_index=stats_metadata%iup2_splat, var_name="up2_splat", &
    1914             :              var_description="u'^2_splat, up2 budget: up2 splatting", var_units="m^2/s^3", &
    1915           0 :              l_silhs=.false., grid_kind=stats_zm )
    1916           0 :         k = k + 1
    1917             : 
    1918             :       case ('vp2_bt')
    1919           0 :         stats_metadata%ivp2_bt = k
    1920             :         call stat_assign( var_index=stats_metadata%ivp2_bt, var_name="vp2_bt", &
    1921             :              var_description="v'2_bt, vp2 budget: vp2 time tendency", var_units="m^2/s^3", &
    1922           0 :              l_silhs=.false., grid_kind=stats_zm )
    1923           0 :         k = k + 1
    1924             : 
    1925             :       case ('vp2_ma')
    1926           0 :         stats_metadata%ivp2_ma = k
    1927             :         call stat_assign( var_index=stats_metadata%ivp2_ma, var_name="vp2_ma", &
    1928             :              var_description="v'^2_ma, vp2 budget: vp2 mean advection", var_units="m^2/s^3", &
    1929           0 :              l_silhs=.false., grid_kind=stats_zm )
    1930           0 :         k = k + 1
    1931             : 
    1932             :       case ('vp2_ta')
    1933           0 :         stats_metadata%ivp2_ta = k
    1934             :         call stat_assign( var_index=stats_metadata%ivp2_ta, var_name="vp2_ta", &
    1935             :              var_description="v'^2_ta, vp2 budget: vp2 turbulent advection", &
    1936           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1937           0 :         k = k + 1
    1938             : 
    1939             :       case ('vp2_tp')
    1940           0 :         stats_metadata%ivp2_tp = k
    1941             :         call stat_assign( var_index=stats_metadata%ivp2_tp, var_name="vp2_tp", &
    1942             :              var_description="v'^2_tp, vp2 budget: vp2 turbulent production", &
    1943           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1944           0 :         k = k + 1
    1945             : 
    1946             :       case ('vp2_dp1')
    1947           0 :         stats_metadata%ivp2_dp1 = k
    1948             :         call stat_assign( var_index=stats_metadata%ivp2_dp1, var_name="vp2_dp1", &
    1949             :              var_description="v'^2_dp1, vp2 budget: vp2 dissipation term 1", &
    1950             :              var_units="m^2/s^3", &
    1951           0 :              l_silhs=.false., grid_kind=stats_zm )
    1952           0 :         k = k + 1
    1953             : 
    1954             :       case ('vp2_dp2')
    1955           0 :         stats_metadata%ivp2_dp2 = k
    1956             :         call stat_assign( var_index=stats_metadata%ivp2_dp2, var_name="vp2_dp2", &
    1957             :              var_description="v'^2_dp2, vp2 budget: vp2 dissipation term 2", &
    1958             :              var_units="m^2/s^3", &
    1959           0 :              l_silhs=.false., grid_kind=stats_zm )
    1960           0 :         k = k + 1
    1961             : 
    1962             :       case ('vp2_pr1')
    1963           0 :         stats_metadata%ivp2_pr1 = k
    1964             :         call stat_assign( var_index=stats_metadata%ivp2_pr1, var_name="vp2_pr1", &
    1965             :              var_description="v'^2_pr1, vp2 budget: vp2 pressure term 1", var_units="m^2/s^3", &
    1966           0 :              l_silhs=.false., grid_kind=stats_zm )
    1967           0 :         k = k + 1
    1968             : 
    1969             :       case ('vp2_pr2')
    1970           0 :         stats_metadata%ivp2_pr2 = k
    1971             :         call stat_assign( var_index=stats_metadata%ivp2_pr2, var_name="vp2_pr2", &
    1972             :              var_description="v'^2_pr2, vp2 budget: vp2 pressure term 2", var_units="m^2/s^3", &
    1973           0 :              l_silhs=.false., grid_kind=stats_zm )
    1974           0 :         k = k + 1
    1975             : 
    1976             :       case ('vp2_sdmp')
    1977           0 :         stats_metadata%ivp2_sdmp = k
    1978             :         call stat_assign( var_index=stats_metadata%ivp2_sdmp, var_name="vp2_sdmp", &
    1979             :              var_description="v'^2_sdmp, vp2 budget: vp2 sponge damping term", &
    1980             :              var_units="m^2/s^3", &
    1981           0 :              l_silhs=.false., grid_kind=stats_zm )
    1982           0 :         k = k + 1
    1983             : 
    1984             :       case ('vp2_cl')
    1985           0 :         stats_metadata%ivp2_cl = k
    1986             :         call stat_assign( var_index=stats_metadata%ivp2_cl, var_name="vp2_cl", &
    1987             :              var_description="v'^2_cl, vp2 budget: vp2 clipping", var_units="m^2/s^3", &
    1988           0 :              l_silhs=.false., grid_kind=stats_zm )
    1989           0 :         k = k + 1
    1990             : 
    1991             :       case ('vp2_pd')
    1992           0 :         stats_metadata%ivp2_pd = k
    1993             :         call stat_assign( var_index=stats_metadata%ivp2_pd, var_name="vp2_pd", &
    1994             :              var_description="v'^2_pd, vp2 budget: vp2 positive definite adjustment", &
    1995           0 :              var_units="m^2/s^3", l_silhs=.false., grid_kind=stats_zm )
    1996           0 :         k = k + 1
    1997             : 
    1998             :       case ('vp2_sf')
    1999           0 :         stats_metadata%ivp2_sf = k
    2000             :         call stat_assign( var_index=stats_metadata%ivp2_sf, var_name="vp2_sf", &
    2001             :              var_description="v'^2_sf, vp2 budget: vp2 surface variance", var_units="m^2/s^3", &
    2002           0 :              l_silhs=.false., grid_kind=stats_zm )
    2003           0 :         k = k + 1
    2004             : 
    2005             :       case ('vp2_splat')
    2006           0 :         stats_metadata%ivp2_splat = k
    2007             :         call stat_assign( var_index=stats_metadata%ivp2_splat, var_name="vp2_splat", &
    2008             :              var_description="v'^2_splat, vp2 budget: vp2 splatting", var_units="m^2/s^3", &
    2009           0 :              l_silhs=.false., grid_kind=stats_zm )
    2010           0 :         k = k + 1
    2011             : 
    2012             :       case ('wpthlp_enter_mfl')
    2013           0 :         stats_metadata%iwpthlp_enter_mfl = k
    2014             :         call stat_assign( var_index=stats_metadata%iwpthlp_enter_mfl, var_name="wpthlp_enter_mfl", &
    2015             :              var_description="w'thl'_enter_mfl, Wpthlp entering flux limiter", &
    2016             :              var_units="(m K)/s", &
    2017           0 :              l_silhs=.false., grid_kind=stats_zm )
    2018           0 :         k = k + 1
    2019             : 
    2020             :       case ('wpthlp_exit_mfl')
    2021           0 :         stats_metadata%iwpthlp_exit_mfl = k
    2022             :         call stat_assign( var_index=stats_metadata%iwpthlp_exit_mfl, var_name="wpthlp_exit_mfl", &
    2023             :              var_description="w'thl'_exit_mfl, Wpthlp exiting flux limiter", &
    2024             :              var_units="(m K)/s", &
    2025           0 :              l_silhs=.false., grid_kind=stats_zm )
    2026           0 :         k = k + 1
    2027             : 
    2028             :       case ('wpthlp_mfl_min')
    2029           0 :         stats_metadata%iwpthlp_mfl_min = k
    2030             :         call stat_assign( var_index=stats_metadata%iwpthlp_mfl_min, var_name="wpthlp_mfl_min", &
    2031             :              var_description="w'thl'_mfl_min, Minimum allowable wpthlp", var_units="(m K)/s", &
    2032           0 :              l_silhs=.false., grid_kind=stats_zm )
    2033           0 :         k = k + 1
    2034             : 
    2035             :       case ('wpthlp_mfl_max')
    2036           0 :         stats_metadata%iwpthlp_mfl_max = k
    2037             :         call stat_assign( var_index=stats_metadata%iwpthlp_mfl_max, var_name="wpthlp_mfl_max", &
    2038             :              var_description="w'thl'_mfl_max, Maximum allowable wpthlp", var_units="(m K)/s", &
    2039           0 :              l_silhs=.false., grid_kind=stats_zm )
    2040           0 :         k = k + 1
    2041             : 
    2042             :       case ('wprtp_mfl_min')
    2043           0 :         stats_metadata%iwprtp_mfl_min = k
    2044             :         call stat_assign( var_index=stats_metadata%iwprtp_mfl_min, var_name="wprtp_mfl_min", &
    2045             :              var_description="w'rt'_mfl_min, Minimum allowable wprtp", &
    2046           0 :              var_units="(m kg)/(s kg)", l_silhs=.false., grid_kind=stats_zm )
    2047           0 :         k = k + 1
    2048             : 
    2049             :       case ('wprtp_mfl_max')
    2050           0 :         stats_metadata%iwprtp_mfl_max = k
    2051             :         call stat_assign( var_index=stats_metadata%iwprtp_mfl_max, var_name="wprtp_mfl_max", &
    2052             :              var_description="w'rt'_mfl_max, Maximum allowable wprtp", &
    2053           0 :              var_units="(m kg)/(s kg)", l_silhs=.false., grid_kind=stats_zm )
    2054           0 :         k = k + 1
    2055             : 
    2056             :       case ('wprtp_enter_mfl')
    2057           0 :         stats_metadata%iwprtp_enter_mfl = k
    2058             :         call stat_assign( var_index=stats_metadata%iwprtp_enter_mfl, var_name="wprtp_enter_mfl", &
    2059             :              var_description="w'rt'_enter_mfl, Wprtp entering flux limiter", &
    2060           0 :              var_units="(m kg)/(s kg)", l_silhs=.false., grid_kind=stats_zm )
    2061           0 :         k = k + 1
    2062             : 
    2063             :       case ('wprtp_exit_mfl')
    2064           0 :         stats_metadata%iwprtp_exit_mfl = k
    2065             :         call stat_assign( var_index=stats_metadata%iwprtp_exit_mfl, var_name="wprtp_exit_mfl", &
    2066             :              var_description="w'rt'_exit_mfl, Wprtp exiting flux limiter", &
    2067           0 :              var_units="(m kg)/(s kg)", l_silhs=.false., grid_kind=stats_zm )
    2068           0 :         k = k + 1
    2069             : 
    2070             :       case ('wm_zm')
    2071           0 :         stats_metadata%iwm_zm = k
    2072             :         call stat_assign( var_index=stats_metadata%iwm_zm, var_name="wm_zm", &
    2073             :              var_description="wm_zm, Vertical (w) wind", var_units="m/s", l_silhs=.false., &
    2074           0 :              grid_kind=stats_zm )
    2075           0 :         k = k + 1
    2076             : 
    2077             :       case ('cloud_frac_zm')
    2078           0 :         stats_metadata%icloud_frac_zm = k
    2079             :         call stat_assign( var_index=stats_metadata%icloud_frac_zm, var_name="cloud_frac_zm", &
    2080             :           var_description="cloud_frac_zm, Cloud fraction", &
    2081           0 :           var_units="-", l_silhs=.false., grid_kind=stats_zm)
    2082           0 :         k = k + 1
    2083             : 
    2084             :       case ('ice_supersat_frac_zm')
    2085           0 :         stats_metadata%iice_supersat_frac_zm = k
    2086             :         call stat_assign( var_index=stats_metadata%iice_supersat_frac_zm, var_name="ice_supersat_frac_zm", &
    2087             :              var_description="ice_supersat_frac_zm, Ice cloud fraction", &
    2088             :              var_units="count", l_silhs=.false., &
    2089           0 :              grid_kind=stats_zm )
    2090           0 :         k = k + 1
    2091             : 
    2092             :       case ('rcm_zm')
    2093           0 :         stats_metadata%ircm_zm = k
    2094             :         call stat_assign( var_index=stats_metadata%ircm_zm, var_name="rcm_zm", &
    2095             :              var_description="rcm_zm, Total water mixing ratio", var_units="kg/kg", &
    2096           0 :              l_silhs=.false., grid_kind=stats_zm )
    2097           0 :         k = k + 1
    2098             : 
    2099             :       case ('rtm_zm')
    2100           0 :         stats_metadata%irtm_zm = k
    2101             :         call stat_assign( var_index=stats_metadata%irtm_zm, var_name="rtm_zm", &
    2102             :              var_description="rtm_zm, Total water mixing ratio", var_units="kg/kg", &
    2103           0 :              l_silhs=.false., grid_kind=stats_zm )
    2104           0 :         k = k + 1
    2105             : 
    2106             :       case ('thlm_zm')
    2107           0 :         stats_metadata%ithlm_zm = k
    2108             :         call stat_assign( var_index=stats_metadata%ithlm_zm, var_name="thlm_zm", &
    2109             :              var_description="thlm_zm, Liquid potential temperature", &
    2110             :              var_units="K", l_silhs=.false., &
    2111           0 :              grid_kind=stats_zm )
    2112           0 :         k = k + 1
    2113             : 
    2114             :       case ('w_1_zm')
    2115           0 :         stats_metadata%iw_1_zm = k
    2116             :         call stat_assign( var_index=stats_metadata%iw_1_zm, var_name="w_1_zm", &
    2117             :              var_description="w_1_zm, pdf parameter zm: mean w of component 1", &
    2118           0 :              var_units="m/s", l_silhs=.false., grid_kind=stats_zm )
    2119           0 :         k = k + 1
    2120             : 
    2121             :       case ('w_2_zm')
    2122           0 :         stats_metadata%iw_2_zm = k
    2123             :         call stat_assign( var_index=stats_metadata%iw_2_zm, var_name="w_2_zm", &
    2124             :              var_description="w_2_zm, pdf parameter zm: mean w of component 2", &
    2125           0 :              var_units="m/s", l_silhs=.false., grid_kind=stats_zm )
    2126           0 :         k = k + 1
    2127             : 
    2128             :       case ('varnce_w_1_zm')
    2129           0 :         stats_metadata%ivarnce_w_1_zm = k
    2130             :         call stat_assign( var_index=stats_metadata%ivarnce_w_1_zm, var_name="varnce_w_1_zm", &
    2131             :              var_description="varnce_w_1_zm, pdf parameter zm: w variance of component 1", &
    2132           0 :              var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
    2133           0 :         k = k + 1
    2134             : 
    2135             :       case ('varnce_w_2_zm')
    2136           0 :         stats_metadata%ivarnce_w_2_zm = k
    2137             :         call stat_assign( var_index=stats_metadata%ivarnce_w_2_zm, var_name="varnce_w_2_zm", &
    2138             :              var_description="varnce_w_2_zm, pdf parameter zm: w variance of component 2", &
    2139           0 :              var_units="m^2/s^2", l_silhs=.false., grid_kind=stats_zm )
    2140           0 :         k = k + 1
    2141             : 
    2142             :       case ('mixt_frac_zm')
    2143           0 :         stats_metadata%imixt_frac_zm = k
    2144             :         call stat_assign( var_index=stats_metadata%imixt_frac_zm, var_name="mixt_frac_zm", &
    2145             :              var_description="mixt_frac_zm, pdf parameter zm: mixture fraction", &
    2146           0 :              var_units="-", l_silhs=.false., grid_kind=stats_zm )
    2147           0 :         k = k + 1
    2148             : 
    2149             :       case ( 'Skw_velocity' )
    2150           0 :         stats_metadata%iSkw_velocity = k
    2151             :         call stat_assign( var_index=stats_metadata%iSkw_velocity, var_name="Skw_velocity", &
    2152             :              var_description="Skw_velocity, Skewness velocity", &
    2153             :              var_units="m/s", l_silhs=.false., &
    2154           0 :              grid_kind=stats_zm )
    2155           0 :         k = k + 1
    2156             : 
    2157             :       case ( 'gamma_Skw_fnc' )
    2158           0 :         stats_metadata%igamma_Skw_fnc = k
    2159             :         call stat_assign( var_index=stats_metadata%igamma_Skw_fnc, var_name="gamma_Skw_fnc", &
    2160             :              var_description="gamma_Skw_fnc, Gamma as a function of skewness", var_units="-", &
    2161           0 :              l_silhs=.false., grid_kind=stats_zm )
    2162           0 :         k = k + 1
    2163             : 
    2164             :       case ( 'C6rt_Skw_fnc' )
    2165           0 :         stats_metadata%iC6rt_Skw_fnc = k
    2166             :         call stat_assign( var_index=stats_metadata%iC6rt_Skw_fnc, var_name="C6rt_Skw_fnc", &
    2167             :              var_description="C6rt_Skw_fnc, C_6rt parameter with Sk_w applied", var_units="-", &
    2168           0 :              l_silhs=.false., grid_kind=stats_zm )
    2169           0 :         k = k + 1
    2170             : 
    2171             :       case ( 'C6thl_Skw_fnc' )
    2172           0 :         stats_metadata%iC6thl_Skw_fnc = k
    2173             :         call stat_assign( var_index=stats_metadata%iC6thl_Skw_fnc, var_name="C6thl_Skw_fnc", &
    2174             :              var_description="C6thl_Skw_fnc, C_6thl parameter with Sk_w applied", var_units="-", &
    2175           0 :              l_silhs=.false., grid_kind=stats_zm )
    2176           0 :         k = k + 1
    2177             : 
    2178             :       case ( 'C6_term' )
    2179           0 :         stats_metadata%iC6_term = k
    2180             :         call stat_assign( var_index=stats_metadata%iC6_term, var_name="C6_term", &
    2181             :              var_description="C6 term [-]", var_units="-", &
    2182           0 :              l_silhs=.false., grid_kind=stats_zm )
    2183           0 :         k = k + 1
    2184             : 
    2185             :       case ( 'C7_Skw_fnc' )
    2186           0 :         stats_metadata%iC7_Skw_fnc = k
    2187             :         call stat_assign( var_index=stats_metadata%iC7_Skw_fnc, var_name="C7_Skw_fnc", &
    2188             :              var_description="C7_Skw_fnc, C_7 parameter with Sk_w applied", var_units="-", &
    2189           0 :              l_silhs=.false., grid_kind=stats_zm )
    2190           0 :         k = k + 1
    2191             : 
    2192             :       case ( 'C1_Skw_fnc' )
    2193           0 :         stats_metadata%iC1_Skw_fnc = k
    2194             :         call stat_assign( var_index=stats_metadata%iC1_Skw_fnc, var_name="C1_Skw_fnc", &
    2195             :              var_description="C1_Skw_fnc, C_1 parameter with Sk_w applied", var_units="-", &
    2196           0 :              l_silhs=.false., grid_kind=stats_zm )
    2197           0 :         k = k + 1
    2198             : 
    2199             :       case ( 'coef_wp4_implicit' )
    2200           0 :         stats_metadata%icoef_wp4_implicit = k
    2201             :         call stat_assign( var_index=stats_metadata%icoef_wp4_implicit, &
    2202             :                           var_name="coef_wp4_implicit", &
    2203             :                           var_description="coef_wp4_implicit, wp4 = coef_wp4_implicit * wp2^2" &
    2204             :                                           // " (new PDF)", &
    2205           0 :                           var_units="-", l_silhs=.false., grid_kind=stats_zm )
    2206           0 :         k = k + 1
    2207             : 
    2208             :       case ( 'bv_freq_sqd' )
    2209           0 :         stats_metadata%ibrunt_vaisala_freq_sqd = k
    2210             :         call stat_assign( var_index=stats_metadata%ibrunt_vaisala_freq_sqd, var_name="bv_freq_sqd", &
    2211             :              var_description="Brunt-Vaisala frequency squared", &
    2212             :              var_units="1/s^2", &
    2213           0 :              l_silhs=.false., grid_kind=stats_zm )
    2214           0 :         k = k + 1
    2215             : 
    2216             :       case ( 'bv_freq_sqd_splat' )
    2217           0 :         stats_metadata%ibrunt_vaisala_freq_sqd_splat = k
    2218             :         call stat_assign( var_index=stats_metadata%ibrunt_vaisala_freq_sqd_splat, var_name="bv_freq_sqd_splat", &
    2219             :              var_description="Brunt-Vaisala freq. squared for splatting", &
    2220             :              var_units="1/s^2", &
    2221           0 :              l_silhs=.false., grid_kind=stats_zm )
    2222           0 :         k = k + 1
    2223             : 
    2224             :       case ( 'bv_freq_sqd_mixed' )
    2225           0 :         stats_metadata%ibrunt_vaisala_freq_sqd_mixed = k
    2226             :         call stat_assign( var_index=stats_metadata%ibrunt_vaisala_freq_sqd_mixed, var_name="bv_freq_sqd_mixed", &
    2227             :              var_description="Interpolated Brunt-Vaisala freq. squared between moist and dry air", &
    2228             :              var_units="1/s^2", &
    2229           0 :              l_silhs=.false., grid_kind=stats_zm )
    2230           0 :         k = k + 1
    2231             : 
    2232             :       case ( 'bv_freq_sqd_moist' )
    2233           0 :         stats_metadata%ibrunt_vaisala_freq_sqd_moist = k
    2234             :         call stat_assign( var_index=stats_metadata%ibrunt_vaisala_freq_sqd_moist, var_name="bv_freq_sqd_moist", &
    2235             :              var_description="Brunt-Vaisala freq. squared in moist air", &
    2236             :              var_units="1/s^2", &
    2237           0 :              l_silhs=.false., grid_kind=stats_zm )
    2238           0 :         k = k + 1
    2239             : 
    2240             :       case ( 'bv_freq_sqd_dry' )
    2241           0 :         stats_metadata%ibrunt_vaisala_freq_sqd_dry = k
    2242             :         call stat_assign( var_index=stats_metadata%ibrunt_vaisala_freq_sqd_dry, var_name="bv_freq_sqd_dry", &
    2243             :              var_description="Brunt-Vaisala freq. squared in dry air", &
    2244             :              var_units="1/s^2", &
    2245           0 :              l_silhs=.false., grid_kind=stats_zm )
    2246           0 :         k = k + 1
    2247             : 
    2248             :       case ( 'bv_freq_sqd_smth' )
    2249           0 :         stats_metadata%ibrunt_vaisala_freq_sqd_smth = k
    2250             :         call stat_assign( var_index=stats_metadata%ibrunt_vaisala_freq_sqd_smth, var_name="bv_freq_sqd_smth", &
    2251             :              var_description="Smoothed Brunt-Vaisala freq. squared", &
    2252             :              var_units="1/s^2", &
    2253           0 :              l_silhs=.false., grid_kind=stats_zm )
    2254           0 :         k = k + 1
    2255             : 
    2256             :       case ( 'bv_freq_out_cloud' )
    2257           0 :         stats_metadata%ibrunt_freq_out_cloud = k
    2258             :         call stat_assign( var_index=stats_metadata%ibrunt_freq_out_cloud, var_name="bv_freq_out_cloud", &
    2259             :              var_description="Out-of-cloud part of Brunt-Vaisala freq.", &
    2260             :              var_units="1/s^2", &
    2261           0 :              l_silhs=.false., grid_kind=stats_zm )
    2262           0 :         k = k + 1
    2263             : 
    2264             :       case ( 'bv_freq_pos' )
    2265           0 :         stats_metadata%ibrunt_freq_pos = k
    2266             :         call stat_assign( var_index=stats_metadata%ibrunt_freq_pos, var_name="bv_freq_pos", &
    2267             :              var_description="Positive part of Brunt-Vaisala freq.", &
    2268             :              var_units="1/s^2", &
    2269           0 :              l_silhs=.false., grid_kind=stats_zm )
    2270           0 :         k = k + 1
    2271             : 
    2272             :       case ( 'Ri_zm' )
    2273           0 :         stats_metadata%iRi_zm = k
    2274             :         call stat_assign( var_index=stats_metadata%iRi_zm,var_name="Ri_zm", &
    2275             :              var_description="Richardson number [-]", var_units="-", &
    2276           0 :              l_silhs=.false., grid_kind=stats_zm )
    2277           0 :         k = k + 1
    2278             : 
    2279             :       case ( 'shear_sqd' )
    2280           0 :         stats_metadata%ishear_sqd = k
    2281             :         call stat_assign( var_index=stats_metadata%ishear_sqd, var_name="shear_sqd", &
    2282             :              var_description="shear_sqd, shear_sqd", var_units="-", &
    2283           0 :              l_silhs=.false., grid_kind=stats_zm )
    2284           0 :         k = k + 1
    2285             : 
    2286             :       case ( 'a3_coef' )
    2287           0 :         stats_metadata%ia3_coef = k
    2288             :         call stat_assign( var_index=stats_metadata%ia3_coef, var_name="a3_coef", &
    2289             :              var_description="a3_coef, Quantity in formula 25 from Equations for CLUBB", &
    2290           0 :              var_units="count", l_silhs=.false., grid_kind=stats_zm )
    2291           0 :         k = k + 1
    2292             : 
    2293             :       case ( 'wp3_on_wp2' )
    2294           0 :         stats_metadata%iwp3_on_wp2 = k
    2295             :         call stat_assign( var_index=stats_metadata%iwp3_on_wp2, var_name="wp3_on_wp2", &
    2296             :              var_description="w'^3_on_w'^2, Smoothed version of wp3 / wp2", var_units="m/s", &
    2297           0 :              l_silhs=.false., grid_kind=stats_zm )
    2298           0 :         k = k + 1
    2299             : 
    2300             :       case ( 'wp3_on_wp2_cfl_num' )
    2301           0 :         stats_metadata%iwp3_on_wp2_cfl_num = k
    2302             :         call stat_assign( var_index=stats_metadata%iwp3_on_wp2_cfl_num, var_name="wp3_on_wp2_cfl_num", &
    2303             :              var_description="w'^3_on_w'^2 CFL number", var_units="-", &
    2304           0 :              l_silhs=.false., grid_kind=stats_zm )
    2305           0 :         k = k + 1
    2306             : 
    2307             :       case ( 'Skw_zm' )
    2308           0 :         stats_metadata%iSkw_zm = k
    2309             :         call stat_assign( var_index=stats_metadata%iSkw_zm, var_name="Skw_zm", &
    2310             :              var_description="Skw_zm, Skewness of w on momentum levels", var_units="-", &
    2311           0 :              l_silhs=.false., grid_kind=stats_zm )
    2312           0 :         k = k + 1
    2313             : 
    2314             :       case ( 'Skthl_zm' )
    2315           0 :         stats_metadata%iSkthl_zm = k
    2316             :         call stat_assign( var_index=stats_metadata%iSkthl_zm, var_name="Skthl_zm", &
    2317             :              var_description="Skthl_zm, Skewness of thl on momentum levels", var_units="-", &
    2318           0 :              l_silhs=.false., grid_kind=stats_zm )
    2319           0 :         k = k + 1
    2320             : 
    2321             :       case ( 'Skrt_zm' )
    2322           0 :         stats_metadata%iSkrt_zm = k
    2323             :         call stat_assign( var_index=stats_metadata%iSkrt_zm, var_name="Skrt_zm", &
    2324             :              var_description="Skrt_zm, Skewness of rt on momentum levels", var_units="-", &
    2325           0 :              l_silhs=.false., grid_kind=stats_zm )
    2326           0 :         k = k + 1
    2327             : 
    2328             :       case ( 'stability_correction' )
    2329           0 :         stats_metadata%istability_correction = k
    2330             :         call stat_assign( var_index=stats_metadata%istability_correction, var_name="stability_correction", &
    2331             :              var_description="stability_correction, Stability applied to "&
    2332             :              // "diffusion of rtm and thlm", var_units="-", &
    2333           0 :              l_silhs=.false., grid_kind=stats_zm )
    2334           0 :         k = k + 1
    2335             : 
    2336             :       case ( 'rtp2_from_chi' )
    2337           0 :         stats_metadata%irtp2_from_chi = k
    2338             :         call stat_assign( var_index=stats_metadata%irtp2_from_chi, var_name="rtp2_from_chi", &
    2339             :              var_description="rtp2_from_chi, Variance of rt, computed from the " &
    2340             :              // "chi/eta distribution", &
    2341           0 :              var_units="(kg/kg)^2", l_silhs=.false., grid_kind=stats_zm )
    2342           0 :         k = k + 1
    2343             : 
    2344             :       case ( 'lh_rtp2_mc' )
    2345           0 :         stats_metadata%ilh_rtp2_mc = k
    2346             :         call stat_assign( var_index=stats_metadata%ilh_rtp2_mc, var_name="lh_rtp2_mc", &
    2347             :              var_description="lh_rtp2_mc, LH est. of rtp2_mc", &
    2348           0 :              var_units="(kg/kg)^2/s", l_silhs=.false., grid_kind=stats_zm )
    2349           0 :         k = k + 1
    2350             : 
    2351             :       case ( 'lh_thlp2_mc' )
    2352           0 :         stats_metadata%ilh_thlp2_mc = k
    2353             :         call stat_assign( var_index=stats_metadata%ilh_thlp2_mc, var_name="lh_thlp2_mc", &
    2354             :              var_description="lh_thl'^2_mc, LH est. of thlp2_mc", &
    2355           0 :              var_units="K^2/s", l_silhs=.false., grid_kind=stats_zm )
    2356           0 :         k = k + 1
    2357             : 
    2358             :       case ( 'lh_wprtp_mc' )
    2359           0 :         stats_metadata%ilh_wprtp_mc = k
    2360             :         call stat_assign( var_index=stats_metadata%ilh_wprtp_mc, var_name="lh_wprtp_mc", &
    2361             :              var_description="lh_w'rt'_mc, LH est. of wprtp_mc", &
    2362           0 :              var_units="(m kg/kg)/s^2", l_silhs=.false., grid_kind=stats_zm )
    2363           0 :         k = k + 1
    2364             : 
    2365             :       case ( 'lh_wpthlp_mc' )
    2366           0 :         stats_metadata%ilh_wpthlp_mc = k
    2367             :         call stat_assign( var_index=stats_metadata%ilh_wpthlp_mc, var_name="lh_wpthlp_mc", &
    2368             :              var_description="lh_w'thl'_mc, LH est. of wpthlp_mc", &
    2369           0 :              var_units="(m K)/s^2", l_silhs=.false., grid_kind=stats_zm )
    2370           0 :         k = k + 1
    2371             : 
    2372             :       case ( 'lh_rtpthlp_mc' )
    2373           0 :         stats_metadata%ilh_rtpthlp_mc = k
    2374             :         call stat_assign( var_index=stats_metadata%ilh_rtpthlp_mc, var_name="lh_rtpthlp_mc", &
    2375             :              var_description="lh_rt'thl'_mc, LH est. of rtpthlp_mc", &
    2376           0 :              var_units="(K kg/kg)/s", l_silhs=.false., grid_kind=stats_zm )
    2377           0 :         k = k + 1
    2378             : 
    2379             :       case ( 'sclrprtp' )
    2380           0 :         do j = 1, sclr_dim, 1
    2381           0 :           write( sclr_idx, * ) j
    2382           0 :           sclr_idx = adjustl(sclr_idx)
    2383           0 :           stats_metadata%isclrprtp(j) = k
    2384           0 :           call stat_assign( var_index=stats_metadata%isclrprtp(j), var_name="sclr"//trim(sclr_idx)//"prtp", &
    2385             :             var_description="scalar("//trim(sclr_idx)//")'rt'", var_units="unknown", &
    2386           0 :             l_silhs=.false., grid_kind=stats_zm )
    2387           0 :           k = k + 1
    2388             :         end do
    2389             : 
    2390             :       case ( 'sclrp2' )
    2391           0 :         do j = 1, sclr_dim, 1
    2392           0 :           write( sclr_idx, * ) j
    2393           0 :           sclr_idx = adjustl(sclr_idx)
    2394           0 :           stats_metadata%isclrp2(j) = k
    2395           0 :           call stat_assign( var_index=stats_metadata%isclrp2(j), var_name="sclr"//trim(sclr_idx)//"p2", &
    2396             :             var_description="scalar("//trim(sclr_idx)//")'^2'", var_units="unknown", &
    2397           0 :             l_silhs=.false., grid_kind=stats_zm )
    2398           0 :           k = k + 1
    2399             :         end do
    2400             : 
    2401             :       case ( 'sclrpthvp' )
    2402           0 :         do j = 1, sclr_dim, 1
    2403           0 :           write( sclr_idx, * ) j
    2404           0 :           sclr_idx = adjustl(sclr_idx)
    2405           0 :           stats_metadata%isclrpthvp(j) = k
    2406           0 :           call stat_assign( var_index=stats_metadata%isclrpthvp(j), var_name="sclr"//trim(sclr_idx)//"pthvp", &
    2407             :             var_description="scalar("//trim(sclr_idx)//")'th_v'", var_units="unknown", &
    2408           0 :             l_silhs=.false., grid_kind=stats_zm )
    2409           0 :           k = k + 1
    2410             :         end do
    2411             : 
    2412             :       case ( 'sclrpthlp' )
    2413           0 :         do j = 1, sclr_dim, 1
    2414           0 :           write( sclr_idx, * ) j
    2415           0 :           sclr_idx = adjustl(sclr_idx)
    2416           0 :           stats_metadata%isclrpthlp(j) = k
    2417           0 :           call stat_assign( var_index=stats_metadata%isclrpthlp(j), var_name="sclr"//trim(sclr_idx)//"pthlp", &
    2418             :             var_description="scalar("//trim(sclr_idx)//")'th_l'", var_units="unknown", &
    2419           0 :             l_silhs=.false., grid_kind=stats_zm )
    2420           0 :           k = k + 1
    2421             :         end do
    2422             : 
    2423             :       case ( 'sclrprcp' )
    2424           0 :         do j = 1, sclr_dim, 1
    2425           0 :           write( sclr_idx, * ) j
    2426           0 :           sclr_idx = adjustl(sclr_idx)
    2427           0 :           stats_metadata%isclrprcp(j) = k
    2428           0 :           call stat_assign( var_index=stats_metadata%isclrprcp(j), var_name="sclr"//trim(sclr_idx)//"prcp", &
    2429             :             var_description="scalar("//trim(sclr_idx)//")'rc'", var_units="unknown", &
    2430           0 :             l_silhs=.false., grid_kind=stats_zm )
    2431           0 :           k = k + 1
    2432             :         end do
    2433             : 
    2434             :       case ( 'wpsclrp' )
    2435           0 :         do j = 1, sclr_dim, 1
    2436           0 :           write( sclr_idx, * ) j
    2437           0 :           sclr_idx = adjustl(sclr_idx)
    2438           0 :           stats_metadata%iwpsclrp(j) = k
    2439           0 :           call stat_assign( var_index=stats_metadata%iwpsclrp(j), var_name="wpsclr"//trim(sclr_idx)//"p", &
    2440             :             var_description="'w'scalar("//trim(sclr_idx)//")", var_units="unknown", &
    2441           0 :             l_silhs=.false., grid_kind=stats_zm )
    2442           0 :           k = k + 1
    2443             :         end do
    2444             : 
    2445             :       case ( 'wpsclrp2' )
    2446           0 :         do j = 1, sclr_dim, 1
    2447           0 :           write( sclr_idx, * ) j
    2448           0 :           sclr_idx = adjustl(sclr_idx)
    2449           0 :           stats_metadata%iwpsclrp2(j) = k
    2450           0 :           call stat_assign( var_index=stats_metadata%iwpsclrp2(j), var_name="wpsclr"//trim(sclr_idx)//"p2", &
    2451             :             var_description="'w'scalar("//trim(sclr_idx)//")'^2'", var_units="unknown", &
    2452           0 :             l_silhs=.false., grid_kind=stats_zm )
    2453           0 :           k = k + 1
    2454             :         end do
    2455             : 
    2456             :       case ( 'wp2sclrp' )
    2457           0 :         do j = 1, sclr_dim, 1
    2458           0 :           write( sclr_idx, * ) j
    2459           0 :           sclr_idx = adjustl(sclr_idx)
    2460           0 :           stats_metadata%iwp2sclrp(j) = k
    2461           0 :           call stat_assign( var_index=stats_metadata%iwp2sclrp(j), var_name="wp2sclr"//trim(sclr_idx)//"p", &
    2462             :             var_description="'w'^2 scalar("//trim(sclr_idx)//")", var_units="unknown", &
    2463           0 :             l_silhs=.false., grid_kind=stats_zm )
    2464           0 :           k = k + 1
    2465             :         end do
    2466             : 
    2467             :       case ( 'wpsclrprtp' )
    2468           0 :         do j = 1, sclr_dim, 1
    2469           0 :           write( sclr_idx, * ) j
    2470           0 :           sclr_idx = adjustl(sclr_idx)
    2471           0 :           stats_metadata%iwpsclrprtp(j) = k
    2472           0 :           call stat_assign( var_index=stats_metadata%iwpsclrprtp(j), var_name="wpsclr"//trim(sclr_idx)//"prtp", &
    2473             :             var_description="'w' scalar("//trim(sclr_idx)//")'rt'", var_units="unknown", &
    2474           0 :             l_silhs=.false., grid_kind=stats_zm )
    2475           0 :           k = k + 1
    2476             :         end do
    2477             : 
    2478             :       case ( 'wpsclrpthlp' )
    2479           0 :         do j = 1, sclr_dim, 1
    2480           0 :           write( sclr_idx, * ) j
    2481           0 :           sclr_idx = adjustl(sclr_idx)
    2482           0 :           stats_metadata%iwpsclrpthlp(j) = k
    2483           0 :           call stat_assign( var_index=stats_metadata%iwpsclrpthlp(j), &
    2484             :             var_name="wpsclr"//trim(sclr_idx)//"pthlp", &
    2485             :             var_description="'w' scalar("//trim(sclr_idx)//")'th_l'", var_units="unknown", &
    2486           0 :             l_silhs=.false., grid_kind=stats_zm )
    2487           0 :           k = k + 1
    2488             :         end do
    2489             : 
    2490             :       case ( 'wpedsclrp' )
    2491           0 :         do j = 1, edsclr_dim, 1
    2492           0 :           write( sclr_idx, * ) j
    2493           0 :           sclr_idx = adjustl(sclr_idx)
    2494           0 :           stats_metadata%iwpedsclrp(j) = k
    2495           0 :           call stat_assign( var_index=stats_metadata%iwpedsclrp(j), var_name="wpedsclr"//trim(sclr_idx)//"p", &
    2496             :             var_description="eddy scalar("//trim(sclr_idx)//")'w'", var_units="unknown", &
    2497           0 :             l_silhs=.false., grid_kind=stats_zm )
    2498           0 :           k = k + 1
    2499             :         end do
    2500             : 
    2501             :       case default
    2502           0 :         write(fstderr,*) 'Error:  unrecognized variable in vars_zm:  ',  trim(vars_zm(i))
    2503           0 :         l_error = .true.  ! This will stop the run.
    2504             : 
    2505             :       end select
    2506             : 
    2507             :     end do ! i = 1 .. stats_zm%num_output_fields
    2508             : 
    2509           0 :     return
    2510             :   end subroutine stats_init_zm
    2511             : 
    2512             : end module stats_zm_module

Generated by: LCOV version 1.14