21 subroutine stats_ ( dat, low, high, avg, miss, missing_value, mask )
22 real(FMS_HI_KIND_),
intent(in) :: dat(:,:)
23 real(FMS_HI_KIND_),
intent(out) :: low, high, avg
24 integer,
intent(out) :: miss
25 real(FMS_HI_KIND_),
intent(in),
optional :: missing_value
26 real(FMS_HI_KIND_),
intent(in),
optional :: mask(:,:)
28 real(FMS_HI_KIND_) :: dsum, buffer_real(3)
29 integer :: pe, root_pe, npes, p, buffer_int(2), npts
30 integer,
parameter :: kindl = fms_hi_kind_
33 root_pe = mpp_root_pe()
39 if (
present(missing_value))
then
40 miss = count(dat(:,:) == missing_value)
41 low = minval(dat(:,:), dat(:,:) /= missing_value)
42 high = maxval(dat(:,:), dat(:,:) /= missing_value)
43 dsum = sum(dat(:,:), dat(:,:) /= missing_value)
44 else if(
present(mask))
then
45 miss = count(mask(:,:) <= 0.5_kindl )
46 low = minval(dat(:,:),mask=mask(:,:) > 0.5_kindl)
47 high = maxval(dat(:,:),mask=mask(:,:) > 0.5_kindl)
48 dsum = sum(dat(:,:), mask=mask(:,:) > 0.5_kindl)
51 low = minval(dat(:,:))
52 high = maxval(dat(:,:))
57 npts =
size(dat(:,:)) - miss
58 if(pe == root_pe)
then
61 call mpp_recv(buffer_real(1),glen=3, from_pe=p+root_pe, tag=comm_tag_1)
62 dsum = dsum + buffer_real(1)
63 low = min(low, buffer_real(2))
64 high = max(high, buffer_real(3))
65 call mpp_recv(buffer_int(1), glen=2, from_pe=p+root_pe, tag=comm_tag_2)
66 miss = miss + buffer_int(1)
67 npts = npts + buffer_int(2)
70 print*,
'Warning: no points is valid'
72 avg = dsum/real(npts, fms_hi_kind_)
79 call mpp_send(buffer_real(1),plen=3,to_pe=root_pe, tag=comm_tag_1)
82 call mpp_send(buffer_int(1), plen=2, to_pe=root_pe, tag=comm_tag_2)
subroutine stats_(dat, area, asum, dsum, wsum, low, high, miss, mask)
This statistics is for conservative scheme.
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.