.gear/lmoments3.spec | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ .gear/rules | 3 ++ .gear/tags/list | 1 + .gear/upstream/remotes | 3 ++ lmoments3/__init__.py | 26 ++++++++-------- 5 files changed, 103 insertions(+), 13 deletions(-) diff --git a/.gear/lmoments3.spec b/.gear/lmoments3.spec new file mode 100644 index 0000000..57f7a79 --- /dev/null +++ b/.gear/lmoments3.spec @@ -0,0 +1,83 @@ +%define _unpackaged_files_terminate_build 1 +%define oname lmoments3 + +# The frechet_l and frechet_r distributions were removed. +# They were deprecated since SciPy 1.0 +%def_without check + +Name: python3-module-%oname +Version: 1.0.4 +Release: alt3 +Summary: Estimate linear moments for statistical distribution functions +License: GPLv3 +Group: Development/Python3 +Url: https://pypi.org/project/lmoments3/ + +# https://github.com/OpenHydrology/lmoments3.git +Source: %name-%version.tar +Patch: %name-%version-alt.patch + +BuildArch: noarch + +BuildRequires(pre): rpm-build-python3 + +%if_with check +BuildPreReq: python3(nose) +BuildPreReq: python3(numpy) +BuildPreReq: python3(numpy.testing) +BuildPreReq: python3(scipy) +%endif + +%description +This library was designed to use L-moments to calculate optimal +parameters for a number of distributions. This library extends a number +of scipy distributions and provides some additional distributions +frequently used in Extreme Value Analyses. + +%prep +%setup +%patch -p1 + +# workaround for versioneer +grep -qsF ' export-subst' .gitattributes || exit 1 +vers_f="$(sed -n 's/ export-subst//p' .gitattributes)" +if [ "$(grep -cF 'git_refnames = " (tag: v%version, upstream/master)"' $vers_f)" -eq 0 ]; then + grep -qs '^[ ]*git_refnames[ ]*=[ ]*""[ ]*$' "$vers_f" || exit 1 + sed -i 's/^\([ ]*\)git_refnames[ ]*=[ ]*""[ ]*$/\1git_refnames = " (tag: v%version, upstream\/master)"/' "$vers_f" +fi + +%build +%python3_build_debug + +%install +%python3_install + +%check +nosetests3 -v + +%files +%doc CHANGELOG.txt *.rst docs/source/*.rst +%python3_sitelibdir/%oname/ +%python3_sitelibdir/%oname-%version-py%_python3_version.egg-info/ + +%changelog +* Sat Apr 03 2021 Grigory Ustinov 1.0.4-alt3 +- Fixed FTBFS by disabling tests, which use obsoleted api. + +* Tue Sep 29 2020 Stanislav Levin 1.0.4-alt2 +- Fixed FTBFS. + +* Thu Oct 03 2019 Stanislav Levin 1.0.4-alt1 +- 1.0.2 -> 1.0.4. +- Fixed testing. + +* Fri Feb 02 2018 Stanislav Levin 1.0.2-alt1.git20150211.1.1 +- (NMU) Fix Requires and BuildRequires to python-setuptools + +* Mon Mar 14 2016 Ivan Zakharyaschev 1.0.2-alt1.git20150211.1 +- (NMU) rebuild with rpm-build-python3-0.1.9 + (for common python3/site-packages/ and auto python3.3-ABI dep when needed) + +* Tue Apr 21 2015 Eugeny A. Rostovtsev (REAL) 1.0.2-alt1.git20150211 +- Initial build for Sisyphus + diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..f583260 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +spec: .gear/lmoments3.spec +tar: v@version@:. +diff: v@version@:. . name=@name@-@version@-alt.patch diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..fcf491c --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +435a7c5430708a71c26daa3509ec986fb0ffb167 v1.0.4 diff --git a/.gear/upstream/remotes b/.gear/upstream/remotes new file mode 100644 index 0000000..8800d9e --- /dev/null +++ b/.gear/upstream/remotes @@ -0,0 +1,3 @@ +[remote "upstream"] + url = https://github.com/OpenHydrology/lmoments3.git + fetch = +refs/heads/*:refs/remotes/upstream/* diff --git a/lmoments3/__init__.py b/lmoments3/__init__.py index 99441f4..a09f3b8 100644 --- a/lmoments3/__init__.py +++ b/lmoments3/__init__.py @@ -62,7 +62,7 @@ from ._version import get_versions __version__ = get_versions()['version'] del get_versions -import scipy.misc as sm +import scipy.special import numpy as np @@ -99,7 +99,7 @@ def _samlmularge(x, nmom=5): raise ValueError("Insufficient length of data for specified nmoments") ##Calculate first order - l = [np.sum(x) / sm.comb(n, 1, exact=True)] + l = [np.sum(x) / scipy.special.comb(n, 1, exact=True)] if nmom == 1: return l[0] @@ -109,10 +109,10 @@ def _samlmularge(x, nmom=5): for i in range(1, nmom): comb.append([]) for j in range(n): - comb[-1].append(sm.comb(j, i, exact=True)) + comb[-1].append(scipy.special.comb(j, i, exact=True)) for mom in range(2, nmom + 1): - coefl = 1.0 / mom * 1.0 / sm.comb(n, mom, exact=True) + coefl = 1.0 / mom * 1.0 / scipy.special.comb(n, mom, exact=True) xtrans = [] for i in range(0, n): coeftemp = [] @@ -126,7 +126,7 @@ def _samlmularge(x, nmom=5): coeftemp[j] = coeftemp[j] * comb[j - 1][n - i - 1] for j in range(0, mom): - coeftemp[j] = coeftemp[j] * sm.comb(mom - 1, j, exact=True) + coeftemp[j] = coeftemp[j] * scipy.special.comb(mom - 1, j, exact=True) for j in range(0, int(0.5 * mom)): coeftemp[j * 2 + 1] = -coeftemp[j * 2 + 1] @@ -156,7 +156,7 @@ def _samlmusmall(x, nmom=5): # First L-moment - l1 = np.sum(x) / sm.comb(n, 1, exact=True) + l1 = np.sum(x) / scipy.special.comb(n, 1, exact=True) if nmom == 1: return l1 @@ -164,7 +164,7 @@ def _samlmusmall(x, nmom=5): # Second L-moment comb1 = range(n) - coefl2 = 0.5 / sm.comb(n, 2, exact=True) + coefl2 = 0.5 / scipy.special.comb(n, 2, exact=True) sum_xtrans = sum([(comb1[i] - comb1[n - i - 1]) * x[i] for i in range(n)]) l2 = coefl2 * sum_xtrans @@ -173,8 +173,8 @@ def _samlmusmall(x, nmom=5): # Third L-moment - comb3 = [sm.comb(i, 2, exact=True) for i in range(n)] - coefl3 = 1.0 / 3.0 / sm.comb(n, 3, exact=True) + comb3 = [scipy.special.comb(i, 2, exact=True) for i in range(n)] + coefl3 = 1.0 / 3.0 / scipy.special.comb(n, 3, exact=True) sum_xtrans = sum([(comb3[i] - 2 * comb1[i] * comb1[n - i - 1] + comb3[n - i - 1]) * x[i] for i in range(n)]) l3 = coefl3 * sum_xtrans / l2 @@ -183,8 +183,8 @@ def _samlmusmall(x, nmom=5): # Fourth L-moment - comb5 = [sm.comb(i, 3, exact=True) for i in range(n)] - coefl4 = 0.25 / sm.comb(n, 4, exact=True) + comb5 = [scipy.special.comb(i, 3, exact=True) for i in range(n)] + coefl4 = 0.25 / scipy.special.comb(n, 4, exact=True) sum_xtrans = sum( [(comb5[i] - 3 * comb3[i] * comb1[n - i - 1] + 3 * comb1[i] * comb3[n - i - 1] - comb5[n - i - 1]) * x[i] for i in range(n)]) @@ -195,8 +195,8 @@ def _samlmusmall(x, nmom=5): # Fifth L-moment - comb7 = [sm.comb(i, 4, exact=True) for i in range(n)] - coefl5 = 0.2 / sm.comb(n, 5, exact=True) + comb7 = [scipy.special.comb(i, 4, exact=True) for i in range(n)] + coefl5 = 0.2 / scipy.special.comb(n, 5, exact=True) sum_xtrans = sum( [(comb7[i] - 4 * comb5[i] * comb1[n - i - 1] + 6 * comb3[i] * comb3[n - i - 1] - 4 * comb1[i] * comb5[n - i - 1] + comb7[n - i - 1]) * x[i]