0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_mad::mad Interface Reference

Mean absolute deviation test. More...

Public Member Functions

logical function, dimension(size(arr)) mad_sp (arr, z, mask, deriv)
 
logical function, dimension(size(arr)) mad_dp (arr, z, mask, deriv)
 
real(dp) function, dimension(size(arr)) mad_val_dp (arr, z, mask, tout, mval)
 
real(sp) function, dimension(size(arr)) mad_val_sp (arr, z, mask, tout, mval)
 

Detailed Description

Mean absolute deviation test.

Mean absolute deviation test with optional z-value (default: 7) and mask, and 3 optional variants:

  • 0: raw values (default)
  • 1: 1st derivative
  • 2: 2nd derivative

Returns mask with true everywhere except where 0<(median-MAD*z/0.6745) or >(md+MAD*z/0.6745)
If an optional mask is given, the mad test is only performed on those locations that correspond to true values in the mask.
If tout is given mad returns the array with the enteries exceeding the treshold being set to the threshold. With this setting arrays are accepted.
tout accepts:

  • u: upper values are cut at the threshold
  • l: lower values are cut at the threshold
  • b: upper and lower values are cut at the threshold

With this setting only the variant 0 is available (no argument implemented).

Example

vec = (/ -0.25,0.68,0.94,1.15,2.26,2.35,2.37,2.40,2.47,2.54,2.62, &
2.64,2.90,2.92,2.92,2.93,3.21,3.26,3.30,3.59,3.68,4.30, &
4.64,5.34,5.42,8.01 /)
mask(:) = true
! Sets last entry false
mask = mask .and. mad(vec, z=4., deriv=0, mask=mask)

See also example in test directory.

Parameters
[in]real(sp/dp) :: vec(:)1D-array with input numbers
[in]real(sp/dp) :: arrnD-array with input numbers
[in]real(sp/dp), optional :: zInput is allowed to deviate maximum z standard deviations from the median (default: 7).
[in]integer(i4), optional :: deriv0: Act on raw input (default: 0)
1: Use first derivatives
2: Use 2nd derivatives
[in]logical, optional :: mask(:)1D-array of logical values with size(vec). If present, only those locations in vec corresponding to the true values in mask are used. nD-array if tout is used.
[in]character(1):: toutu: Trim only values above mad
l: Trim only values below mad
b: Trim values below and above mad
Return values
logical or real(sp/dp), dimension(size(arr)) :: outmask with true everywhere except where input deviates more than z standard deviations from median. If tout five, threshold value is returned.
Note
1st derivative is
d = datin[1:n]-datin[0:n-1]
because mean of left and right would give 0 for spikes.
Author
Matthias Cuntz
Date
Mar 2011
Author
Mathhias Kelbling
Date
May 2018
  • mad_val added by Matthias Kelbling, May 2018

Definition at line 94 of file mo_mad.f90.

Member Function/Subroutine Documentation

◆ mad_dp()

logical function, dimension(size(arr)) mo_mad::mad::mad_dp ( real(dp), dimension(:), intent(in)  arr,
real(dp), intent(in), optional  z,
logical, dimension(:), intent(in), optional  mask,
integer(i4), intent(in), optional  deriv 
)

Definition at line 106 of file mo_mad.f90.

◆ mad_sp()

logical function, dimension(size(arr)) mo_mad::mad::mad_sp ( real(sp), dimension(:), intent(in)  arr,
real(sp), intent(in), optional  z,
logical, dimension(:), intent(in), optional  mask,
integer(i4), intent(in), optional  deriv 
)

Definition at line 174 of file mo_mad.f90.

◆ mad_val_dp()

real(dp) function, dimension(size(arr)) mo_mad::mad::mad_val_dp ( real(dp), dimension(:), intent(in)  arr,
real(dp), intent(in), optional  z,
logical, dimension(:), intent(in), optional  mask,
character(1)  tout,
real(dp), intent(in), optional  mval 
)

Definition at line 243 of file mo_mad.f90.

◆ mad_val_sp()

real(sp) function, dimension(size(arr)) mo_mad::mad::mad_val_sp ( real(sp), dimension(:), intent(in)  arr,
real(sp), intent(in), optional  z,
logical, dimension(:), intent(in), optional  mask,
character(1)  tout,
real(sp), intent(in), optional  mval 
)

Definition at line 306 of file mo_mad.f90.


The documentation for this interface was generated from the following file: