Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / da / da_radiance / da_crtm_init.inc
blobed22ce2adb212cffa1db138b42571e7e222eeb2a
1 subroutine da_crtm_init(iv,ob, nsensor)
2 !------------------------------------------------------------------------------
3 !  PURPOSE: interface to the initialization subroutine of CRTM
5 !  METHOD:  read CRTM coefs files
7 !  HISTORY: 10/15/2006  added crtm initialization    Tomislava Vukicevic, ATOC, University of Colorado
8 !           11/09/2006  Updated                      Zhiquan Liu
9 !           10/24/2007  limit to CRTM init           Tom Auligne
10 !------------------------------------------------------------------------------
12  implicit none 
14  type (iv_type), intent (inout) :: iv
15  type (y_type) , intent (inout) :: ob
16  integer ,       intent (in)    :: nsensor
19 !  local arguments
20 !------------------- 
21  integer   :: n, j, ichan
24 ! CRTM local ---------------------------------------------------
26   integer :: Error_Status
27 !  character( 256 ) :: SpcCoeff_File
28 !  character( 256 ) :: TauCoeff_File
29   character( 256 ) :: AerosolCoeff_File
30   character( 256 ) :: CloudCoeff_File
31   character( 256 ) :: File_Path
32 !  character( 80 ), pointer :: Sensor_Descriptor(:)
34 ! end of CRTM local
36   call da_trace_entry("da_crtm_init")
38 !---------------------------------------------------------------------
39 ! 1.0 get CRTM sensor descriptor
40 !---------------------------------------------------------------------
41   allocate(Sensor_Descriptor(nsensor))
42   call da_crtm_sensor_descriptor(nsensor,Sensor_Descriptor)
43   allocate(ChannelInfo(nsensor))
45 ! CRTM load coefficients
46 !-----------------------------------------------------------
47 ! 1.1 call CRTM_Init to load coefficients and fill ChannelInfo structure
48 !-----------------------------------------------------------
49   ! input: 
50      AerosolCoeff_File = 'AerosolCoeff.bin'
51      CloudCoeff_File   = 'CloudCoeff.bin'
52      File_Path         = trim(crtm_coef_path)//'/'
53   !----------------------------------------------------------------
54   ! ChannelInfo structure contains on output: 
55   !
56   ! n_channels - integer, total number of channels
57   ! Sensor_Index - integer
58   ! Channel_Index - integer pointer, index of the channels loaded during initialization
59   ! Sensor_Channel - integer pointer, the sensor channel #
60   ! Sensor_ID - character pointer, character string containing satellite and sensor descr
61   !                                        example: amsre_aqua (Appendix B in User guide)
62   ! WMO_Satellite_ID - integer pointer
63   ! WMO_Sensor_ID - integer pointer
64   !----------------------------------------------------------------- 
66      Error_Status = CRTM_Init(Sensor_Descriptor, &
67                               ChannelInfo, &
68                               AerosolCoeff_File = AerosolCoeff_File, &
69                               CloudCoeff_File = CloudCoeff_File, &
70                               IRwaterCoeff_File = crtm_irwater_coef, &
71                               MWwaterCoeff_File = crtm_mwwater_coef, &
72                               IRlandCoeff_File  = crtm_irland_coef,  &
73                               VISlandCoeff_File = crtm_visland_coef, &
74                               File_Path = File_Path) 
76      if ( Error_Status /= 0 ) then 
77        call da_error(__FILE__,__LINE__, &
78          (/"Error in initializing CRTM"/))
79      END IF
81      iv%instid(1:nsensor)%nlevels = kme-kms+1
83      if (print_detail_rad) then
84         do n = 1, nsensor
85            write (message(1),*) 'in da_crtm_init: ChannelInfo content'
86            write (message(2),*) 'Sensor_Index ',ChannelInfo(n)%Sensor_Index
87            write (message(3),*) 'n_channels ',ChannelInfo(n)%n_channels
88            write (message(4),*) 'Channel_Index ',ChannelInfo(n)%Channel_Index(:)
89            write (message(5),*) 'Sensor_Channel ',ChannelInfo(n)%Sensor_Channel(:)
90            write (message(6),*) 'Sensor_ID ',ChannelInfo(n)%Sensor_ID
91            write (message(7),*) 'WMO_Satellite_ID ',ChannelInfo(n)%WMO_Satellite_ID
92            write (message(8),*) 'WMO_Sensor_ID ',ChannelInfo(n)%WMO_Sensor_ID
93            call da_message(message(1:8))
94        end do
95     end if
97   call da_trace_exit("da_crtm_init")
99 end subroutine da_crtm_init