LCOV - code coverage report
Current view: top level - physics/cosp2/src/src/simulator - cosp_modis_interface.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 25 26 96.2 %
Date: 2025-03-13 19:12:29 Functions: 1 3 33.3 %

          Line data    Source code
       1             : ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       2             : ! Copyright (c) 2015, Regents of the University of Colorado
       3             : ! All rights reserved.
       4             : !
       5             : ! Redistribution and use in source and binary forms, with or without modification, are 
       6             : ! permitted provided that the following conditions are met:
       7             : !
       8             : ! 1. Redistributions of source code must retain the above copyright notice, this list of 
       9             : !    conditions and the following disclaimer.
      10             : !
      11             : ! 2. Redistributions in binary form must reproduce the above copyright notice, this list
      12             : !    of conditions and the following disclaimer in the documentation and/or other 
      13             : !    materials provided with the distribution.
      14             : !
      15             : ! 3. Neither the name of the copyright holder nor the names of its contributors may be 
      16             : !    used to endorse or promote products derived from this software without specific prior
      17             : !    written permission.
      18             : !
      19             : ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
      20             : ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
      21             : ! MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
      22             : ! THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
      23             : ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
      24             : ! OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
      25             : ! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      26             : ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
      27             : ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      28             : !
      29             : ! History
      30             : ! May 2015 - D. Swales - Original version
      31             : ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      32             : MODULE MOD_COSP_Modis_INTERFACE
      33             :   USE COSP_KINDS,      ONLY: wp
      34             :   USE MOD_COSP_CONFIG, ONLY: R_UNDEF
      35             :   use mod_modis_sim,   ONLY: num_trial_res,min_OpticalThickness,CO2Slicing_PressureLimit,&
      36             :                              CO2Slicing_TauLimit,phase_TauLimit,size_TauLimit,re_fill,   &
      37             :                              phaseDiscrimination_Threshold,re_water_min,     &
      38             :                              re_water_max,re_ice_min,re_ice_max,               &
      39             :                              highCloudPressureLimit,lowCloudPressureLimit,phaseIsNone,   &
      40             :                              phaseIsLiquid,phaseIsIce,phaseIsUndetermined,trial_re_w,    &
      41             :                              trial_re_i,g_w,g_i,w0_w,w0_i, get_g_nir,get_ssa_nir
      42             :   implicit none
      43             : 
      44             :   ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      45             :   !  TYPE modis_in
      46             :   ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
      47             :   type modis_IN
      48             :      integer,pointer :: &
      49             :           Npoints,        & ! Number of horizontal gridpoints
      50             :           Ncolumns,       & ! Number of subcolumns
      51             :           Nlevels           ! Number of vertical levels
      52             :      integer :: &
      53             :           Nsunlit           ! Number of sunlit lit pixels
      54             :      real(wp),allocatable,dimension(:) :: &
      55             :           sunlit,         & ! Sunlit scenes
      56             :           notSunlit         ! Dark scenes
      57             :      real(wp),allocatable,dimension(:,:) :: &
      58             :           pres              ! Gridmean pressure at layer edges (Pa) 
      59             :      real(wp),pointer ::  &
      60             :           tau(:,:,:),     & ! Subcolumn optical thickness @ 0.67 microns.
      61             :           liqFrac(:,:,:), & ! Liquid water fraction
      62             :           g(:,:,:),       & ! Subcolumn assymetry parameter  
      63             :           w0(:,:,:)         ! Subcolumn single-scattering albedo
      64             :   end type modis_IN
      65             : contains
      66             :   ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      67             :   ! SUBROTUINE cosp_modis_init
      68             :   ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      69        1536 :   SUBROUTINE COSP_MODIS_INIT()
      70             :     integer :: i 
      71             :     
      72             :     ! Retrieval parameters
      73        1536 :     min_OpticalThickness          = 0.3_wp     ! Minimum detectable optical thickness
      74        1536 :     CO2Slicing_PressureLimit      = 70000._wp  ! Cloud with higher pressures use thermal 
      75             :                                                ! methods, units Pa
      76        1536 :     CO2Slicing_TauLimit           = 1._wp      ! How deep into the cloud does CO2 slicing 
      77             :                                                ! see? 
      78        1536 :     phase_TauLimit                = 1._wp      ! How deep into the cloud does the phase 
      79             :                                                ! detection see?
      80        1536 :     size_TauLimit                 = 2._wp      ! Depth of the re retreivals
      81        1536 :     phaseDiscrimination_Threshold = 0.7_wp     ! What fraction of total extincton needs to 
      82             :                                                ! be in a single category to make phase 
      83             :                                                ! discrim. work? 
      84        1536 :     re_fill                       = -999._wp   ! Fill value
      85        1536 :     re_water_min                  = 4._wp      ! Minimum effective radius (liquid)
      86        1536 :     re_water_max                  = 30._wp     ! Maximum effective radius (liquid)
      87        1536 :     re_ice_min                    = 5._wp      ! Minimum effective radius (ice)
      88        1536 :     re_ice_max                    = 90._wp     ! Minimum effective radius (ice)
      89        1536 :     highCloudPressureLimit        = 44000._wp  ! High cloud pressure limit (Pa)
      90        1536 :     lowCloudPressureLimit         = 68000._wp  ! Low cloud pressure limit (Pa)
      91        1536 :     phaseIsNone                   = 0          ! No cloud
      92        1536 :     phaseIsLiquid                 = 1          ! Liquid cloud
      93        1536 :     phaseIsIce                    = 2          ! Ice cloud
      94        1536 :     phaseIsUndetermined           = 3          ! Undetermined cloud
      95             : 
      96             :     ! Precompute near-IR optical params vs size for retrieval scheme    
      97             :     trial_re_w(1:num_trial_res) = re_water_min + (re_water_max - re_water_min) /         &
      98       24576 :          (num_trial_res-1) * (/(i, i=0, num_trial_res-1)/)
      99             :     trial_re_i(1:num_trial_res) = re_ice_min   + (re_ice_max -   re_ice_min) /           &
     100       24576 :          (num_trial_res-1) * (/(i, i=0, num_trial_res-1)/)
     101             : 
     102             :     ! Initialize estimates for size retrieval
     103       24576 :     g_w(1:num_trial_res)  = get_g_nir(phaseIsLiquid,trial_re_w(1:num_trial_res))
     104       24576 :     w0_w(1:num_trial_res) = get_ssa_nir(phaseIsLiquid,trial_re_w(1:num_trial_res))
     105       24576 :     g_i(1:num_trial_res)  = get_g_nir(phaseIsIce,trial_re_i(1:num_trial_res))
     106       24576 :     w0_i(1:num_trial_res) = get_ssa_nir(phaseIsIce,trial_re_i(1:num_trial_res))
     107             : 
     108        1536 :   END SUBROUTINE COSP_MODIS_INIT
     109             :   
     110             :   ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     111             :   ! END MODULE MOD_COSP_Modis_INTERFACE
     112             :   ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     113           0 : END MODULE MOD_COSP_Modis_INTERFACE

Generated by: LCOV version 1.14