Skip to content

Commit

Permalink
Merge pull request #7 from Ouranosinc/prepare_v104
Browse files Browse the repository at this point in the history
Prepare v1.0.4
  • Loading branch information
Zeitsperre committed Feb 28, 2023
2 parents 2a8bfff + de947f7 commit 9b36cb9
Show file tree
Hide file tree
Showing 4 changed files with 1,507 additions and 710 deletions.
23 changes: 12 additions & 11 deletions CHANGELOG.rst
Expand Up @@ -2,14 +2,15 @@
Changelog
=========

version 1.0.4 (unreleased)
version 1.0.4 (2023-02-28)
--------------------------
- Rename `frechet_r_gen` to `weibull_min_r`, `frechet_r` being deprecated with SciPy 1.6
- Migrated organisations from OpenHydrology to Ouranosinc:
* Added Continuous Integration checks, pre-commit configurations, package metadata adjustments
* Code style now follows Black v2023.1
* ReadTheDocs documentation for lmoments3 no longer nested within OpenHydrology
* Documentation is now structured across pages
- Updated versioneer to v0.28

version 1.0.3 (2015-09-24)
--------------------------
Expand All @@ -31,30 +32,30 @@ version 1.0.0 (2014-12-01)
- Replaced many functions by standard scipy implementations
- General bugfixes, code improvements and test

version 0.3.1 (25/09/14)
------------------------
version 0.3.1 (2014-09-25)
--------------------------
- Fixed setup
- Refactored unit tests

version 0.3.0 (24/09/14)
------------------------
version 0.3.0 (2014-09-24)
--------------------------
- First release for Python 3.x

version 0.2.2 (23/01/14)
------------------------
version 0.2.2 (2014-09-23)
--------------------------
- Improved samlmu function to support any value of nmom
- Added Bayesian Information Criterion (BIC) function
- Fixed import glitch that allowed users to import container files
- General Bugfixes

version 0.2.1 (15/01/14)
------------------------
version 0.2.1 (2014-01-15)
--------------------------
- Support for lists as F inputs for all QUA functions
- Added Random Number Generator (rand) for all functions
- Split the main lmoments.py file into several files, as the project is getting to large to maintain as one single file.

version 0.2.0 (13/01/14)
------------------------
version 0.2.0 (2014-01-13)
--------------------------
- Added Probability Density Functions (PDF)
- Added Reverse Lmoment Estimation Functions (LMOM)
- Added Negative Log-Likelihood Function (NlogL)
Expand Down
20 changes: 9 additions & 11 deletions lmoments3/__init__.py
@@ -1,3 +1,4 @@
# noqa: D205, D400, D404,
"""
This file contains a Python implementation of the lmoments.f library created by
J. R. M. HOSKING.
Expand Down Expand Up @@ -57,27 +58,24 @@
"""

from ._version import get_versions

__version__ = get_versions()["version"]
del get_versions

import numpy as np
import scipy.special

from . import _version

__version__ = _version.get_versions()["version"]


def lmom_ratios(data, nmom=5):
"""
Estimate `nmom` number of L-moments from a sample `data`.
"""Estimate `nmom` number of L-moments from a sample `data`.
:param data: Sequence of (sample) data
:type data: list or array-like sequence
:param nmom: number of L-moments to estimate
:type nmom: int
:return: L-moment ratios like this: l1, l2, t3, t4, t5, .. . As in: items 3 and higher are L-moment ratios.
:return: L-moment ratios like this: l1, l2, t3, t4, t5, .. . As in: items 3 and higher are L-moment ratios. # noqa: E501
:rtype: list
"""

if nmom <= 5:
return _samlmusmall(data, nmom)
else:
Expand All @@ -98,8 +96,8 @@ def _samlmularge(x, nmom=5):
if n < nmom:
raise ValueError("Insufficient length of data for specified nmoments")

##Calculate first order
l = [np.sum(x) / scipy.special.comb(n, 1, exact=True)]
# Calculate first order
l = [np.sum(x) / scipy.special.comb(n, 1, exact=True)] # noqa: E741

if nmom == 1:
return l[0]
Expand Down

0 comments on commit 9b36cb9

Please sign in to comment.