Go to the documentation of this file.
39 private :: cnvuser_write
45 character(len=H_SHORT),
private :: CNVUSER_FILE_TYPE =
''
49 character(len=H_SHORT),
private :: CNVUSER_INTERP_TYPE =
'LINEAR'
50 integer,
private :: CNVUSER_INTERP_LEVEL = 5
52 character(len=H_LONG),
private :: CNVUSER_OUT_BASENAME =
''
53 character(len=H_MID),
private :: CNVUSER_OUT_TITLE =
'SCALE-RM User Boundary'
54 character(len=H_SHORT),
private :: CNVUSER_OUT_VARNAME =
''
55 character(len=H_MID),
private :: CNVUSER_OUT_VARDESC =
''
56 character(len=H_SHORT),
private :: CNVUSER_OUT_VARUNIT =
''
57 character(len=H_SHORT),
private :: CNVUSER_OUT_DTYPE =
'DEFAULT'
58 real(DP),
private :: CNVUSER_OUT_DT = -1_dp
59 logical,
private :: CNVUSER_OUT_AGGREGATE
61 integer,
private :: CNVUSER_NSTEPS = 1
64 integer ,
private :: nLEV, nLON, nLAT
65 integer,
private :: itp_lev
66 logical,
private :: zonal, pole
68 integer,
private,
allocatable :: idx_i (:,:,:)
69 integer,
private,
allocatable :: idx_j (:,:,:)
70 real(RP),
private,
allocatable :: hfact (:,:,:)
71 integer,
private,
allocatable :: idx_k (:,:,:,:,:)
72 real(RP),
private,
allocatable :: vfact (:,:,:,:)
73 real(RP),
private,
allocatable :: data_org (:,:,:)
74 real(RP),
private,
allocatable :: X_org (:,:)
75 real(RP),
private,
allocatable :: Y_org (:,:)
76 real(RP),
private,
allocatable :: LAT_org (:,:)
77 real(RP),
private,
allocatable :: LON_org (:,:)
78 real(RP),
private,
allocatable :: LEV_org (:,:,:)
79 real(RP),
private,
allocatable :: LAT_1d (:)
80 real(RP),
private,
allocatable :: LON_1d (:)
81 real(RP),
private,
allocatable :: LEV_1d (:)
84 character(len=H_SHORT),
private :: CNVUSER_TILE_DTYPE =
'real4'
85 real(RP),
private :: CNVUSER_TILE_DLAT
86 real(RP),
private :: CNVUSER_TILE_DLON
87 character(len=H_LONG),
private :: CNVUSER_TILE_DIR =
''
88 character(len=H_LONG),
private :: CNVUSER_TILE_CATALOGUE =
''
91 character(len=H_LONG),
private :: CNVUSER_GrADS_FILENAME =
''
92 character(len=H_SHORT),
private :: CNVUSER_GrADS_VARNAME =
''
93 character(len=H_SHORT),
private :: CNVUSER_GrADS_LATNAME =
'lat'
94 character(len=H_SHORT),
private :: CNVUSER_GrADS_LONNAME =
'lon'
95 character(len=H_SHORT),
private :: CNVUSER_GrADS_LEVNAME =
''
96 character(len=H_SHORT),
private :: CNVUSER_GrADS_HEIGHT_PLEV =
'HGT'
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'
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'
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, &
532 subroutine cnvuser_write( &
538 file_cartesc_write_var
541 integer,
intent(in) :: fid, vid
542 real(rp),
intent(in) :: var(
ia,
ja,1)
543 real(dp),
intent(in) :: timeintv
544 integer,
intent(in) :: istep
549 timeofs = ( istep - 1 ) * timeintv
550 call file_cartesc_write_var( fid, vid, &
552 cnvuser_out_varname, &
559 end subroutine cnvuser_write
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]
subroutine, public cnvuser_setup
Setup.
real(rp), public const_pi
pi
module Convert 2D user data
subroutine, public cnvuser
Driver.
module atmosphere / grid / cartesC index
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
integer, public io_fid_conf
Config file ID.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local