1 !KMA2NETCDF:DRIVER_LAYER:MAIN
6 use module_configure
, only
: grid_config_rec_type
7 use module_domain
, only
: domain
8 use da_control
, only
: debug_level
11 USE module_driver_constants
21 USE module_kma2netcdf_interface
22 USE module_kma_wave2grid
28 TYPE (domain
) , POINTER :: keep_grid
, grid_ptr
, null_domain
29 TYPE (grid_config_rec_type
) :: config_flags
31 INTEGER :: domain_id
, fid
, oid
, idum1
, idum2
35 INTEGER, PARAMETER :: configbuflen
= 4*8192
36 INTEGER :: configbuf( configbuflen
)
37 LOGICAL , EXTERNAL :: wrf_dm_on_monitor
42 SUBROUTINE Setup_Timekeeping ( grid
)
44 TYPE(domain
), POINTER :: grid
45 END SUBROUTINE Setup_Timekeeping
49 ! Definitions of dummy arguments to solve
51 !--Define the name of this program (program_name defined in module_domain)
53 program_name
= "KMA2NETCDF"
55 !--Get the NAMELIST data for input.
59 ! Initialize utilities (time manager, etc.)
60 call wrfu_initialize(defaultCalendar
=WRFU_CAL_GREGORIAN
)
63 #ifdef DM_PARALLEL
IF ( wrf_dm_on_monitor() ) THEN
64 IF ( wrf_dm_on_monitor() ) THEN
68 CALL get_config_as_buffer( configbuf
, configbuflen
, nbytes
)
69 CALL wrf_dm_bcast_bytes( configbuf
, nbytes
)
70 CALL set_config_as_buffer( configbuf
, configbuflen
)
71 CALL wrf_dm_initialize
78 ! CALL get_debug_level ( debug_level )
79 CALL nl_get_debug_level ( 1,debug_level
)
81 CALL set_wrf_debug_level ( debug_level
)
83 !--allocated and configure the mother domain
85 NULLIFY( null_domain
)
87 CALL wrf_debug ( 100 , 'wrf: calling alloc_and_configure_domain ' )
88 CALL alloc_and_configure_domain ( domain_id
= 1 , &
89 ! local_time = 0 , & !shc-wei
91 parent
= null_domain
, &
94 CALL wrf_debug ( 100 , 'wrf: calling model_to_grid_config_rec ' )
95 CALL model_to_grid_config_rec ( head_grid
%id
, model_config_rec
, config_flags
)
96 CALL wrf_debug ( 100 , 'wrf: calling set_scalar_indices_from_config ' )
97 CALL set_scalar_indices_from_config ( head_grid
%id
, idum1
, idum2
)
98 CALL wrf_debug ( 100 , 'wrf: calling init_wrfio' )
99 CALL Setup_Timekeeping ( head_grid
)
100 if(config_flags
%real_data_init_type
== 1 .or
. &
101 config_flags
%real_data_init_type
== 3) then
105 CALL get_config_as_buffer( configbuf
, configbuflen
, nbytes
)
106 CALL wrf_dm_bcast_bytes( configbuf
, nbytes
)
107 CALL set_config_as_buffer( configbuf
, configbuflen
)
110 call med_add_config_info_to_grid ( head_grid
)
112 !--read kma-ascii grid data and pack in grid-array
114 CALL wrf_debug ( 100 , 'kma2netcdf: calling kma2netcdf_interface ' )
116 CALL kma2netcdf_interface ( head_grid
, config_flags
)
118 CALL wrf_debug ( 100 , 'kma2netcdf: back from kma2netcdf_interface ' )
120 !--output 3dvar analysis
121 CALL da_med_initialdata_output( head_grid
, config_flags
)
123 CALL wrf_debug ( 100 , 'kma2netcdf: back from med_initialdata_output' )
125 CALL med_shutdown_io ( head_grid
, config_flags
)
128 IF ( wrf_dm_on_monitor() ) THEN
129 message(1) = 'Time elapsed in kma2netcdf'
130 CALL end_timing ( TRIM(message(1)) )
133 message(1) = 'Time elapsed in kma2netcdf'
134 CALL end_timing ( TRIM(message(1)) )
139 STOP "Stopped normally. in kma2netcdf"
141 END PROGRAM kma2netcdf