27 module horiz_interp_type_mod
31 use mpp_mod,
only : comm_tag_1, comm_tag_2
32 use platform_mod,
only: r4_kind, r8_kind
39 integer,
parameter :: CONSERVE = 1
49 interface assignment(=)
57 module procedure stats_r4
58 module procedure stats_r8
66 real(kind=r8_kind),
dimension(:,:),
allocatable :: faci
68 real(kind=r8_kind),
dimension(:,:),
allocatable :: facj
70 real(kind=r8_kind),
dimension(:,:),
allocatable :: area_src
72 real(kind=r8_kind),
dimension(:,:),
allocatable :: area_dst
74 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: wti
76 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: wtj
78 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: src_dist
80 real(kind=r8_kind),
dimension(:,:),
allocatable :: rat_x
82 real(kind=r8_kind),
dimension(:,:),
allocatable :: rat_y
84 real(kind=r8_kind),
dimension(:),
allocatable :: lon_in
86 real(kind=r8_kind),
dimension(:),
allocatable :: lat_in
88 real(kind=r8_kind),
dimension(:),
allocatable :: area_frac_dst
90 real(kind=r8_kind),
dimension(:,:),
allocatable :: mask_in
92 real(kind=r8_kind) :: max_src_dist
94 logical :: is_allocated = .false.
103 real(kind=r4_kind),
dimension(:,:),
allocatable :: faci
105 real(kind=r4_kind),
dimension(:,:),
allocatable :: facj
107 real(kind=r4_kind),
dimension(:,:),
allocatable :: area_src
109 real(kind=r4_kind),
dimension(:,:),
allocatable :: area_dst
111 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: wti
113 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: wtj
115 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: src_dist
117 real(kind=r4_kind),
dimension(:,:),
allocatable :: rat_x
119 real(kind=r4_kind),
dimension(:,:),
allocatable :: rat_y
121 real(kind=r4_kind),
dimension(:),
allocatable :: lon_in
123 real(kind=r4_kind),
dimension(:),
allocatable :: lat_in
125 real(kind=r4_kind),
dimension(:),
allocatable :: area_frac_dst
127 real(kind=r4_kind),
dimension(:,:),
allocatable :: mask_in
129 real(kind=r4_kind) :: max_src_dist
131 logical :: is_allocated = .false.
142 integer,
dimension(:,:),
allocatable :: ilon
144 integer,
dimension(:,:),
allocatable :: jlat
146 integer,
dimension(:,:,:),
allocatable :: i_lon
148 integer,
dimension(:,:,:),
allocatable :: j_lat
150 logical,
dimension(:,:),
allocatable :: found_neighbors
152 integer,
dimension(:,:),
allocatable :: num_found
162 integer :: interp_method
164 logical :: i_am_initialized=.false.
170 integer,
dimension(:),
allocatable :: i_src
172 integer,
dimension(:),
allocatable :: j_src
174 integer,
dimension(:),
allocatable :: i_dst
176 integer,
dimension(:),
allocatable :: j_dst
198 if(.not.horiz_interp_in%I_am_initialized)
then
199 call mpp_error(fatal,
'horiz_interp_type_eq: horiz_interp_type variable on right hand side is unassigned')
202 if(
allocated(horiz_interp_in%ilon )) &
203 horiz_interp_out%ilon = horiz_interp_in%ilon
205 if(
allocated(horiz_interp_in%jlat )) &
206 horiz_interp_out%jlat = horiz_interp_in%jlat
208 if(
allocated(horiz_interp_in%i_lon )) &
209 horiz_interp_out%i_lon = horiz_interp_in%i_lon
211 if(
allocated(horiz_interp_in%j_lat )) &
212 horiz_interp_out%j_lat = horiz_interp_in%j_lat
214 if(
allocated(horiz_interp_in%found_neighbors )) &
215 horiz_interp_out%found_neighbors = horiz_interp_in%found_neighbors
217 if(
allocated(horiz_interp_in%num_found )) &
218 horiz_interp_out%num_found = horiz_interp_in%num_found
220 if(
allocated(horiz_interp_in%i_src )) &
221 horiz_interp_out%i_src = horiz_interp_in%i_src
223 if(
allocated(horiz_interp_in%j_src )) &
224 horiz_interp_out%j_src = horiz_interp_in%j_src
226 if(
allocated(horiz_interp_in%i_dst )) &
227 horiz_interp_out%i_dst = horiz_interp_in%i_dst
229 if(
allocated(horiz_interp_in%j_dst )) &
230 horiz_interp_out%j_dst = horiz_interp_in%j_dst
232 horiz_interp_out%nlon_src = horiz_interp_in%nlon_src
233 horiz_interp_out%nlat_src = horiz_interp_in%nlat_src
234 horiz_interp_out%nlon_dst = horiz_interp_in%nlon_dst
235 horiz_interp_out%nlat_dst = horiz_interp_in%nlat_dst
236 horiz_interp_out%interp_method = horiz_interp_in%interp_method
237 horiz_interp_out%I_am_initialized = .true.
239 if(horiz_interp_in%horizInterpReals8_type%is_allocated)
then
241 if(
allocated(horiz_interp_in%horizInterpReals8_type%faci)) &
242 horiz_interp_out%horizInterpReals8_type%faci = horiz_interp_in%horizInterpReals8_type%faci
244 if(
allocated( horiz_interp_in%horizInterpReals8_type%facj)) &
245 horiz_interp_out%horizInterpReals8_type%facj = horiz_interp_in%horizInterpReals8_type%facj
247 if(
allocated( horiz_interp_in%horizInterpReals8_type%area_src)) &
248 horiz_interp_out%horizInterpReals8_type%area_src = horiz_interp_in%horizInterpReals8_type%area_src
250 if(
allocated( horiz_interp_in%horizInterpReals8_type%area_dst)) &
251 horiz_interp_out%horizInterpReals8_type%area_dst = horiz_interp_in%horizInterpReals8_type%area_dst
253 if(
allocated( horiz_interp_in%horizInterpReals8_type%wti)) &
254 horiz_interp_out%horizInterpReals8_type%wti = horiz_interp_in%horizInterpReals8_type%wti
256 if(
allocated( horiz_interp_in%horizInterpReals8_type%wtj)) &
257 horiz_interp_out%horizInterpReals8_type%wtj = horiz_interp_in%horizInterpReals8_type%wtj
259 if(
allocated( horiz_interp_in%horizInterpReals8_type%src_dist)) &
260 horiz_interp_out%horizInterpReals8_type%src_dist = horiz_interp_in%horizInterpReals8_type%src_dist
262 if(
allocated( horiz_interp_in%horizInterpReals8_type%rat_x)) &
263 horiz_interp_out%horizInterpReals8_type%rat_x = horiz_interp_in%horizInterpReals8_type%rat_x
265 if(
allocated( horiz_interp_in%horizInterpReals8_type%rat_y)) &
266 horiz_interp_out%horizInterpReals8_type%rat_y = horiz_interp_in%horizInterpReals8_type%rat_y
268 if(
allocated( horiz_interp_in%horizInterpReals8_type%lon_in)) &
269 horiz_interp_out%horizInterpReals8_type%lon_in = horiz_interp_in%horizInterpReals8_type%lon_in
271 if(
allocated( horiz_interp_in%horizInterpReals8_type%lat_in)) &
272 horiz_interp_out%horizInterpReals8_type%lat_in = horiz_interp_in%horizInterpReals8_type%lat_in
274 if(
allocated( horiz_interp_in%horizInterpReals8_type%area_frac_dst)) &
275 horiz_interp_out%horizInterpReals8_type%area_frac_dst = horiz_interp_in%horizInterpReals8_type%area_frac_dst
277 horiz_interp_out%horizInterpReals8_type%max_src_dist = horiz_interp_in%horizInterpReals8_type%max_src_dist
279 horiz_interp_out%horizInterpReals8_type%is_allocated = .true.
281 if(
allocated(horiz_interp_in%horizInterpReals8_type%mask_in)) &
282 horiz_interp_out%horizInterpReals8_type%mask_in = horiz_interp_in%horizInterpReals8_type%mask_in
284 else if (horiz_interp_in%horizInterpReals4_type%is_allocated)
then
285 if(
allocated(horiz_interp_in%horizInterpReals4_type%faci)) &
286 horiz_interp_out%horizInterpReals4_type%faci = horiz_interp_in%horizInterpReals4_type%faci
288 if(
allocated( horiz_interp_in%horizInterpReals4_type%facj)) &
289 horiz_interp_out%horizInterpReals4_type%facj = horiz_interp_in%horizInterpReals4_type%facj
291 if(
allocated( horiz_interp_in%horizInterpReals4_type%area_src)) &
292 horiz_interp_out%horizInterpReals4_type%area_src = horiz_interp_in%horizInterpReals4_type%area_src
294 if(
allocated( horiz_interp_in%horizInterpReals4_type%area_dst)) &
295 horiz_interp_out%horizInterpReals4_type%area_dst = horiz_interp_in%horizInterpReals4_type%area_dst
297 if(
allocated( horiz_interp_in%horizInterpReals4_type%wti)) &
298 horiz_interp_out%horizInterpReals4_type%wti = horiz_interp_in%horizInterpReals4_type%wti
300 if(
allocated( horiz_interp_in%horizInterpReals4_type%wtj)) &
301 horiz_interp_out%horizInterpReals4_type%wtj = horiz_interp_in%horizInterpReals4_type%wtj
303 if(
allocated( horiz_interp_in%horizInterpReals4_type%src_dist)) &
304 horiz_interp_out%horizInterpReals4_type%src_dist = horiz_interp_in%horizInterpReals4_type%src_dist
306 if(
allocated( horiz_interp_in%horizInterpReals4_type%rat_x)) &
307 horiz_interp_out%horizInterpReals4_type%rat_x = horiz_interp_in%horizInterpReals4_type%rat_x
309 if(
allocated( horiz_interp_in%horizInterpReals4_type%rat_y)) &
310 horiz_interp_out%horizInterpReals4_type%rat_y = horiz_interp_in%horizInterpReals4_type%rat_y
312 if(
allocated( horiz_interp_in%horizInterpReals4_type%lon_in)) &
313 horiz_interp_out%horizInterpReals4_type%lon_in = horiz_interp_in%horizInterpReals4_type%lon_in
315 if(
allocated( horiz_interp_in%horizInterpReals4_type%lat_in)) &
316 horiz_interp_out%horizInterpReals4_type%lat_in = horiz_interp_in%horizInterpReals4_type%lat_in
318 if(
allocated( horiz_interp_in%horizInterpReals4_type%area_frac_dst)) &
319 horiz_interp_out%horizInterpReals4_type%area_frac_dst = horiz_interp_in%horizInterpReals4_type%area_frac_dst
321 horiz_interp_out%horizInterpReals4_type%max_src_dist = horiz_interp_in%horizInterpReals4_type%max_src_dist
323 horiz_interp_out%horizInterpReals4_type%is_allocated = .true.
325 if(
allocated(horiz_interp_in%horizInterpReals4_type%mask_in)) &
326 horiz_interp_out%horizInterpReals4_type%mask_in = horiz_interp_in%horizInterpReals4_type%mask_in
329 call mpp_error(fatal,
"horiz_interp_type_eq: cannot assign unallocated real values from horiz_interp_in")
332 if(horiz_interp_in%interp_method == conserve)
then
333 horiz_interp_out%version = horiz_interp_in%version
334 if(horiz_interp_in%version==2) horiz_interp_out%nxgrid = horiz_interp_in%nxgrid
340 #include "horiz_interp_type_r4.fh"
341 #include "horiz_interp_type_r8.fh"
343 end module horiz_interp_type_mod
integer, parameter, public bilinear
is an internally used parameter to mark bilinear interpolation
integer, parameter, public bicubic
is an internally used parameter to mark bicubic interpolation
integer, parameter, public spherical
is an internally used parameter to mark spherical interpolation
subroutine horiz_interp_type_eq(horiz_interp_out, horiz_interp_in)
Generic interfaces to compute statistics for bilinear and spherical interpolation Calls stats_r4 when...
Datatype holding interpolation weights, mapping indices, and metadata for horizontal interpolation....
Nested derived type in horiz_interp_type that holds 32-bit interpolation weights, and metadata....
Nested derived type in horiz_interp_type that holds 64-bit interpolation weights, and metadata....
subroutine mpp_sync_self(pelist, check, request, msg_size, msg_type)
This is to check if current PE's outstanding puts are complete but we can't use shmem_fence because w...
integer function mpp_npes()
Returns processor count for current pelist.
integer function mpp_pe()
Returns processor ID.
Receive data from another PE.
Send data to a receiving PE.