30 class(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
31 character(len=*),
intent(in) :: variable_name
32 class(*),
dimension(:,:),
intent(in) :: variable_data
33 logical,
intent(out) :: is_decomposed
34 character(len=32) :: chksum
38 type(domain2d),
pointer :: io_domain
47 logical :: buffer_includes_halos
50 integer,
dimension(2) :: c
51 integer,
dimension(2) :: e
52 integer(kind=i4_kind),
dimension(:,:),
allocatable :: buf_i4_kind
53 integer(kind=i8_kind),
dimension(:,:),
allocatable :: buf_i8_kind
54 real(kind=r4_kind),
dimension(:,:),
allocatable :: buf_r4_kind
55 real(kind=r8_kind),
dimension(:,:),
allocatable :: buf_r8_kind
56 integer(kind=i4_kind) :: fill_i4_kind
57 integer(kind=i8_kind) :: fill_i8_kind
58 real(kind=r4_kind) :: fill_r4_kind
59 real(kind=r8_kind) :: fill_r8_kind
60 integer(kind=i8_kind) :: chksum_val
62 is_decomposed = is_variable_domain_decomposed(fileobj, variable_name, &
63 xindex=xdim, yindex=ydim, &
65 if (.not. is_decomposed)
then
70 call domain_offsets(
size(variable_data, xdim),
size(variable_data, ydim), fileobj%domain, &
71 xpos, ypos, isd, isc, xc_size, jsd, jsc, &
72 yc_size, buffer_includes_halos, extra_x, extra_y, &
73 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
75 if (buffer_includes_halos)
then
77 c(xdim) = isc - isd + 1
78 c(ydim) = jsc - jsd + 1
80 e(:) = shape(variable_data)
96 select type (variable_data)
97 type is (
integer(kind=i4_kind))
98 call allocate_array(buf_i4_kind, e)
99 call get_array_section(buf_i4_kind, variable_data, c, e)
100 if (get_fill_value(fileobj, variable_name, fill_i4_kind))
then
101 chksum_val = mpp_chksum(buf_i4_kind, mask_val=fill_i4_kind)
103 chksum_val = mpp_chksum(buf_i4_kind)
105 deallocate(buf_i4_kind)
106 type is (
integer(kind=i8_kind))
107 call allocate_array(buf_i8_kind, e)
108 call get_array_section(buf_i8_kind, variable_data, c, e)
109 if (get_fill_value(fileobj, variable_name, fill_i8_kind))
then
110 chksum_val = mpp_chksum(buf_i8_kind, mask_val=fill_i8_kind)
112 chksum_val = mpp_chksum(buf_i8_kind)
114 deallocate(buf_i8_kind)
115 type is (real(kind=r4_kind))
116 call allocate_array(buf_r4_kind, e)
117 call get_array_section(buf_r4_kind, variable_data, c, e)
118 if (get_fill_value(fileobj, variable_name, fill_r4_kind))
then
119 chksum_val = mpp_chksum(buf_r4_kind, mask_val=fill_r4_kind)
121 chksum_val = mpp_chksum(buf_r4_kind)
123 deallocate(buf_r4_kind)
124 type is (real(kind=r8_kind))
125 call allocate_array(buf_r8_kind, e)
126 call get_array_section(buf_r8_kind, variable_data, c, e)
127 if (get_fill_value(fileobj, variable_name, fill_r8_kind))
then
128 chksum_val = mpp_chksum(buf_r8_kind, mask_val=fill_r8_kind)
130 chksum_val = mpp_chksum(buf_r8_kind)
132 deallocate(buf_r8_kind)
134 call error(
"unsupported variable type: compute_global_checksum_2d: file: "//trim(fileobj%path)//
" variable:"// &
135 & trim(variable_name))
138 write(chksum,
"(Z16)") chksum_val
147 class(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
148 character(len=*),
intent(in) :: variable_name
149 class(*),
dimension(:,:,:),
intent(in) :: variable_data
150 logical,
intent(out) :: is_decomposed
151 character(len=32) :: chksum
155 type(domain2d),
pointer :: io_domain
164 logical :: buffer_includes_halos
167 integer,
dimension(3) :: c
168 integer,
dimension(3) :: e
169 integer(kind=i4_kind),
dimension(:,:,:),
allocatable :: buf_i4_kind
170 integer(kind=i8_kind),
dimension(:,:,:),
allocatable :: buf_i8_kind
171 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: buf_r4_kind
172 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: buf_r8_kind
173 integer(kind=i4_kind) :: fill_i4_kind
174 integer(kind=i8_kind) :: fill_i8_kind
175 real(kind=r4_kind) :: fill_r4_kind
176 real(kind=r8_kind) :: fill_r8_kind
177 integer(kind=i8_kind) :: chksum_val
179 is_decomposed = is_variable_domain_decomposed(fileobj, variable_name, &
180 xindex=xdim, yindex=ydim, &
181 xpos=xpos, ypos=ypos)
182 if (.not. is_decomposed)
then
187 call domain_offsets(
size(variable_data, xdim),
size(variable_data, ydim), fileobj%domain, &
188 xpos, ypos, isd, isc, xc_size, jsd, jsc, &
189 yc_size, buffer_includes_halos, extra_x, extra_y, &
190 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
192 if (buffer_includes_halos)
then
194 c(xdim) = isc - isd + 1
195 c(ydim) = jsc - jsd + 1
197 e(:) = shape(variable_data)
204 e(xdim) = e(xdim) - 1
210 e(ydim) = e(ydim) - 1
212 select type (variable_data)
213 type is (
integer(kind=i4_kind))
214 call allocate_array(buf_i4_kind, e)
215 call get_array_section(buf_i4_kind, variable_data, c, e)
216 if (get_fill_value(fileobj, variable_name, fill_i4_kind))
then
217 chksum_val = mpp_chksum(buf_i4_kind, mask_val=fill_i4_kind)
219 chksum_val = mpp_chksum(buf_i4_kind)
221 deallocate(buf_i4_kind)
222 type is (
integer(kind=i8_kind))
223 call allocate_array(buf_i8_kind, e)
224 call get_array_section(buf_i8_kind, variable_data, c, e)
225 if (get_fill_value(fileobj, variable_name, fill_i8_kind))
then
226 chksum_val = mpp_chksum(buf_i8_kind, mask_val=fill_i8_kind)
228 chksum_val = mpp_chksum(buf_i8_kind)
230 deallocate(buf_i8_kind)
231 type is (real(kind=r4_kind))
232 call allocate_array(buf_r4_kind, e)
233 call get_array_section(buf_r4_kind, variable_data, c, e)
234 if (get_fill_value(fileobj, variable_name, fill_r4_kind))
then
235 chksum_val = mpp_chksum(buf_r4_kind, mask_val=fill_r4_kind)
237 chksum_val = mpp_chksum(buf_r4_kind)
239 deallocate(buf_r4_kind)
240 type is (real(kind=r8_kind))
241 call allocate_array(buf_r8_kind, e)
242 call get_array_section(buf_r8_kind, variable_data, c, e)
243 if (get_fill_value(fileobj, variable_name, fill_r8_kind))
then
244 chksum_val = mpp_chksum(buf_r8_kind, mask_val=fill_r8_kind)
246 chksum_val = mpp_chksum(buf_r8_kind)
248 deallocate(buf_r8_kind)
250 call error(
"unsupported variable type: compute_global_checksum_3d: file: "//trim(fileobj%path)//
" variable:"// &
251 & trim(variable_name))
254 write(chksum,
"(Z16)") chksum_val
263 class(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
264 character(len=*),
intent(in) :: variable_name
265 class(*),
dimension(:,:,:,:),
intent(in) :: variable_data
266 logical,
intent(out) :: is_decomposed
267 character(len=32) :: chksum
271 type(domain2d),
pointer :: io_domain
280 logical :: buffer_includes_halos
283 integer,
dimension(4) :: c
284 integer,
dimension(4) :: e
285 integer(kind=i4_kind),
dimension(:,:,:,:),
allocatable :: buf_i4_kind
286 integer(kind=i8_kind),
dimension(:,:,:,:),
allocatable :: buf_i8_kind
287 real(kind=r4_kind),
dimension(:,:,:,:),
allocatable :: buf_r4_kind
288 real(kind=r8_kind),
dimension(:,:,:,:),
allocatable :: buf_r8_kind
289 integer(kind=i4_kind) :: fill_i4_kind
290 integer(kind=i8_kind) :: fill_i8_kind
291 real(kind=r4_kind) :: fill_r4_kind
292 real(kind=r8_kind) :: fill_r8_kind
293 integer(kind=i8_kind) :: chksum_val
295 is_decomposed = is_variable_domain_decomposed(fileobj, variable_name, &
296 xindex=xdim, yindex=ydim, &
297 xpos=xpos, ypos=ypos)
298 if (.not. is_decomposed)
then
303 call domain_offsets(
size(variable_data, xdim),
size(variable_data, ydim), fileobj%domain, &
304 xpos, ypos, isd, isc, xc_size, jsd, jsc, &
305 yc_size, buffer_includes_halos, extra_x, extra_y, &
306 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
308 if (buffer_includes_halos)
then
310 c(xdim) = isc - isd + 1
311 c(ydim) = jsc - jsd + 1
313 e(:) = shape(variable_data)
320 e(xdim) = e(xdim) - 1
326 e(ydim) = e(ydim) - 1
329 select type (variable_data)
330 type is (
integer(kind=i4_kind))
331 call allocate_array(buf_i4_kind, e)
332 call get_array_section(buf_i4_kind, variable_data, c, e)
333 if (get_fill_value(fileobj, variable_name, fill_i4_kind))
then
334 chksum_val = mpp_chksum(buf_i4_kind, mask_val=fill_i4_kind)
336 chksum_val = mpp_chksum(buf_i4_kind)
338 deallocate(buf_i4_kind)
339 type is (
integer(kind=i8_kind))
340 call allocate_array(buf_i8_kind, e)
341 call get_array_section(buf_i8_kind, variable_data, c, e)
342 if (get_fill_value(fileobj, variable_name, fill_i8_kind))
then
343 chksum_val = mpp_chksum(buf_i8_kind, mask_val=fill_i8_kind)
345 chksum_val = mpp_chksum(buf_i8_kind)
347 deallocate(buf_i8_kind)
348 type is (real(kind=r4_kind))
349 call allocate_array(buf_r4_kind, e)
350 call get_array_section(buf_r4_kind, variable_data, c, e)
351 if (get_fill_value(fileobj, variable_name, fill_r4_kind))
then
352 chksum_val = mpp_chksum(buf_r4_kind, mask_val=fill_r4_kind)
354 chksum_val = mpp_chksum(buf_r4_kind)
356 deallocate(buf_r4_kind)
357 type is (real(kind=r8_kind))
358 call allocate_array(buf_r8_kind, e)
359 call get_array_section(buf_r8_kind, variable_data, c, e)
360 if (get_fill_value(fileobj, variable_name, fill_r8_kind))
then
361 chksum_val = mpp_chksum(buf_r8_kind, mask_val=fill_r8_kind)
363 chksum_val = mpp_chksum(buf_r8_kind)
365 deallocate(buf_r8_kind)
367 call error(
"unsupported variable type: compute_global_checksum_4d: file: "//trim(fileobj%path)//
" variable:"// &
368 & trim(variable_name))
371 write(chksum,
"(Z16)") chksum_val
character(len=32) function compute_global_checksum_3d(fileobj, variable_name, variable_data, is_decomposed)
@briefs Calculates a variable's checksum across all ranks in the current pelist.
character(len=32) function compute_global_checksum_4d(fileobj, variable_name, variable_data, is_decomposed)
@briefs Calculates a variable's checksum across all ranks in the current pelist.
character(len=32) function compute_global_checksum_2d(fileobj, variable_name, variable_data, is_decomposed)
@briefs Calculates a variable's checksum across all ranks in the current pelist.
type(domain2d) function, pointer mpp_get_io_domain(domain)
Set user stack size.