pyesmda.distances_to_weights_fifth_order

pyesmda.distances_to_weights_fifth_order(distances: numpy.ndarray[Any, numpy.dtype[numpy.float64]], scaling_factor: float = 1.0) numpy.ndarray[Any, numpy.dtype[numpy.float64]][source]

Transform the distances into weights between 0 and 1 with a fifth order function.

\[\begin{split}f(z) = \begin{cases} 0 & z < 0 \\ \dfrac{-1}{4} z^{5} + \dfrac{1}{2} z^{4} + \dfrac{5}{8} z^{3} - \dfrac{5}{3} z^{2} + 1 & 0 \leq z \leq 1\\ \dfrac{1}{12} z^{5} - \dfrac{1}{2} z^{4} + \dfrac{5}{8} z^{3} + \dfrac{5}{3} z^{2} - 5z + 4 - \dfrac{2}{3} z^{-1} & 1 \leq z \leq 2\\ \end{cases}\end{split}\]

with \(z = \dfrac{d}{s}\), \(d\) the distances, and \(s\) the scaling factor.

See [Gaspari and Cohn, 1999].

Parameters
  • distances (NDArrayFloat) – Input distances values.

  • scaling_factor (float, optional) – Scaling factor. It is roughly the distance at which weights go under 0.25. The default is 1.0.

Returns

Array of same dimension as input array.

Return type

NDArrayFloat.