! $Id$ ! ! defines rtm structure and substructures with allocation/deallocation routines ! ! rtm ! % sgrid ! % ngrid ! module rtm_types_mod integer, parameter :: real4 = selected_real_kind(6,37) integer, parameter :: int1 = selected_int_kind(1) integer, parameter, public:: RTM_NVZEN = 50 real, parameter, public:: RTM_VZA_BINSIZE = 1./ RTM_NVZEN !--------------------------------------------------------------------- ! RTM structure definition !--------------------------------------------------------------------- ! +++++++ NWP Grid +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! --- NWP Grid Profile TYPE, public :: rtm_ngrid_chn_prof_type logical :: is_set REAL (kind=real4), DIMENSION(:), allocatable :: Trans_Two_Way_Atm_Clr REAL (kind=real4), DIMENSION(:), allocatable :: Trans_Prof REAL (kind=real4), DIMENSION(:), allocatable :: Trans_Atm_Clr_Solar_total REAL (kind=real4), DIMENSION(:), allocatable :: Trans_Atm_Clr_solar REAL (kind=real4), DIMENSION(:), allocatable :: Rad_Prof REAL (kind=real4), DIMENSION(:), allocatable :: Rad_BB_Prof contains procedure :: allocate => allocate_rtm_ngrid_chn_prof end TYPE Rtm_ngrid_chn_prof_type ! --- NWP Grid channel type :: rtm_ngrid_chn_type logical :: is_set type (rtm_ngrid_chn_prof_type ), allocatable :: chn (:) contains procedure :: allocate => allocate_rtm_ngrid_chn end type rtm_ngrid_chn_type ! --- NWP ngrid sub type, public :: rtm_ngrid_sub_type logical :: is_set integer :: Level_sfc = 0 integer :: Level_tropo = 0 integer :: Inversion_Level = 0 integer :: Level440 = 0 integer :: Level850 = 0 TYPE (Rtm_ngrid_chn_type), allocatable :: angl (:) REAL (kind=real4), dimension(:), allocatable :: T_Prof REAL (kind=real4), dimension(:), allocatable :: Z_Prof REAL (kind=real4), dimension(:), allocatable :: Wvmr_Prof REAL (kind=real4), dimension(:), allocatable :: Ozmr_Prof contains procedure :: allocate => allocate_rtm_ngrid_sub end type rtm_ngrid_sub_type ! +++++++ Satellite Grid ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! --- sgrid sub channel data structure ------------ type rtm_sgrid_chn_data_type logical :: is_set REAL (kind=real4) :: rad_atm ! -- radiance at toa emitted by atmosphere REAL (kind=real4) :: trans_atm ! -- transmission of atmosphere from surface to toa REAL (kind=real4) :: rad_atm_sfc ! -- radiance at toa emitted by atmosphere and surface REAL (kind=real4) :: bt_atm_sfc ! -- bt computes with planck from rad_atm_sfc real ( kind = real4) :: emiss_tropo ! -- emissivity at tropopause end type rtm_sgrid_chn_data_type ! --- sgrid sub channel structure ------- type rtm_sgrid_chn_type logical :: is_set type (rtm_sgrid_chn_data_type) , allocatable :: chn(:) integer :: idx_angl integer :: level_sfc contains procedure :: allocate => allocate_sgrid_chn end type rtm_sgrid_chn_type ! +++++++ MAIN ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! --- RTM main --------------- type rtm_main_type logical :: is_set logical :: is_sgrid_set type(rtm_ngrid_sub_type), public, allocatable :: ngrid (:,:) type(rtm_sgrid_chn_type), public, allocatable :: sgrid (:,:) contains procedure :: allocate_ngrid procedure :: deallocate_ngrid procedure :: allocate_sgrid procedure :: deallocate_sgrid end type rtm_main_type integer , public:: pfaast_chn_idx (36) contains ! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ! ++++++++++ RTM Main structure ++++++++++++++ ! ------- NGRID ALLOC subroutine allocate_ngrid ( self , n_lon , n_lat ) class ( rtm_main_type ) :: self integer :: n_lon , n_lat integer :: astatus if ( .not. self % is_set ) then allocate ( self % ngrid (n_lon , n_lat), stat = astatus) if ( astatus /= 0 ) then print "(a,'Not enough memory to allocate Rtm_Params structure.')" end if self % is_set = .true. end if end subroutine allocate_ngrid ! ------- NGRID DEALLOC ------ subroutine deallocate_ngrid (self) class ( rtm_main_type ) :: self if (self % is_set ) then if (allocated (self % ngrid ) ) deallocate ( self % ngrid ) end if self % is_set = .false. end subroutine deallocate_ngrid ! ----------- SGRID ALLOC ------ subroutine allocate_sgrid ( self , n_x , n_y ) class ( rtm_main_type ) :: self integer :: n_x , n_y integer :: astatus if ( .not. self % is_sgrid_set ) then allocate ( self % sgrid (n_x , n_y), stat = astatus) if ( astatus /= 0 ) then print "(a,'Not enough memory to allocate satellite grid Rtm_Params structure.')" end if self % is_sgrid_set = .true. end if end subroutine allocate_sgrid ! -------------- SGRID DEALLOC ------ subroutine deallocate_sgrid (self) class ( rtm_main_type ) :: self print*,self % is_set if (self % is_sgrid_set ) then if (allocated (self % sgrid)) deallocate ( self % sgrid) end if self % is_sgrid_set = .false. end subroutine deallocate_sgrid ! +++++++ NGRID Substrctures ++++++ subroutine allocate_rtm_ngrid_sub ( self , n_levels) class (rtm_ngrid_sub_type) :: self integer :: n_levels if ( .not. self%is_set ) then allocate ( self % t_prof(n_levels)) allocate ( self % z_prof(n_levels)) allocate ( self % wvmr_prof(n_levels)) allocate ( self % ozmr_prof(n_levels)) allocate ( self % angl (RTM_NVZEN) ) end if self%is_set = .true. end subroutine allocate_rtm_ngrid_sub ! ----------------------------------------------------- subroutine allocate_rtm_ngrid_chn (self) class (rtm_ngrid_chn_type) :: self allocate ( self % chn(36)) end subroutine allocate_rtm_ngrid_chn ! ----------------------------------------------------- subroutine allocate_rtm_ngrid_chn_prof ( self , n_levels) class (rtm_ngrid_chn_prof_type) :: self integer :: n_levels allocate ( self % Trans_Prof ( n_levels ) ) allocate ( self % Rad_Prof ( n_levels ) ) allocate ( self % Rad_BB_Prof ( n_levels ) ) allocate ( self % Trans_Two_Way_Atm_Clr( n_levels ) ) self % is_set = .true. end subroutine allocate_rtm_ngrid_chn_prof ! +++++++ SGRID Substrctures ++++++ ! ----------------------------------------------------- subroutine allocate_sgrid_chn (self) class (rtm_sgrid_chn_type) :: self allocate ( self % chn(36)) end subroutine allocate_sgrid_chn end module rtm_types_mod