Changeset 2723 in lmdz_wrf for trunk/tools/module_scientific.f90
- Timestamp:
- Oct 11, 2019, 2:38:21 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/module_scientific.f90
r2675 r2723 34 34 ! following ray casting algorithm 35 35 ! Heron_area_triangle: Subroutine to compute area of a triangle using Heron's formula 36 ! HistogramRK: Subroutine to provide the histogram of a series of RK values 37 ! Histogram2D1_RK: Subroutine to provide the histogram of a 2D matrix RK values along the first dimension 36 38 ! intersectfaces: Subroutine to provide if two faces of two polygons intersect 37 39 ! intersection_2Dlines: Subroutine to provide the intersection point between two lines on the plane using Cramer's method … … 3742 3744 3743 3745 END SUBROUTINE quantilesR_K 3744 3745 3746 3746 3747 SUBROUTINE StatsR_K(Nvals, vals, minv, maxv, mean, mean2, stdev) … … 8042 8043 END SUBROUTINE deltat3D 8043 8044 8045 SUBROUTINE HistogramRK(Nvals, vals, missval, Nbins, Nbins1, bins, hist) 8046 ! Subroutine to provide the histogram of a series of RK values 8047 ! Histogram will be provided with Nbins+1 8048 ! 1st hist: couns(vals<Nbins(1)) 8049 ! 2nd hist: couns(Nbins(1)<=vals<Nbins(2)) 8050 ! ... 8051 ! Nbins hist: couns(Nbins(Nbins)<=vals) 8052 8053 IMPLICIT NONE 8054 8055 INTEGER, INTENT(in) :: Nvals, Nbins, Nbins1 8056 REAL(r_k), DIMENSION(Nvals), INTENT(in) :: vals 8057 REAL(r_k), INTENT(in) :: missval 8058 REAL(r_k), DIMENSION(Nbins), INTENT(in) :: bins 8059 INTEGER, DIMENSION(Nbins1), INTENT(out) :: hist 8060 8061 ! Local 8062 INTEGER :: i, ib 8063 8064 !!!!!!! Variables 8065 ! Nvals: number of values 8066 ! vals: values 8067 ! missval: value for the missing value 8068 ! Nbins: number of bins 8069 ! bins: bins of the histogram 8070 ! hist: histogram 8071 8072 fname = 'HistogramRK' 8073 8074 hist = 0 8075 8076 DO i=1, Nvals 8077 IF (vals(i) == missval) CYCLE 8078 IF (vals(i) < bins(1)) THEN 8079 hist(1) = hist(1) + 1 8080 CYCLE 8081 END IF 8082 DO ib=2, Nbins 8083 IF ( (vals(i) >= bins(ib-1)) .AND. (vals(i) < bins(ib)) ) THEN 8084 hist(ib) = hist(ib) + 1 8085 CYCLE 8086 END IF 8087 END DO 8088 IF (vals(i) >= bins(Nbins)) hist(Nbins+1) = hist(Nbins+1) + 1 8089 END DO 8090 8091 RETURN 8092 8093 END SUBROUTINE HistogramRK 8094 8095 SUBROUTINE Histogram2D1_RK(d1, d2, vals, missval, Nbins, Nbins1, bins, hist) 8096 ! Subroutine to provide the histogram of a 2D matrix RK values along the first dimension 8097 8098 IMPLICIT NONE 8099 8100 INTEGER, INTENT(in) :: d1, d2, Nbins, Nbins1 8101 REAL(r_k),INTENT(in) :: missval 8102 REAL(r_k), DIMENSION(d1,d2), INTENT(in) :: vals 8103 REAL(r_k), DIMENSION(Nbins), INTENT(in) :: bins 8104 INTEGER, DIMENSION(d2, Nbins1), INTENT(out) :: hist 8105 8106 ! Local 8107 INTEGER :: i, j 8108 !!!!!!! Variables 8109 ! d1, d2: dimension of values 8110 ! vals: values 8111 ! missval: value for the missing value 8112 ! Nbins: number of bins 8113 ! bins: bins of the histogram 8114 ! hist: histogram 8115 8116 fname = 'Histogram2D1_RK' 8117 8118 hist = zeroRK 8119 8120 DO i=1, d2 8121 CALL HistogramRK(d1, vals(:,i), missval, Nbins, Nbins1, bins, hist(i,:)) 8122 END DO 8123 8124 RETURN 8125 8126 END SUBROUTINE Histogram2D1_RK 8127 8044 8128 END MODULE module_scientific 8045 8129
Note: See TracChangeset
for help on using the changeset viewer.