module Convert 2D user data
More...
module Convert 2D user data
- Description
- subroutines for preparing 2D data
- Author
- Team SCALE
- NAMELIST
-
PARAM_CNVUSER
name | type | default value | comment |
CNVUSER_FILE_TYPE | character(len=H_SHORT) | '' ! '' : do nothing | |
CNVUSER_NSTEPS | integer | 1 | # of time steps |
CNVUSER_INTERP_TYPE | character(len=H_SHORT) | 'LINEAR' | |
CNVUSER_INTERP_LEVEL | integer | 5 | |
CNVUSER_TILE_DTYPE | character(len=H_SHORT) | 'real4' | data type in the tiled data |
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) | 'lat' | |
CNVUSER_GRADS_LONNAME | character(len=H_SHORT) | 'lon' | |
CNVUSER_GRADS_LEVNAME | character(len=H_SHORT) | '' | |
CNVUSER_GRADS_HEIGHT_PLEV | character(len=H_SHORT) | 'HGT' | |
CNVUSER_OUT_BASENAME | character(len=H_LONG) | '' | basename of the output file |
CNVUSER_OUT_TITLE | character(len=H_MID) | 'SCALE-RM User Boundary' | title of the output file |
CNVUSER_OUT_VARNAME | character(len=H_SHORT) | '' | name of the variable |
CNVUSER_OUT_VARDESC | character(len=H_MID) | '' | title of the variable |
CNVUSER_OUT_VARUNIT | character(len=H_SHORT) | '' | units of the variable |
CNVUSER_OUT_DTYPE | character(len=H_SHORT) | 'DEFAULT' | REAL4 or REAL8 |
CNVUSER_OUT_DT | real(DP) | -1_DP | sec |
- History Output
- No history output
◆ cnvuser_setup()
subroutine, public mod_cnvuser::cnvuser_setup |
Setup.
Definition at line 103 of file mod_cnvuser.F90.
112 file_grads_get_shape, &
123 mapprojection_lonlat2xy
136 namelist / param_cnvuser / &
139 cnvuser_interp_type, &
140 cnvuser_interp_level, &
141 cnvuser_tile_dtype, &
145 cnvuser_tile_catalogue, &
146 cnvuser_grads_filename, &
147 cnvuser_grads_varname, &
148 cnvuser_grads_latname, &
149 cnvuser_grads_lonname, &
150 cnvuser_grads_levname, &
151 cnvuser_grads_height_plev, &
152 cnvuser_out_basename, &
154 cnvuser_out_varname, &
155 cnvuser_out_vardesc, &
156 cnvuser_out_varunit, &
161 integer :: file_id, var_id
163 integer :: data_shape(3)
167 log_info(
"CNVUSER_setup",*)
'Setup'
173 read(io_fid_conf,nml=param_cnvuser,iostat=ierr)
175 log_info(
"CNVUSER_setup",*)
'Not found namelist. Default used.'
176 elseif( ierr > 0 )
then
177 log_error(
"CNVUSER_setup",*)
'Not appropriate names in namelist PARAM_CNVUSER. Check!'
180 log_nml(param_cnvuser)
182 select case ( cnvuser_file_type )
187 cnvuser_tile_dlat, cnvuser_tile_dlon, &
189 cnvuser_tile_catalogue, &
190 cnvuser_interp_type, &
191 interp_level = cnvuser_interp_level )
194 cnvuser_grads_varname, &
195 cnvuser_grads_latname, &
196 cnvuser_grads_lonname, &
197 cnvuser_interp_type, &
198 interp_level = cnvuser_interp_level )
199 if ( cnvuser_out_varname ==
'' ) cnvuser_out_varname = cnvuser_grads_varname
204 call file_grads_get_shape( file_id, &
205 cnvuser_grads_varname, &
212 select case ( trim(cnvuser_interp_type) )
214 cnvuser_interp_level = 4
215 case (
'DIST-WEIGHT' )
219 allocate( idx_i( ia,ja,cnvuser_interp_level) )
220 allocate( idx_j( ia,ja,cnvuser_interp_level) )
221 allocate( hfact( ia,ja,cnvuser_interp_level) )
222 allocate( idx_k(ka,2,ia,ja,cnvuser_interp_level) )
223 allocate( vfact(ka, ia,ja,cnvuser_interp_level) )
225 allocate( data_org( nlev, nlon, nlat ) )
226 allocate( x_org( nlon, nlat ) )
227 allocate( y_org( nlon, nlat ) )
228 allocate( lat_org( nlon, nlat ) )
229 allocate( lon_org( nlon, nlat ) )
230 allocate( lev_org( nlev, nlon, nlat ) )
231 allocate( lat_1d( nlat ) )
232 allocate( lon_1d( nlon ) )
233 allocate( lev_1d( nlev ) )
237 cnvuser_grads_latname, &
241 call file_grads_read( file_id, &
248 lat_org(i,j) = lat_1d(j) * d2r
252 call file_grads_read( file_id, &
259 lat_org(i,j) = lat_org(i,j) * d2r
266 cnvuser_grads_lonname, &
270 call file_grads_read( file_id, &
277 lon_org(i,j) = lon_1d(i) * d2r
281 call file_grads_read( file_id, &
288 lon_org(i,j) = lon_org(i,j) * d2r
294 select case ( trim(cnvuser_grads_levname) )
297 cnvuser_grads_levname, &
300 call file_grads_read( file_id, &
308 lev_org(k,i,j) = lev_1d(k)
314 cnvuser_grads_height_plev, &
317 call file_grads_read( file_id, &
321 log_error(
"CNVUSER_setup",*)
'Invalid proparty in CNVUSER_GrADS_LEVNAME: ', trim(cnvuser_grads_levname)
327 cnvuser_grads_varname, &
330 select case ( cnvuser_interp_type )
332 call mapprojection_lonlat2xy( nlon, 1, nlon, &
339 zonal = ( maxval(lon_org(:,:)) - minval(lat_org(:,:)) ) > 2.0_rp * pi * 0.9_rp
340 pole = ( maxval(lat_org(:,:)) > pi * 0.5_rp * 0.9_rp ) .or. ( minval(lat_org(:,:)) < - pi * 0.5_rp * 0.9_rp )
359 case (
'DIST-WEIGHT' )
378 if ( cnvuser_out_varname ==
'' ) cnvuser_out_varname = cnvuser_grads_varname
380 log_error(
'CNVUSER_setup',*)
'CNVUSER_FILE_TYPE is invalid: ', trim(cnvuser_file_type)
381 log_error_cont(*)
'It must be "TILE" or "GrADS".'
385 if ( cnvuser_file_type .ne.
'' )
then
386 if ( cnvuser_out_basename ==
'' .or. cnvuser_out_varname ==
'' )
then
387 log_error(
'CNVUSER_setup',*)
'CNVUSER_OUT_BASENAME and CNVUSER_OUT_VARNAME are required'
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_grads_init(), mod_cnv2d::cnv2d_tile_init(), scale_const::const_d2r, scale_const::const_pi, scale_file::file_aggregate, scale_file_grads::file_grads_isoned(), scale_file_grads::file_grads_open(), scale_file_grads::file_grads_varid(), scale_atmos_grid_cartesc_index::ia, scale_interp::interp_factor2d_linear_latlon(), scale_interp::interp_factor2d_linear_xy(), scale_interp::interp_factor2d_weight(), scale_interp::interp_factor3d_linear_xy(), scale_interp::interp_factor3d_weight(), scale_io::io_fid_conf, scale_atmos_grid_cartesc_index::ja, scale_tracer::k, scale_atmos_grid_cartesc_index::ka, and scale_prc::prc_abort().
Referenced by mod_convert::convert_setup().
◆ cnvuser()
subroutine, public mod_cnvuser::cnvuser |
Driver.
Definition at line 398 of file mod_cnvuser.F90.
401 file_cartesc_write_var, &
418 real(RP) :: var(IA,JA)
419 real(RP) :: var_3D(KA,IA,JA,1)
424 integer :: file_id, var_id
428 select case ( cnvuser_file_type )
429 case (
'TILE',
'GrADS' )
436 haszcoord = .false., &
437 aggregate = cnvuser_out_aggregate )
440 cnvuser_out_varname, &
441 cnvuser_out_vardesc, &
442 cnvuser_out_varunit, &
446 timeintv = cnvuser_out_dt, &
447 nsteps = cnvuser_nsteps )
451 do step = 1, cnvuser_nsteps
452 log_progress(*)
'step = ', step
456 call cnvuser_write( fid, vid, var(:,:), cnvuser_out_dt, step )
469 haszcoord = .true., &
470 aggregate = cnvuser_out_aggregate )
473 cnvuser_out_varname, &
474 cnvuser_out_vardesc, &
475 cnvuser_out_varunit, &
479 timeintv = cnvuser_out_dt, &
480 nsteps = cnvuser_nsteps )
488 cnvuser_grads_varname, &
491 do step = 1, cnvuser_nsteps
492 log_progress(*)
'step = ', step
493 timeofs = ( step - 1 ) * cnvuser_out_dt
495 call file_grads_read( file_id, var_id, &
514 call file_cartesc_write_var( fid, vid, &
516 cnvuser_out_varname, &
References scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_cz, mod_cnv2d::cnv2d_exec(), 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_open(), scale_file_grads::file_grads_varid(), scale_atmos_grid_cartesc_index::ia, scale_interp::interp_interp3d(), scale_atmos_grid_cartesc_index::ja, scale_atmos_grid_cartesc_index::ka, and scale_time::time_nowdate.
Referenced by mod_convert::convert().
subroutine, public cnv2d_grads_init(FILE_NAME, VAR_NAME, LAT_NAME, LON_NAME, interp_type, interp_level, search_limit, POSTFIX)
subroutine, public prc_abort
Abort Process.
logical function, public file_grads_isoned(file_id, var_id)
subroutine, public file_grads_open(file_name, file_id)
Open.
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_cz
geopotential height [m] (zxy)
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
subroutine, public file_cartesc_def_var(fid, varname, desc, unit, dim_type, datatype, vid, standard_name, timeintv, nsteps, cell_measures)
Define a variable to file.
subroutine, public interp_factor2d_weight(npoints, IA_ref, JA_ref, IA, JA, lon_ref, lat_ref, lon, lat, idx_i, idx_j, hfact, search_limit, latlon_structure, lon_1d, lat_1d, weight_order)
subroutine, public file_grads_varid(file_id, var_name, var_id)
module Atmosphere GRID CartesC Real(real space)
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lon
longitude [rad,0-2pi]
real(rp), public const_pi
pi
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
subroutine, public interp_factor3d_linear_xy(KA_ref, KS_ref, KE_ref, IA_ref, JA_ref, KA, KS, KE, IA, JA, x_ref, y_ref, hgt_ref, x, y, hgt, idx_i, idx_j, hfact, idx_k, vfact, flag_extrap, zonal, pole)
subroutine, public cnv2d_exec(var, step, min_value, yrevers)
subroutine, public interp_interp3d(npoints, KA_ref, KS_ref, KE_ref, IA_ref, JA_ref, KA, KS, KE, IA, JA, idx_i, idx_j, hfact, idx_k, vfact, hgt_ref, hgt, val_ref, val, spline, logwgt, threshold_undef, wsum, val2)
logical, public file_aggregate
subroutine, public file_cartesc_create(basename, title, datatype, fid, date, subsec, haszcoord, append, aggregate, single)
Create/open a netCDF file.
subroutine, public cnv2d_tile_init(dtype, dlat, dlon, dir, catalogue, interp_type, interp_level, nmax)
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local
subroutine, public interp_factor2d_linear_latlon(IA_ref, JA_ref, IA, JA, lon_ref, lat_ref, lon, lat, idx_i, idx_j, hfact)
subroutine, public interp_factor2d_linear_xy(IA_ref, JA_ref, IA, JA, x_ref, y_ref, x, y, idx_i, idx_j, hfact, zonal, pole)
subroutine, public interp_factor3d_weight(npoints, KA_ref, KS_ref, KE_ref, IA_ref, JA_ref, KA, KS, KE, IA, JA, lon_ref, lat_ref, hgt_ref, lon, lat, hgt, idx_i, idx_j, hfact, idx_k, vfact, flag_extrap)
real(rp), public const_d2r
degree to radian
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lat
latitude [rad,-pi,pi]
module atmosphere / grid / cartesC
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local