Changeset 1913 in lmdz_wrf for trunk


Ignore:
Timestamp:
May 14, 2018, 11:52:50 AM (7 years ago)
Author:
lfita
Message:

Adding:

  • `NcountR': Subroutine to count real values
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/module_scientific.f90

    r1782 r1913  
    2121! look_clockwise_borders: Subroutine to look clock-wise for a next point within a collection of borders
    2222!   (limits of a region)
     23! NcountR: Subroutine to count real values
    2324! paths_border: Subroutine to search the paths of a border field.
    2425! path_properties: Subroutine to determine the properties of a path
     
    35723573END SUBROUTINE StatsR_k
    35733574
     3575  SUBROUTINE NcountR(values, d1, Ndiffvals, counts)
     3576! Subroutine to count real values
     3577
     3578    IMPLICIT NONE
     3579
     3580    INTEGER, INTENT(in)                                  :: d1
     3581    REAL(r_k), DIMENSION(d1), INTENT(in)                 :: values
     3582    INTEGER, INTENT(out)                                 :: Ndiffvals
     3583    REAL(r_k), DIMENSION(d1,2), INTENT(out)              :: counts
     3584! Local
     3585    INTEGER                                              :: i, ival
     3586    REAL(r_k), DIMENSION(d1)                             :: diffv
     3587
     3588!!!!!!! Variables
     3589! values: values to count
     3590! counts: counts of time for each value
     3591   
     3592    fname = 'NcountR'
     3593
     3594    counts = -1.
     3595
     3596    counts(1,1) = values(1)
     3597    counts(1,2) = 1
     3598    Ndiffvals = 1
     3599    DO i=2,d1
     3600      diffv(1:Ndiffvals) = counts(1:Ndiffvals,1) - values(i)
     3601      IF (ANY(diffv(1:Ndiffvals) == 0)) THEN
     3602        ival = Index1DArrayR(counts(1:Ndiffvals,1), Ndiffvals, values(i))
     3603        counts(ival,2) = counts(ival,2) + 1
     3604      ELSE
     3605        Ndiffvals = Ndiffvals + 1
     3606        counts(Ndiffvals,1) = values(i)
     3607        counts(Ndiffvals,2) = 1
     3608      END IF
     3609    END DO
     3610
     3611  END SUBROUTINE NcountR
     3612
    35743613END MODULE module_scientific
Note: See TracChangeset for help on using the changeset viewer.