36 use mpp_mod,
only : mpp_pe, mpp_root_pe, mpp_npes
37 use mpp_mod,
only : comm_tag_1, comm_tag_2
52 interface assignment(=)
58 real,
dimension(:,:),
pointer :: faci =>null(), facj =>null()
59 integer,
dimension(:,:),
pointer :: ilon =>null(), jlat =>null()
60 real,
dimension(:,:),
pointer :: area_src =>null()
61 real,
dimension(:,:),
pointer :: area_dst =>null()
62 real,
dimension(:,:,:),
pointer :: wti =>null(),wtj =>null()
64 integer,
dimension(:,:,:),
pointer :: i_lon =>null(), j_lat =>null()
66 real,
dimension(:,:,:),
pointer :: src_dist =>null()
68 logical,
dimension(:,:),
pointer :: found_neighbors =>null()
71 integer,
dimension(:,:),
pointer :: num_found => null()
72 integer :: nlon_src, nlat_src
73 integer :: nlon_dst, nlat_dst
74 integer :: interp_method
79 real,
dimension(:,:),
pointer :: rat_x =>null(), rat_y =>null()
81 real,
dimension(:),
pointer :: lon_in =>null(), lat_in =>null()
82 logical :: i_am_initialized=.false.
86 integer,
dimension(:),
pointer :: i_src=>null(), j_src=>null()
87 integer,
dimension(:),
pointer :: i_dst=>null(), j_dst=>null()
88 real,
dimension(:),
pointer :: area_frac_dst=>null()
89 real,
dimension(:,:),
pointer :: mask_in=>null()
97 subroutine stats ( dat, low, high, avg, miss, missing_value, mask )
98 real,
intent(in) :: dat(:,:)
99 real,
intent(out) :: low, high, avg
100 integer,
intent(out) :: miss
101 real,
intent(in),
optional :: missing_value
102 real,
intent(in),
optional :: mask(:,:)
104 real :: dsum, npts, buffer_real(3)
105 integer :: pe, root_pe, npes, p, buffer_int(2)
108 root_pe = mpp_root_pe()
114 if (
present(missing_value))
then 115 miss = count(dat(:,:) == missing_value)
116 low = minval(dat(:,:), dat(:,:) /= missing_value)
117 high = maxval(dat(:,:), dat(:,:) /= missing_value)
118 dsum = sum(dat(:,:), dat(:,:) /= missing_value)
119 else if(
present(mask))
then 120 miss = count(mask(:,:) <= 0.5)
121 low = minval(dat(:,:),mask=mask(:,:) > 0.5)
122 high = maxval(dat(:,:),mask=mask(:,:) > 0.5)
123 dsum = sum(dat(:,:), mask=mask(:,:) > 0.5)
126 low = minval(dat(:,:))
127 high = maxval(dat(:,:))
132 npts =
size(dat(:,:)) - miss
133 if(pe == root_pe)
then 136 call mpp_recv(buffer_real(1),glen=3, from_pe=p+root_pe, tag=comm_tag_1)
137 dsum = dsum + buffer_real(1)
138 low =
min(low, buffer_real(2))
139 high =
max(high, buffer_real(3))
140 call mpp_recv(buffer_int(1), glen=2, from_pe=p+root_pe, tag=comm_tag_2)
141 miss = miss + buffer_int(1)
142 npts = npts + buffer_int(2)
145 print*,
'Warning: no points is valid' 147 avg = dsum/
real(npts)
150 buffer_real(1) = dsum
152 buffer_real(3) = high
154 call mpp_send(buffer_real(1),plen=3,to_pe=root_pe, tag=comm_tag_1)
157 call mpp_send(buffer_int(1), plen=2, to_pe=root_pe, tag=comm_tag_2)
168 type(horiz_interp_type),
intent(inout) :: horiz_interp_out
169 type(horiz_interp_type),
intent(in) :: horiz_interp_in
171 if(.not.horiz_interp_in%I_am_initialized)
then 172 call mpp_error(fatal,
'horiz_interp_type_eq: horiz_interp_type variable on right hand side is unassigned')
175 horiz_interp_out%faci => horiz_interp_in%faci
176 horiz_interp_out%facj => horiz_interp_in%facj
177 horiz_interp_out%ilon => horiz_interp_in%ilon
178 horiz_interp_out%jlat => horiz_interp_in%jlat
179 horiz_interp_out%area_src => horiz_interp_in%area_src
180 horiz_interp_out%area_dst => horiz_interp_in%area_dst
181 horiz_interp_out%wti => horiz_interp_in%wti
182 horiz_interp_out%wtj => horiz_interp_in%wtj
183 horiz_interp_out%i_lon => horiz_interp_in%i_lon
184 horiz_interp_out%j_lat => horiz_interp_in%j_lat
185 horiz_interp_out%src_dist => horiz_interp_in%src_dist
186 horiz_interp_out%found_neighbors => horiz_interp_in%found_neighbors
187 horiz_interp_out%max_src_dist = horiz_interp_in%max_src_dist
188 horiz_interp_out%num_found => horiz_interp_in%num_found
189 horiz_interp_out%nlon_src = horiz_interp_in%nlon_src
190 horiz_interp_out%nlat_src = horiz_interp_in%nlat_src
191 horiz_interp_out%nlon_dst = horiz_interp_in%nlon_dst
192 horiz_interp_out%nlat_dst = horiz_interp_in%nlat_dst
193 horiz_interp_out%interp_method = horiz_interp_in%interp_method
194 horiz_interp_out%rat_x => horiz_interp_in%rat_x
195 horiz_interp_out%rat_y => horiz_interp_in%rat_y
196 horiz_interp_out%lon_in => horiz_interp_in%lon_in
197 horiz_interp_out%lat_in => horiz_interp_in%lat_in
198 horiz_interp_out%I_am_initialized = .true.
199 horiz_interp_out%i_src => horiz_interp_in%i_src
200 horiz_interp_out%j_src => horiz_interp_in%j_src
201 horiz_interp_out%i_dst => horiz_interp_in%i_dst
202 horiz_interp_out%j_dst => horiz_interp_in%j_dst
203 horiz_interp_out%area_frac_dst => horiz_interp_in%area_frac_dst
204 if(horiz_interp_in%interp_method ==
conserve)
then 205 horiz_interp_out%version = horiz_interp_in%version
206 if(horiz_interp_in%version==2) horiz_interp_out%nxgrid = horiz_interp_in%nxgrid
integer, parameter, public spherica
integer, parameter, public bilinear
subroutine horiz_interp_type_eq(horiz_interp_out, horiz_interp_in)
integer, parameter, public bicubic
subroutine, public stats(dat, low, high, avg, miss, missing_value, mask)
integer, parameter, public conserve