f_dst_gpd_ppf Function

public impure function f_dst_gpd_ppf(p, xi, mu, sigma) result(x)

Impure wrapper function for f_dst_gpd_ppf_core. Handles optional arguments and invalid values for arguments.

Arguments

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

probability between 0.0 - 1.0

real(kind=wp), intent(in), optional :: xi

distribution shape parameter

real(kind=wp), intent(in), optional :: mu

distribution location

real(kind=wp), intent(in), optional :: sigma

distribution dispersion/scale (must be positive)

Return Value real(kind=wp)

sample position


Calls

proc~~f_dst_gpd_ppf~~CallsGraph proc~f_dst_gpd_ppf f_dst_gpd_ppf proc~f_dst_gpd_ppf_core f_dst_gpd_ppf_core proc~f_dst_gpd_ppf->proc~f_dst_gpd_ppf_core proc~s_err_print s_err_print proc~f_dst_gpd_ppf->proc~s_err_print proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c

Called by

proc~~f_dst_gpd_ppf~~CalledByGraph proc~f_dst_gpd_ppf f_dst_gpd_ppf interface~fsml_gpd_ppf fsml_gpd_ppf interface~fsml_gpd_ppf->proc~f_dst_gpd_ppf

Source Code

impure function f_dst_gpd_ppf(p, xi, mu, sigma) result(x)

! ==== Description
!! Impure wrapper function for `f_dst_gpd_ppf_core`.
!! Handles optional arguments and invalid values for arguments.

! ==== Declarations
  real(wp)        , intent(in)           :: p       !! probability between 0.0 - 1.0
  real(wp)        , intent(in), optional :: mu      !! distribution location
  real(wp)        , intent(in), optional :: sigma   !! distribution dispersion/scale (must be positive)
  real(wp)        , intent(in), optional :: xi      !! distribution shape parameter
  real(wp)                               :: mu_w    !! final value of mu
  real(wp)                               :: sigma_w !! final value of sigma
  real(wp)                               :: x       !! sample position

! ==== Instructions

! ---- handle input

  ! assume location/mean = 0, overwrite if specified
  mu_w = 0.0_wp
  if (present(mu)) mu_w = mu

  ! assume sigma = 1, overwrite if specified
  sigma_w = 1.0_wp
  if (present(sigma)) sigma_w = sigma

  ! check if sigma value is valid
  if (sigma_w .le. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(1))
     x = c_sentinel_r
     return
  endif

  ! check if p value is valid
  if (p .gt. 1.0_wp .or. p .lt. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(1))
     x = c_sentinel_r
     return
  endif

! ---- compute PPF

  ! call pure function to calculate x
  x = f_dst_gpd_ppf_core(p, xi, mu_w, sigma_w)

end function f_dst_gpd_ppf