47 integer,
parameter :: I_TILE = 1
48 integer,
parameter :: I_GrADS = 2
49 integer :: CNV2D_ftype
54 real(RP),
allocatable :: data_org(:,:)
55 real(RP),
allocatable :: LAT_org (:,:)
56 real(RP),
allocatable :: LON_org (:,:)
57 real(RP),
allocatable :: LAT_1d (:)
58 real(RP),
allocatable :: LON_1d (:)
62 integer,
allocatable :: idx_i(:,:,:)
63 integer,
allocatable :: idx_j(:,:,:)
64 real(RP),
allocatable :: hfact(:,:,:)
65 logical :: zonal, pole
68 character(len=H_SHORT) :: CNV2D_tile_dtype
69 character(len=H_LONG) :: CNV2D_tile_dir
70 real(RP) :: TILE_DLAT, TILE_DLON
73 character(len=H_LONG),
allocatable :: TILE_fname(:)
74 logical,
allocatable :: TILE_hit (:)
75 integer,
allocatable :: TILE_JS (:)
76 integer,
allocatable :: TILE_JE (:)
77 integer,
allocatable :: TILE_IS (:)
78 integer,
allocatable :: TILE_IE (:)
80 integer :: dom_is, dom_ie, dom_js, dom_je
84 integer :: CNV2D_grads_fid
85 integer :: CNV2D_grads_vid
99 log_info(
"CNV2D_setup",*)
'Setup'
132 file_tiledata_get_data
137 character(len=*),
intent(in) :: dtype
138 real(rp),
intent(in) :: dlat, dlon
139 character(len=*),
intent(in) :: dir
140 character(len=*),
intent(in) :: catalogue
141 character(len=*),
intent(in) :: interp_type
143 integer,
intent(in),
optional :: interp_level
144 integer,
intent(in),
optional :: nmax
146 real(rp) :: domain_lats, domain_late
147 real(rp) :: domain_lons, domain_lone
149 character(len=H_LONG) :: fname
155 if (
present(nmax) )
then
161 domain_lats = minval( latxv(:,:) )
162 domain_late = maxval( latxv(:,:) )
163 domain_lons = minval( lonuy(:,:) )
164 domain_lone = maxval( lonuy(:,:) )
166 log_info(
"CNV2D_setup",*)
'Domain Information'
167 log_info_cont(*)
'Domain (LAT) :', domain_lats/d2r, domain_late/d2r
168 log_info_cont(*)
' (LON) :', domain_lons/d2r, domain_lone/d2r
170 tile_dlat = dlat * d2r
171 tile_dlon = dlon * d2r
173 if (
allocated(tile_fname))
deallocate(tile_fname)
174 if (
allocated(tile_hit))
deallocate(tile_hit)
175 if (
allocated(tile_js))
deallocate(tile_js)
176 if (
allocated(tile_je))
deallocate(tile_je)
177 if (
allocated(tile_is))
deallocate(tile_is)
178 if (
allocated(tile_ie))
deallocate(tile_ie)
179 if (
allocated(lat_1d))
deallocate(lat_1d)
180 if (
allocated(lon_1d))
deallocate(lon_1d)
182 allocate( tile_fname(tile_nlim), tile_hit(tile_nlim) )
183 allocate( tile_js(tile_nlim), tile_je(tile_nlim), tile_is(tile_nlim), tile_ie(tile_nlim) )
186 fname = trim(dir)//
'/'//trim(catalogue)
189 tile_dlat, tile_dlon, &
190 domain_lats, domain_late, domain_lons, domain_lone, &
194 tile_fname(:), tile_hit(:), &
195 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
196 nlat, nlon, dom_js, dom_je, dom_is, dom_ie, &
199 allocate( lat_1d(nlat) )
200 allocate( lon_1d(nlon) )
204 tile_dlat, tile_dlon, &
205 lat_1d(:), lon_1d(:) )
208 cnv2d_tile_dtype = dtype
211 call cnv2d_init( interp_type, &
212 interp_level = interp_level, &
230 file_grads_get_shape, &
237 character(len=*),
intent(in) :: file_name
238 character(len=*),
intent(in) :: var_name
239 character(len=*),
intent(in) :: lat_name
240 character(len=*),
intent(in) :: lon_name
241 character(len=*),
intent(in) :: interp_type
242 integer,
intent(in) :: interp_level
243 real(rp),
intent(in),
optional :: search_limit
244 character(len=*),
intent(in),
optional :: postfix
246 integer :: file_id, var_id
254 call file_grads_get_shape( file_id, var_name, &
259 if (
allocated(lat_org))
deallocate(lat_org)
260 if (
allocated(lon_org))
deallocate(lon_org)
261 if (
allocated(lat_1d))
deallocate(lat_1d)
262 if (
allocated(lon_1d))
deallocate(lon_1d)
263 allocate( lat_org(nlon,nlat), lon_org(nlon,nlat) )
264 allocate( lat_1d(nlat), lon_1d(nlon) )
270 call file_grads_read( file_id, var_id, &
275 lat_org(i,j) = lat_1d(j) * d2r
279 call file_grads_read( file_id, var_id, &
285 lat_org(i,j) = lat_org(i,j) * d2r
294 call file_grads_read( file_id, var_id, &
299 lon_org(i,j) = lon_1d(i) * d2r
303 call file_grads_read( file_id, var_id, &
309 lon_org(i,j) = lon_org(i,j) * d2r
317 cnv2d_ftype = i_grads
318 cnv2d_grads_fid = file_id
319 cnv2d_grads_vid = var_id
321 call cnv2d_init( interp_type, &
322 interp_level = interp_level, &
323 search_limit = search_limit, &
324 ll_struct = .false. )
335 file_tiledata_get_data
341 real(rp),
intent(out) :: var(
ia,
ja)
342 integer,
intent(in),
optional :: step
343 real(rp),
intent(in),
optional :: min_value
344 logical,
intent(in),
optional :: yrevers
346 select case ( cnv2d_ftype )
348 call file_tiledata_get_data( nlat, nlon, &
352 tile_dlat, tile_dlon, &
353 tile_fname(:), tile_hit(:), &
354 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
355 dom_js, dom_je, dom_is, dom_ie, &
359 min_value = min_value, yrevers = yrevers )
361 call file_grads_read( cnv2d_grads_fid, cnv2d_grads_vid, &
370 idx_i(:,:,:), idx_j(:,:,:), &
381 subroutine cnv2d_init( &
395 mapprojection_lonlat2xy
404 character(len=*),
intent(in) :: interp_type
405 integer,
intent(in),
optional :: interp_level
406 real(rp),
intent(in),
optional :: search_limit
407 logical,
intent(in),
optional :: ll_struct
409 real(rp),
allocatable :: x_org(:,:), y_org(:,:)
412 if (
allocated(idx_i))
deallocate(idx_i)
413 if (
allocated(idx_j))
deallocate(idx_j)
414 if (
allocated(hfact))
deallocate(hfact)
415 if (
allocated(data_org))
deallocate(data_org)
417 select case ( interp_type )
420 case (
'DIST-WEIGHT' )
421 if (
present(interp_level) )
then
422 itp_lev = interp_level
424 log_error(
'CNV2D_init',*)
'INTERP_LEVEL is required for the DIST-WEIGHT interpolation'
428 log_error(
'CNV2D_init',*)
'INTERP_TYPE is invalid: ', trim(interp_type)
433 allocate( idx_i(
ia,
ja,itp_lev) )
434 allocate( idx_j(
ia,
ja,itp_lev) )
435 allocate( hfact(
ia,
ja,itp_lev) )
437 select case ( interp_type )
439 if ( ll_struct )
then
442 lon_1d(:), lat_1d(:), &
443 lon(:,:), lat(:,:), &
444 idx_i(:,:,:), idx_j(:,:,:), &
447 allocate( x_org(nlon,nlat), y_org(nlon,nlat) )
448 call mapprojection_lonlat2xy( nlon, 1, nlon, nlat, 1, nlat, &
449 lon_org(:,:), lat_org(:,:), &
450 x_org(:,:), y_org(:,:) )
452 zonal = ( maxval(lon_org) - minval(lat_org) ) > 2.0_rp * pi * 0.9_rp
453 pole = ( maxval(lat_org) > pi * 0.5_rp * 0.9_rp ) .or. ( minval(lat_org) < - pi * 0.5_rp * 0.9_rp )
456 x_org(:,:), y_org(:,:), &
458 idx_i(:,:,:), idx_j(:,:,:), &
460 zonal = zonal, pole = pole, &
462 deallocate( x_org, y_org )
464 case (
'DIST-WEIGHT' )
468 lon_org(:,:), lat_org(:,:), &
469 lon(:,:), lat(:,:), &
470 idx_i(:,:,:), idx_j(:,:,:), &
472 latlon_structure = ll_struct, &
473 lon_1d = lon_1d(:), &
474 lat_1d = lat_1d(:), &
475 search_limit = search_limit )
478 allocate( data_org(nlon,nlat) )
481 end subroutine cnv2d_init
subroutine, public cnv2d_tile_init(dtype, dlat, dlon, dir, catalogue, interp_type, interp_level, nmax)
subroutine, public cnv2d_grads_init(FILE_NAME, VAR_NAME, LAT_NAME, LON_NAME, interp_type, interp_level, search_limit, POSTFIX)
subroutine, public cnv2d_setup
Setup.
subroutine, public cnv2d_exec(var, step, min_value, yrevers)
module atmosphere / grid / cartesC index
module Atmosphere GRID CartesC Real(real space)
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lat
latitude [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonuy
longitude at staggered point (uy) [rad,0-2pi]
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lon
longitude [rad,0-2pi]
module atmosphere / grid / cartesC
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local
real(rp), parameter, public const_pi
pi
real(rp), public const_undef
real(rp), public const_d2r
degree to radian
subroutine, public file_grads_open(file_name, file_id)
Open.
subroutine, public file_grads_varid(file_id, var_name, var_id)
logical function, public file_grads_isoned(file_id, var_id)
subroutine, public file_tiledata_get_info(TILE_nlim, TILE_DLAT, TILE_DLON, DOMAIN_LATS, DOMAIN_LATE, DOMAIN_LONS, DOMAIN_LONE, catalog_fname, GLOBAL_IA, TILE_nmax, TILE_fname, TILE_hit, TILE_JS, TILE_JE, TILE_IS, TILE_IE, nLATH, nLONH, jsh, jeh, ish, ieh, zonal, pole, single_fname, LATS, LATE, LONS, LONE)
get tile information
subroutine, public file_tiledata_get_latlon(nLAT, nLON, jsh, ish, TILE_DLAT, TILE_DLON, LAT, LON)
get tile data
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, missing)
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 interp_interp2d(npoints, IA_ref, JA_ref, IA, JA, idx_i, idx_j, hfact, val_ref, val, threshold_undef, wsum, val2)
subroutine, public prc_abort
Abort Process.