SCALE-RM
Data Types | Functions/Subroutines
mod_cnvuser Module Reference

module Convert 2D user data More...

Functions/Subroutines

subroutine, public cnvuser_setup
 Setup. More...
 
subroutine, public cnvuser
 Driver. More...
 

Detailed Description

module Convert 2D user data

Description
subroutines for preparing 2D data
Author
Team SCALE
NAMELIST
  • PARAM_CNVUSER
    nametypedefault valuecomment
    CNVUSER_FILE_TYPE character(len=H_SHORT)
    CNVUSER_NSTEPS integer
    CNVUSER_INTERP_TYPE character(len=H_SHORT)
    CNVUSER_INTERP_LEVEL integer
    CNVUSER_TILE_DTYPE character(len=H_SHORT)
    CNVUSER_TILE_DLAT real(RP)
    CNVUSER_TILE_DLON real(RP)
    CNVUSER_TILE_DIR character(len=H_LONG)
    CNVUSER_TILE_CATALOGUE character(len=H_LONG)
    CNVUSER_GRADS_FILENAME character(len=H_LONG)
    CNVUSER_GRADS_VARNAME character(len=H_SHORT)
    CNVUSER_GRADS_LATNAME character(len=H_SHORT)
    CNVUSER_GRADS_LONNAME character(len=H_SHORT)
    CNVUSER_GRADS_LEVNAME character(len=H_SHORT)
    CNVUSER_GRADS_HEIGHT_PLEV character(len=H_SHORT)
    CNVUSER_OUT_BASENAME character(len=H_LONG)
    CNVUSER_OUT_TITLE character(len=H_MID)
    CNVUSER_OUT_VARNAME character(len=H_SHORT)
    CNVUSER_OUT_VARDESC character(len=H_MID)
    CNVUSER_OUT_VARUNIT character(len=H_SHORT)
    CNVUSER_OUT_DTYPE character(len=H_SHORT)
    CNVUSER_OUT_DT real(DP)

History Output
No history output

Function/Subroutine Documentation

◆ cnvuser_setup()

subroutine, public mod_cnvuser::cnvuser_setup

Setup.

Definition at line 109 of file mod_cnvuser.F90.

109  use scale_file, only: &
111 
112  character(len=H_SHORT) :: CNVUSER_FILE_TYPE
113  character(len=H_SHORT) :: CNVUSER_INTERP_TYPE
114  integer :: CNVUSER_INTERP_LEVEL
115 
116  character(len=H_LONG) :: CNVUSER_OUT_BASENAME
117  character(len=H_MID) :: CNVUSER_OUT_TITLE
118  character(len=H_SHORT) :: CNVUSER_OUT_VARNAME
119  character(len=H_MID) :: CNVUSER_OUT_VARDESC
120  character(len=H_SHORT) :: CNVUSER_OUT_VARUNIT
121  character(len=H_SHORT) :: CNVUSER_OUT_DTYPE
122  real(DP) :: CNVUSER_OUT_DT
123 
124  integer :: CNVUSER_NSTEPS
125 
126  ! TILE data
127  character(len=H_SHORT) :: CNVUSER_TILE_DTYPE
128  real(RP) :: CNVUSER_TILE_DLAT
129  real(RP) :: CNVUSER_TILE_DLON
130  character(len=H_LONG) :: CNVUSER_TILE_DIR
131  character(len=H_LONG) :: CNVUSER_TILE_CATALOGUE
132 
133  ! GrADS data
134  character(len=H_LONG) :: CNVUSER_GrADS_FILENAME
135  character(len=H_SHORT) :: CNVUSER_GrADS_VARNAME
136  character(len=H_SHORT) :: CNVUSER_GrADS_LATNAME
137  character(len=H_SHORT) :: CNVUSER_GrADS_LONNAME
138  character(len=H_SHORT) :: CNVUSER_GrADS_LEVNAME
139  character(len=H_SHORT) :: CNVUSER_GrADS_HEIGHT_PLEV
140 
141  namelist / param_cnvuser / &
142  cnvuser_file_type, &
143  cnvuser_nsteps, &
144  cnvuser_interp_type, &
145  cnvuser_interp_level, &
146  cnvuser_tile_dtype, &
147  cnvuser_tile_dlat, &
148  cnvuser_tile_dlon, &
149  cnvuser_tile_dir, &
150  cnvuser_tile_catalogue, &
151  cnvuser_grads_filename, &
152  cnvuser_grads_varname, &
153  cnvuser_grads_latname, &
154  cnvuser_grads_lonname, &
155  cnvuser_grads_levname, &
156  cnvuser_grads_height_plev, &
157  cnvuser_out_basename, &
158  cnvuser_out_title, &
159  cnvuser_out_varname, &
160  cnvuser_out_vardesc, &
161  cnvuser_out_varunit, &
162  cnvuser_out_dtype, &
163  cnvuser_out_dt
164 
165  integer :: ierr, n_vars
166  !---------------------------------------------------------------------------
167 
168  log_newline
169  log_info("CNVUSER_setup",*) 'Setup'
170 
171  cnvuser_out_aggregate = file_aggregate
172 
173  !--- read namelist
174  rewind(io_fid_conf)
175  n_vars = 0
176  do
177  cnvuser_file_type = ''
178  read(io_fid_conf,nml=param_cnvuser,iostat=ierr)
179  if( ierr < 0 ) then !--- missing
180  exit
181  elseif( ierr > 0 ) then !--- fatal error
182  log_error("CNVUSER_setup",*) 'Not appropriate names in namelist PARAM_CNVUSER. Check!'
183  call prc_abort
184  endif
185  if (cnvuser_file_type == "") cycle
186  n_vars = n_vars + 1
187  end do
188 
189  allocate(params(n_vars))
190  rewind(io_fid_conf)
191  n_vars = 0
192  do
193  ! Default value
194  cnvuser_file_type = ''
195  cnvuser_interp_type = 'LINEAR'
196  cnvuser_interp_level = 5
197 
198  cnvuser_out_basename = ''
199  cnvuser_out_title = 'SCALE-RM User Boundary'
200  cnvuser_out_varname = ''
201  cnvuser_out_vardesc = ''
202  cnvuser_out_varunit = ''
203  cnvuser_out_dtype = 'DEFAULT'
204  cnvuser_out_dt = -1_dp
205 
206  cnvuser_nsteps = 1
207 
208 
209  cnvuser_tile_dtype = 'real4'
210  cnvuser_tile_dlat = -1
211  cnvuser_tile_dlon = -1
212  cnvuser_tile_dir = ''
213  cnvuser_tile_catalogue = ''
214 
215 
216  cnvuser_grads_filename = ''
217  cnvuser_grads_varname = ''
218  cnvuser_grads_latname = 'lat'
219  cnvuser_grads_lonname = 'lon'
220  cnvuser_grads_levname = ''
221  cnvuser_grads_height_plev = 'HGT'
222 
223  read(io_fid_conf,nml=param_cnvuser,iostat=ierr)
224  if( ierr /= 0 ) exit
225  log_nml(param_cnvuser)
226  if (cnvuser_file_type == "") cycle
227 
228  n_vars = n_vars + 1
229 
230  select case (cnvuser_file_type)
231  case ("TILE")
232  allocate(t_tile::params(n_vars)%param)
233  case ("GrADS")
234  allocate(t_grads::params(n_vars)%param)
235  case ("GrADS-3D")
236  allocate(t_grads_3d::params(n_vars)%param)
237  case default
238  log_error('CNVUSER_setup',*) 'CNVUSER_FILE_TYPE is invalid: ', cnvuser_file_type
239  log_error_cont(*) 'It must be "TILE" or "GrADS".'
240  call prc_abort
241  end select
242 
243  associate(param => params(n_vars)%param)
244  param%INTERP_TYPE = cnvuser_interp_type
245  param%INTERP_LEVEL = cnvuser_interp_level
246  param%OUT_BASENAME = cnvuser_out_basename
247  param%OUT_TITLE = cnvuser_out_title
248  param%OUT_VARNAME = cnvuser_out_varname
249  param%OUT_VARDESC = cnvuser_out_vardesc
250  param%OUT_VARUNIT = cnvuser_out_varunit
251  param%OUT_DTYPE = cnvuser_out_dtype
252  param%OUT_DT = cnvuser_out_dt
253  param%NSTEPS = cnvuser_nsteps
254  end associate
255 
256  select type (param => params(n_vars)%param)
257  type is (t_tile)
258  param%TILE_DTYPE = cnvuser_tile_dtype
259  param%TILE_DLAT = cnvuser_tile_dlat
260  param%TILE_DLON = cnvuser_tile_dlon
261  param%TILE_DIR = cnvuser_tile_dir
262  param%TILE_CATALOGUE = cnvuser_tile_catalogue
263  type is (t_grads)
264  param%GrADS_FILENAME = cnvuser_grads_filename
265  param%GrADS_VARNAME = cnvuser_grads_varname
266  param%GrADS_LATNAME = cnvuser_grads_latname
267  param%GrADS_LONNAME = cnvuser_grads_lonname
268  if ( param%OUT_VARNAME == '' ) param%OUT_VARNAME = param%GrADS_VARNAME
269  type is (t_grads_3d)
270  param%GrADS_FILENAME = cnvuser_grads_filename
271  param%GrADS_VARNAME = cnvuser_grads_varname
272  param%GrADS_LATNAME = cnvuser_grads_latname
273  param%GrADS_LONNAME = cnvuser_grads_lonname
274  param%GrADS_LEVNAME = cnvuser_grads_levname
275  param%GrADS_HEIGHT_PLEV = cnvuser_grads_height_plev
276  if ( param%OUT_VARNAME == '' ) param%OUT_VARNAME = param%GrADS_VARNAME
277  end select
278  end do
279 

References scale_file::file_aggregate, scale_io::io_fid_conf, and scale_prc::prc_abort().

Referenced by mod_convert::convert_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnvuser()

subroutine, public mod_cnvuser::cnvuser

Driver.

Definition at line 285 of file mod_cnvuser.F90.

285  integer :: i
286  !---------------------------------------------------------------------------
287 
288  do i = 1, size(params)
289  associate(param => params(i)%param)
290  if ( param%OUT_BASENAME == '' .or. param%OUT_VARNAME == '' ) then
291  log_error('CNVUSER',*) 'CNVUSER_OUT_BASENAME and CNVUSER_OUT_VARNAME are required'
292  call prc_abort
293  end if
294 
295  select type (param)
296  type is (t_tile)
297  call cnvuser_prepare_tile(param)
298  call cnvuser_execute_tile_grads(param)
299  type is (t_grads)
300  call cnvuser_prepare_grads(param)
301  call cnvuser_execute_tile_grads(param)
302  type is (t_grads_3d)
303  call cnvuser_prepare_grads_3d(param)
304  call cnvuser_execute_grads_3d(param)
305  end select
306 
307  end associate
308  end do
309 

References scale_atmos_grid_cartesc::atmos_grid_cartesc_cx, scale_atmos_grid_cartesc::atmos_grid_cartesc_cy, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_cz, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lat, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lon, mod_cnv2d::cnv2d_exec(), mod_cnv2d::cnv2d_grads_init(), mod_cnv2d::cnv2d_tile_init(), scale_const::const_d2r, scale_const::const_pi, scale_file_cartesc::file_cartesc_close(), scale_file_cartesc::file_cartesc_create(), scale_file_cartesc::file_cartesc_def_var(), scale_file_cartesc::file_cartesc_enddef(), scale_file_grads::file_grads_isoned(), scale_file_grads::file_grads_open(), scale_file_grads::file_grads_varid(), scale_interp::interp_factor3d_linear_xy(), scale_interp::interp_factor3d_weight(), scale_interp::interp_interp3d(), and scale_time::time_nowdate.

Referenced by mod_convert::convert().

Here is the call graph for this function:
Here is the caller graph for this function:
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_file
module file
Definition: scale_file.F90:15
scale_file::file_aggregate
logical, public file_aggregate
Definition: scale_file.F90:196