1 !NETCDF2KMA:DRIVER_LAYER:MAIN
6 use da_control
, only
: debug_level
10 USE module_driver_constants
20 USE module_netcdf2kma_interface
21 USE module_wave2grid_kma
27 TYPE (domain
) , POINTER :: keep_grid
, grid_ptr
, null_domain
28 TYPE (grid_config_rec_type
) :: config_flags
30 INTEGER :: domain_id
, fid
, oid
, idum1
, idum2
34 SUBROUTINE Setup_Timekeeping ( grid
)
36 TYPE(domain
), POINTER :: grid
37 END SUBROUTINE Setup_Timekeeping
43 INTEGER, PARAMETER :: configbuflen
= 4*8192
44 INTEGER :: configbuf( configbuflen
)
45 LOGICAL , EXTERNAL :: wrf_dm_on_monitor
48 !--Define the name of this program (program_name defined in module_domain)
50 program_name
= "NETCDF2KMA"
52 !--Get the NAMELIST data for input.
56 ! Initialize utilities (time manager, etc.)
57 call wrfu_initialize(defaultCalendar
=WRFU_CAL_GREGORIAN
)
61 IF ( wrf_dm_on_monitor() ) THEN
65 CALL get_config_as_buffer( configbuf
, configbuflen
, nbytes
)
66 CALL wrf_dm_bcast_bytes( configbuf
, nbytes
)
67 CALL set_config_as_buffer( configbuf
, configbuflen
)
68 CALL wrf_dm_initialize
75 ! CALL get_debug_level ( debug_level )
76 CALL nl_get_debug_level ( 1,debug_level
)
78 CALL set_wrf_debug_level ( debug_level
)
80 !--allocated and configure the mother domain
82 NULLIFY( null_domain
)
84 CALL wrf_debug ( 100 , 'wrf: calling alloc_and_configure_domain ' )
85 CALL alloc_and_configure_domain ( domain_id
= 1 , &
86 ! local_time = 0 , & !shc-wei
88 parent
= null_domain
, &
91 CALL wrf_debug ( 100 , 'wrf: calling model_to_grid_config_rec ' )
92 CALL model_to_grid_config_rec ( head_grid
%id
, model_config_rec
, config_flags
)
93 CALL wrf_debug ( 100 , 'wrf: calling set_scalar_indices_from_config ' )
94 CALL set_scalar_indices_from_config ( head_grid
%id
, idum1
, idum2
)
95 CALL wrf_debug ( 100 , 'wrf: calling init_wrfio' )
96 CALL Setup_Timekeeping ( head_grid
)
97 if(config_flags
%real_data_init_type
== 1 .or
. &
98 config_flags
%real_data_init_type
== 3) then
102 CALL get_config_as_buffer( configbuf
, configbuflen
, nbytes
)
103 CALL wrf_dm_bcast_bytes( configbuf
, nbytes
)
104 CALL set_config_as_buffer( configbuf
, configbuflen
)
108 call med_add_config_info_to_grid ( head_grid
)
111 !-- read input in netcdf format
112 CALL da_med_initialdata_input( head_grid
, config_flags
, 'rizvi_to_choose' )
114 !--write in grid-array in kma-ascii format
116 CALL wrf_debug ( 100 , 'da_3dvar: calling netcdf2kma_interface ' )
117 CALL netcdf2kma_interface ( head_grid
, config_flags
)
118 CALL wrf_debug ( 100 , 'da_3dvar: back from netcdf2kma_interface' )
120 CALL med_shutdown_io ( head_grid
, config_flags
)
123 IF ( wrf_dm_on_monitor() ) THEN
124 message(1) = 'Time elapsed in netcdf2kma'
125 CALL end_timing ( TRIM(message(1)) )
128 message(1) = 'Time elapsed in netcdf2kma'
129 CALL end_timing ( TRIM(message(1)) )
134 STOP "Stopped normally. in netcdf2kma"
136 END PROGRAM netcdf2kma