f_sts_pcc Function

public impure function f_sts_pcc(x, y) result(corr)

Impure wrapper function for f_sts_trend_core.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)

x vector (assumed size array)

real(kind=wp), intent(in) :: y(:)

y vector (assumed size array)

Return Value real(kind=wp)

Pearson correlation coefficient


Calls

proc~~f_sts_pcc~~CallsGraph proc~f_sts_pcc f_sts_pcc proc~f_sts_pcc_core f_sts_pcc_core proc~f_sts_pcc->proc~f_sts_pcc_core proc~s_err_print s_err_print proc~f_sts_pcc->proc~s_err_print proc~f_sts_cov_core f_sts_cov_core proc~f_sts_pcc_core->proc~f_sts_cov_core proc~f_sts_var_core f_sts_var_core proc~f_sts_pcc_core->proc~f_sts_var_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c proc~f_sts_mean_core f_sts_mean_core proc~f_sts_cov_core->proc~f_sts_mean_core proc~f_sts_var_core->proc~f_sts_mean_core

Called by

proc~~f_sts_pcc~~CalledByGraph proc~f_sts_pcc f_sts_pcc interface~fsml_pcc fsml_pcc interface~fsml_pcc->proc~f_sts_pcc

Source Code

impure function f_sts_pcc(x, y) result(corr)

! ==== Description
!! Impure wrapper function for `f_sts_trend_core`.

! ==== Declarations
  real(wp), intent(in) :: x(:)   !! x vector (assumed size array)
  real(wp), intent(in) :: y(:)   !! y vector (assumed size array)
  real(wp)             :: corr   !! Pearson correlation coefficient

! ==== Instructions

! ---- handle input

  ! check if size is valid
  if (size(x) .le. 1) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(4))
     corr = c_sentinel_r
     return
  endif

  ! check if x and y have same size
  if (size(x) .ne. size(y)) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(4))
     corr = c_sentinel_r
     return
  endif

! ---- compute Pearson correlation coefficient

  ! call pure function
  corr = f_sts_pcc_core(x,y)

end function f_sts_pcc