45 & LBi, UBi, LBj, UBj, &
86 logical,
intent(in),
optional :: debug
88 integer,
intent(in) :: ng, tile, model, gtype
89 integer,
intent(in) :: extract_flag
90 integer,
intent(in) :: lbi, ubi, lbj, ubj
93 real(r8),
intent(in) :: f(lbi:,lbj:)
94 real(r8),
intent(in),
optional :: fmask(lbi:,lbj:)
96 real(r8),
intent(in) :: f(lbi:ubi,lbj:ubj)
97 real(r8),
intent(in),
optional :: fmask(lbi:ubi,lbj:ubj)
99 TYPE(
t_stats),
intent(inout) :: s
105 integer :: imin, imax, jmin, jmax, npts, nsub
106 integer :: i, j, my_count
111 real(r8) :: my_max, my_min
112 real(r8) :: my_avg, my_rms
114 real(r8),
allocatable :: cwrk(:)
117 real(r8),
dimension(5) :: rbuffer
118 character (len=3),
dimension(5) :: op_handle
133 SELECT CASE (abs(gtype))
135 IF (extract_flag.ge.0)
THEN
136 imin=
bounds(ng)%IstrP(tile)
137 imax=
bounds(ng)%IendP(tile)
138 jmin=
bounds(ng)%JstrP(tile)
139 jmax=
bounds(ng)%JendP(tile)
142 imin=xtr_bounds(ng)%IstrP(tile)
143 imax=xtr_bounds(ng)%IendP(tile)
144 jmin=xtr_bounds(ng)%JstrP(tile)
145 jmax=xtr_bounds(ng)%JendP(tile)
149 IF (extract_flag.ge.0)
THEN
150 imin=
bounds(ng)%IstrT(tile)
151 imax=
bounds(ng)%IendT(tile)
152 jmin=
bounds(ng)%JstrT(tile)
153 jmax=
bounds(ng)%JendT(tile)
156 imin=xtr_bounds(ng)%IstrT(tile)
157 imax=xtr_bounds(ng)%IendT(tile)
158 jmin=xtr_bounds(ng)%JstrT(tile)
159 jmax=xtr_bounds(ng)%JendT(tile)
163 IF (extract_flag.ge.0)
THEN
164 imin=
bounds(ng)%IstrP(tile)
165 imax=
bounds(ng)%IendT(tile)
166 jmin=
bounds(ng)%JstrT(tile)
167 jmax=
bounds(ng)%JendT(tile)
170 imin=xtr_bounds(ng)%IstrP(tile)
171 imax=xtr_bounds(ng)%IendT(tile)
172 jmin=xtr_bounds(ng)%JstrT(tile)
173 jmax=xtr_bounds(ng)%JendT(tile)
177 IF (extract_flag.ge.0)
THEN
178 imin=
bounds(ng)%IstrT(tile)
179 imax=
bounds(ng)%IendT(tile)
180 jmin=
bounds(ng)%JstrP(tile)
181 jmax=
bounds(ng)%JendT(tile)
184 imin=xtr_bounds(ng)%IstrT(tile)
185 imax=xtr_bounds(ng)%IendT(tile)
186 jmin=xtr_bounds(ng)%JstrP(tile)
187 jmax=xtr_bounds(ng)%JendT(tile)
191 IF (extract_flag.ge.0)
THEN
192 imin=
bounds(ng)%IstrT(tile)
193 imax=
bounds(ng)%IendT(tile)
194 jmin=
bounds(ng)%JstrT(tile)
195 jmax=
bounds(ng)%JendT(tile)
198 imin=xtr_bounds(ng)%IstrT(tile)
199 imax=xtr_bounds(ng)%IendT(tile)
200 jmin=xtr_bounds(ng)%JstrT(tile)
201 jmax=xtr_bounds(ng)%JendT(tile)
218 IF (
PRESENT(debug))
THEN
226 IF (
PRESENT(fmask))
THEN
229 IF (fmask(i,j).gt.0.0_r8)
THEN
231 my_min=min(my_min, f(i,j))
232 my_max=max(my_max, f(i,j))
234 my_rms=my_rms+f(i,j)*f(i,j)
242 my_min=min(my_min, f(i,j))
243 my_max=max(my_max, f(i,j))
245 my_rms=my_rms+f(i,j)*f(i,j)
252 npts=(imax-imin+1)*(jmax-jmin+1)
253 IF (.not.
allocated(cwrk))
allocate ( cwrk(npts) )
254 cwrk=pack(f(imin:imax, jmin:jmax), .true.)
256 CALL get_hash (cwrk, npts, s%checksum, .true.)
258 CALL get_hash (cwrk, npts, s%checksum)
260 IF (
allocated(cwrk))
deallocate (cwrk)
270 s%count=s%count+my_count
271 s%min=min(s%min,my_min)
272 s%max=max(s%max,my_max)
280 &
'my_count = ', my_count, &
281 &
'S%count = ', s%count, &
282 &
'MINVAL = ', minval(f(imin:imax,jmin:jmax)), &
283 &
'MAXVAL = ', maxval(f(imin:imax,jmin:jmax)), &
284 &
'SUM = ', sum(f(imin:imax,jmin:jmax)), &
285 &
'MEAN = ', sum(f(imin:imax,jmin:jmax))/ &
286 & real(my_count,r8), &
287 &
'my_min = ', my_min, &
288 &
'my_max = ', my_max, &
289 &
'S%min = ', s%min, &
290 &
'S%max = ', s%max, &
291 &
'my_avg = ', my_avg, &
292 &
'S%avg = ', s%avg, &
293 &
'my_rms = ', my_rms, &
295 10
FORMAT (10x,5(5x,a,i0),/, &
296 & 6(15x,a,1p,e15.8,0p,5x,a,1p,e15.8,0p,/))
303 rbuffer(1)=real(s%count, r8)
313 CALL mp_reduce (ng, model, 5, rbuffer, op_handle)
314 s%count=int(rbuffer(1))
323 IF (s%count.gt.0)
THEN
324 fac=1.0_r8/real(s%count, r8)
326 s%rms=sqrt(s%rms*fac)
340 & LBi, UBi, LBj, UBj, LBk, UBk, &
383 logical,
intent(in),
optional :: debug
385 integer,
intent(in) :: ng, tile, model, gtype
386 integer,
intent(in) :: extract_flag
387 integer,
intent(in) :: lbi, ubi, lbj, ubj, lbk, ubk
390 real(r8),
intent(in) :: f(lbi:,lbj:,lbk:)
391 real(r8),
intent(in),
optional :: fmask(lbi:,lbj:)
393 real(r8),
intent(in) :: f(lbi:ubi,lbj:ubj,lbk:ubk)
394 real(r8),
intent(in),
optional :: fmask(lbi:ubi,lbj:ubj)
396 TYPE(
t_stats),
intent(inout) :: s
402 integer :: imin, imax, jmin, jmax, npts, nsub
403 integer :: i, j, k, my_count
408 real(r8) :: my_max, my_min
409 real(r8) :: my_avg, my_rms
411 real(r8),
allocatable :: cwrk(:)
414 real(r8),
dimension(5) :: rbuffer
415 character (len=3),
dimension(5) :: op_handle
430 SELECT CASE (abs(gtype))
432 IF (extract_flag.ge.0)
THEN
433 imin=
bounds(ng)%IstrP(tile)
434 imax=
bounds(ng)%IendP(tile)
435 jmin=
bounds(ng)%JstrP(tile)
436 jmax=
bounds(ng)%JendP(tile)
439 imin=xtr_bounds(ng)%IstrP(tile)
440 imax=xtr_bounds(ng)%IendP(tile)
441 jmin=xtr_bounds(ng)%JstrP(tile)
442 jmax=xtr_bounds(ng)%JendP(tile)
446 IF (extract_flag.ge.0)
THEN
447 imin=
bounds(ng)%IstrT(tile)
448 imax=
bounds(ng)%IendT(tile)
449 jmin=
bounds(ng)%JstrT(tile)
450 jmax=
bounds(ng)%JendT(tile)
453 imin=xtr_bounds(ng)%IstrT(tile)
454 imax=xtr_bounds(ng)%IendT(tile)
455 jmin=xtr_bounds(ng)%JstrT(tile)
456 jmax=xtr_bounds(ng)%JendT(tile)
460 IF (extract_flag.ge.0)
THEN
461 imin=
bounds(ng)%IstrP(tile)
462 imax=
bounds(ng)%IendT(tile)
463 jmin=
bounds(ng)%JstrT(tile)
464 jmax=
bounds(ng)%JendT(tile)
467 imin=xtr_bounds(ng)%IstrP(tile)
468 imax=xtr_bounds(ng)%IendT(tile)
469 jmin=xtr_bounds(ng)%JstrT(tile)
470 jmax=xtr_bounds(ng)%JendT(tile)
474 IF (extract_flag.ge.0)
THEN
475 imin=
bounds(ng)%IstrT(tile)
476 imax=
bounds(ng)%IendT(tile)
477 jmin=
bounds(ng)%JstrP(tile)
478 jmax=
bounds(ng)%JendT(tile)
481 imin=xtr_bounds(ng)%IstrT(tile)
482 imax=xtr_bounds(ng)%IendT(tile)
483 jmin=xtr_bounds(ng)%JstrP(tile)
484 jmax=xtr_bounds(ng)%JendT(tile)
488 IF (extract_flag.ge.0)
THEN
489 imin=
bounds(ng)%IstrT(tile)
490 imax=
bounds(ng)%IendT(tile)
491 jmin=
bounds(ng)%JstrT(tile)
492 jmax=
bounds(ng)%JendT(tile)
495 imin=xtr_bounds(ng)%IstrT(tile)
496 imax=xtr_bounds(ng)%IendT(tile)
497 jmin=xtr_bounds(ng)%JstrT(tile)
498 jmax=xtr_bounds(ng)%JendT(tile)
515 IF (
PRESENT(debug))
THEN
523 IF (
PRESENT(fmask))
THEN
527 IF (fmask(i,j).gt.0.0_r8)
THEN
529 my_min=min(my_min, f(i,j,k))
530 my_max=max(my_max, f(i,j,k))
531 my_avg=my_avg+f(i,j,k)
532 my_rms=my_rms+f(i,j,k)*f(i,j,k)
542 my_min=min(my_min, f(i,j,k))
543 my_max=max(my_max, f(i,j,k))
544 my_avg=my_avg+f(i,j,k)
545 my_rms=my_rms+f(i,j,k)*f(i,j,k)
553 npts=(imax-imin+1)*(jmax-jmin+1)*(ubk-lbk+1)
554 IF (.not.
allocated(cwrk))
allocate ( cwrk(npts) )
555 cwrk=pack(f(imin:imax, jmin:jmax, lbk:ubk), .true.)
557 CALL get_hash (cwrk, npts, s%checksum, .true.)
559 CALL get_hash (cwrk, npts, s%checksum)
561 IF (
allocated(cwrk))
deallocate (cwrk)
574 s%count=s%count+my_count
575 s%min=min(s%min,my_min)
576 s%max=max(s%max,my_max)
584 &
'my_count = ', my_count, &
585 &
'S%count = ', s%count, &
586 &
'MINVAL = ', minval(f(imin:imax,jmin:jmax,:)), &
587 &
'MAXVAL = ', maxval(f(imin:imax,jmin:jmax,:)), &
588 &
'SUM = ', sum(f(imin:imax,jmin:jmax,:)), &
589 &
'MEAN = ', sum(f(imin:imax,jmin:jmax,:))/ &
590 & real(my_count,r8), &
591 &
'my_min = ', my_min, &
592 &
'my_max = ', my_max, &
593 &
'S%min = ', s%min, &
594 &
'S%max = ', s%max, &
595 &
'my_avg = ', my_avg, &
596 &
'S%avg = ', s%avg, &
597 &
'my_rms = ', my_rms, &
599 10
FORMAT (10x,5(5x,a,i0),/, &
600 & 6(15x,a,1p,e15.8,0p,5x,a,1p,e15.8,0p,/))
607 rbuffer(1)=real(s%count, r8)
617 CALL mp_reduce (ng, model, 5, rbuffer, op_handle)
618 s%count=int(rbuffer(1))
627 IF (s%count.gt.0)
THEN
628 fac=1.0_r8/real(s%count, r8)
630 s%rms=sqrt(s%rms*fac)
644 & LBi, UBi, LBj, UBj, LBk, UBk, LBt, UBt, &
689 logical,
intent(in),
optional :: debug
691 integer,
intent(in) :: ng, tile, model, gtype
692 integer,
intent(in) :: extract_flag
693 integer,
intent(in) :: lbi, ubi, lbj, ubj, lbk, ubk, lbt, ubt
696 real(r8),
intent(in) :: f(lbi:,lbj:,lbk:,lbt:)
697 real(r8),
intent(in),
optional :: fmask(lbi:,lbj:)
699 real(r8),
intent(in) :: f(lbi:ubi,lbj:ubj,lbk:ubk)
700 real(r8),
intent(in),
optional :: fmask(lbi:ubi,lbj:ubj,lbt:ubt)
702 TYPE(
t_stats),
intent(inout) :: s
708 integer :: imin, imax, jmin, jmax, npts, nsub
709 integer :: i, j, k, l, my_count
714 real(r8) :: my_max, my_min
715 real(r8) :: my_avg, my_rms
717 real(r8),
allocatable :: cwrk(:)
720 real(r8),
dimension(5) :: rbuffer
721 character (len=3),
dimension(5) :: op_handle
736 SELECT CASE (abs(gtype))
738 IF (extract_flag.ge.0)
THEN
739 imin=
bounds(ng)%IstrP(tile)
740 imax=
bounds(ng)%IendP(tile)
741 jmin=
bounds(ng)%JstrP(tile)
742 jmax=
bounds(ng)%JendP(tile)
745 imin=xtr_bounds(ng)%IstrP(tile)
746 imax=xtr_bounds(ng)%IendP(tile)
747 jmin=xtr_bounds(ng)%JstrP(tile)
748 jmax=xtr_bounds(ng)%JendP(tile)
752 IF (extract_flag.ge.0)
THEN
753 imin=
bounds(ng)%IstrT(tile)
754 imax=
bounds(ng)%IendT(tile)
755 jmin=
bounds(ng)%JstrT(tile)
756 jmax=
bounds(ng)%JendT(tile)
759 imin=xtr_bounds(ng)%IstrT(tile)
760 imax=xtr_bounds(ng)%IendT(tile)
761 jmin=xtr_bounds(ng)%JstrT(tile)
762 jmax=xtr_bounds(ng)%JendT(tile)
766 IF (extract_flag.ge.0)
THEN
767 imin=
bounds(ng)%IstrP(tile)
768 imax=
bounds(ng)%IendT(tile)
769 jmin=
bounds(ng)%JstrT(tile)
770 jmax=
bounds(ng)%JendT(tile)
773 imin=xtr_bounds(ng)%IstrP(tile)
774 imax=xtr_bounds(ng)%IendT(tile)
775 jmin=xtr_bounds(ng)%JstrT(tile)
776 jmax=xtr_bounds(ng)%JendT(tile)
780 IF (extract_flag.ge.0)
THEN
781 imin=
bounds(ng)%IstrT(tile)
782 imax=
bounds(ng)%IendT(tile)
783 jmin=
bounds(ng)%JstrP(tile)
784 jmax=
bounds(ng)%JendT(tile)
787 imin=xtr_bounds(ng)%IstrT(tile)
788 imax=xtr_bounds(ng)%IendT(tile)
789 jmin=xtr_bounds(ng)%JstrP(tile)
790 jmax=xtr_bounds(ng)%JendT(tile)
794 IF (extract_flag.ge.0)
THEN
795 imin=
bounds(ng)%IstrT(tile)
796 imax=
bounds(ng)%IendT(tile)
797 jmin=
bounds(ng)%JstrT(tile)
798 jmax=
bounds(ng)%JendT(tile)
801 imin=xtr_bounds(ng)%IstrT(tile)
802 imax=xtr_bounds(ng)%IendT(tile)
803 jmin=xtr_bounds(ng)%JstrT(tile)
804 jmax=xtr_bounds(ng)%JendT(tile)
821 IF (
PRESENT(debug))
THEN
829 IF (
PRESENT(fmask))
THEN
834 IF (fmask(i,j).gt.0.0_r8)
THEN
836 my_min=min(my_min, f(i,j,k,l))
837 my_max=max(my_max, f(i,j,k,l))
838 my_avg=my_avg+f(i,j,k,l)
839 my_rms=my_rms+f(i,j,k,l)*f(i,j,k,l)
851 my_min=min(my_min, f(i,j,k,l))
852 my_max=max(my_max, f(i,j,k,l))
853 my_avg=my_avg+f(i,j,k,l)
854 my_rms=my_rms+f(i,j,k,l)*f(i,j,k,l)
863 npts=(imax-imin+1)*(jmax-jmin+1)*(ubk-lbk+1)*(ubt-lbt+1)
864 IF (.not.
allocated(cwrk))
allocate ( cwrk(npts) )
865 cwrk=pack(f(imin:imax, jmin:jmax, lbk:ubk, lbt:ubt), .true.)
867 CALL get_hash (cwrk, npts, s%checksum, .true.)
869 CALL get_hash (cwrk, npts, s%checksum)
871 IF (
allocated(cwrk))
deallocate (cwrk)
884 s%count=s%count+my_count
885 s%min=min(s%min,my_min)
886 s%max=max(s%max,my_max)
894 &
'my_count = ', my_count, &
895 &
'S%count = ', s%count, &
896 &
'MINVAL = ', minval(f(imin:imax,jmin:jmax,:,:)), &
897 &
'MAXVAL = ', maxval(f(imin:imax,jmin:jmax,:,:)), &
898 &
'SUM = ', sum(f(imin:imax,jmin:jmax,:,:)), &
899 &
'MEAN = ', sum(f(imin:imax,jmin:jmax,:,:))/ &
900 & real(my_count,r8), &
901 &
'my_min = ', my_min, &
902 &
'my_max = ', my_max, &
903 &
'S%min = ', s%min, &
904 &
'S%max = ', s%max, &
905 &
'my_avg = ', my_avg, &
906 &
'S%avg = ', s%avg, &
907 &
'my_rms = ', my_rms, &
909 10
FORMAT (10x,5(5x,a,i0),/, &
910 & 6(15x,a,1p,e15.8,0p,5x,a,1p,e15.8,0p,/))
917 rbuffer(1)=real(s%count, r8)
927 CALL mp_reduce (ng, model, 5, rbuffer, op_handle)
928 s%count=int(rbuffer(1))
937 IF (s%count.gt.0)
THEN
938 fac=1.0_r8/real(s%count, r8)
940 s%rms=sqrt(s%rms*fac)