diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e92bb92b003cd1ed94cf9bc9ebfa7bf39b0852d..aa69ca2e1d27e15df48927d1aa2f43aa81ae02ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,23 @@ # Changelog All notable changes to this project will be documented in this file. -## v0.2.0 - 2022-01-03 - second experimental release of the package +## v0.3.0 - 2022-12-20 - quantile regression, new package structure + +### general: +* added trend detection methods +* restructured the package +* performance enhancements + +### new features: +* added quantile regression +* added ordinary least squares regression + +### technical: +* added new tests for better coverage +* use series objects internally +* metrics and trends are subpackages of toarstats + +## v0.2.0 - 2022-01-03 - new interface, user input checks ### general: * new interface: calculate_statistics @@ -13,7 +29,7 @@ All notable changes to this project will be documented in this file. ### technical: * constants and defaults are in their own separate modules -## v0.1.0 - 2021-09-05 - first experimental release of the package +## v0.1.0 - 2021-09-05 - first experimental release, 50 metrics included ### general: * first working version is implemented diff --git a/README.md b/README.md index 42cdb4f793c60afe72e8408dc2c8fba5dc0aea93..3cd383cb29edbe589f7796361737508779484757 100644 --- a/README.md +++ b/README.md @@ -121,3 +121,38 @@ calculate_statistics( missing in the ``metadata`` argument """ ``` + +## trends + +This subpackage contains a collection of regression methods. + +### Import + +To use the package import `calculate_trend` with: +``` +from toarstats.trends import calculate_trend # or +from toarstats.trends import * # or +import toarstats.trends +``` + +### Interface + +The `calculate_trend` interface is defined like this: +``` +calculate_trend(method, data, formula="value ~ datetime", quantiles=None): + """Calculate the trend using the requested method. + + This function is the public interface for the ``trends`` subpackage. + It takes all the user inputs and returns the result of the requested + trend analysis. + + :param method: either ``"OLS"`` or ``"quant"`` + :param data: data containing a list of date time values and + associated parameter values on which to calculate the + trend + :param formula: the formula specifying the model + :param quantiles: a single quantile or a list of quantiles to + calculate, these must be between 0 and 1; only + needed when ``method="quant"`` + """ +``` diff --git a/dist/toarstats-0.3.0-py3-none-any.whl b/dist/toarstats-0.3.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..00d23d567deab91fe0535d9a9d36d9754e39fd9a Binary files /dev/null and b/dist/toarstats-0.3.0-py3-none-any.whl differ diff --git a/docs/conf.py b/docs/conf.py index 3fd347767ea0519a0944d1ab2f42687832cc35f4..1a3be1966e1eeeb3a29bf9baa6f03b55fd3a1763 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,55 +1,33 @@ # Configuration file for the Sphinx documentation builder. # -# This file only contains a selection of the most common options. For a full -# list see the documentation: +# For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. - -import os -import sys -sys.path.insert(0, os.path.abspath('..')) - - # -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'toarstats' copyright = '2021, Forschungszentrum Jülich GmbH' author = 'Niklas Selke' +release = '0.3.0' -# The full version, including alpha/beta/rc tags -release = '0.2.0' +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration +import os +import sys -# -- General configuration --------------------------------------------------- +sys.path.insert(0, os.path.abspath('..')) -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['sphinx.ext.autodoc' -] +extensions = ['sphinx.ext.autodoc'] -# Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + # -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# html_theme = 'alabaster' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst index 1eaeda345beeef44d4d7c36716e6f31b29abe61d..479abb1e8961f8ffa13f762c2ed511075d87db66 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,6 +3,8 @@ Welcome to toarstats's documentation! .. autofunction:: toarstats.metrics.interface.calculate_statistics +.. autofunction:: toarstats.trends.interface.calculate_trend + .. toctree:: :maxdepth: 2 :caption: Contents: diff --git a/requirements.txt b/requirements.txt index 8dbcd3f4ef70695f3d032cfa366aa245bf6eddd6..21f936d8220844c372ec36a6d8ad75223957d4a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ -numpy==1.22.0 -pandas==1.3.5 +numpy==1.24.0 +pandas==1.5.2 +statsmodels==0.13.5 diff --git a/setup.cfg b/setup.cfg index 59561735e6341a6945a0e1eda2d681689c9b2c91..1512ab1c8b5486667deffcab222e1f9bc74f3b87 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = toarstats -version = 0.2.0 +version = 0.3.0 author = Niklas Selke author_email = n.selke@fz-juelich.de description = Collection of statistics for the TOAR community @@ -8,17 +8,23 @@ long_description = file: README.md long_description_content_type = text/markdown url = https://gitlab.jsc.fz-juelich.de/esde/toar-public/toarstats classifiers = + Development Status :: 4 - Beta + License :: OSI Approved :: MIT License + Operating System :: OS Independent Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 - License :: OSI Approved :: MIT License - Operating System :: OS Independent + Programming Language :: Python :: 3.11 [options] -packages = toarstats -python_requires = >=3.6 +packages = + toarstats + toarstats/metrics + toarstats/trends +python_requires = >=3.7 install_requires = pandas>=1.0 + statsmodels>=0.13