Skip to content

Commit

Permalink
Merge pull request #25 from pastas/dev
Browse files Browse the repository at this point in the history
Release 0.3.0
  • Loading branch information
martinvonk authored Feb 19, 2024
2 parents e30c0bb + db3200f commit d8aef35
Show file tree
Hide file tree
Showing 24 changed files with 924 additions and 706 deletions.
106 changes: 75 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,93 @@
name: metran

on:
# Trigger the workflow on push or pull request on master,
# and only on pull-requests on dev branch
push:
branches:
- main
pull_request:
branches:
- main
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
include:
- name: Test suite with py38-ubuntu
python: "3.8"
os: ubuntu-latest
toxenv: py38
experimental: false
- name: Test suite with py39-ubuntu
python: "3.9"
os: ubuntu-latest
toxenv: py39
experimental: false
- name: Test suite with py310-ubuntu
python: "3.10"
os: ubuntu-latest
toxenv: py310
experimental: false
- name: Test suite with py311-ubuntu
python: "3.11"
os: ubuntu-latest
toxenv: py311
experimental: false
- name: Test suite with py312-ubuntu
python: "3.12-dev"
os: ubuntu-latest
toxenv: py312
experimental: true
- name: Formatting with black + isort
python: "3.9"
os: ubuntu-latest
toxenv: format
experimental: false
- name: Linting with flake8
python: "3.9"
os: ubuntu-latest
toxenv: lint
experimental: false
- name: Codacy Coverage Report
python: "3.9"
os: ubuntu-latest
toxenv: coverage
experimental: false

name: ${{ matrix.name }}
env:
# Color Output
# Rich (pip)
FORCE_COLOR: 1
# Tox
PY_COLORS: 1
# MyPy
TERM: xterm-color
MYPY_FORCE_COLOR: 1
MYPY_FORCE_TERMINAL_WIDTH: 200
# Pytest
PYTEST_ADDOPTS: "--color=yes"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python }}
check-latest: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install codecov
pip install pytest-cov
pip install pytest-dependency
pip install codacy-coverage
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics
- name: Run pytest
run: |
pytest
pip install tox
- name: Setup tox environment
run: tox -e ${{ matrix.toxenv }} --notest

- name: Test
run: tox -e ${{ matrix.toxenv }} --skip-pkg-install

- name: Run codacy-coverage-reporter
if: ${{ matrix.toxenv == 'coverage' && github.repository == 'pastas/metran' && success() }}
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python3 -m build
python3 -m twine upload --repository pypi dist/*
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: "3.8"
install:
- requirements: docs/requirements.txt
- method: pip
path: .

Expand Down
61 changes: 27 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,52 @@

# Metran

Metran is a package for performing multivariate timeseries analysis using a
technique called dynamic factor modelling. It can be used to describe the
variation among many variables in terms of a few underlying but unobserved
Metran is a package for performing multivariate timeseries analysis using a
technique called dynamic factor modelling. It can be used to describe the
variation among many variables in terms of a few underlying but unobserved
variables called factors.

## Installation
## Documentation

To install Metran, a working version of Python 3.7 or 3.8 has to be installed on your computer.
We recommend using the Anaconda Distribution with Python 3.8 as it includes most
of the python package dependencies and the Jupyter Notebook software to run the
notebooks. However, you are free to install any Python distribution you want.
The documention can be found on [metran.readthedocs.io](https://metran.readthedocs.io/)

To install `metran`, type the following command
### Examples

`pip install metran`
For a brief introduction of the theory behind Metran on multivariate timeseries analysis with
dynamic factor modeling see the notebook:

To install in development mode, clone the repository and type the following from the module root directory:
- [The Dynamic Factor Model](https://github.com/pastas/metran/blob/main/examples/dynamic_factor_model.ipynb)

`pip install -e .`
A practical real-world example, as published in Stromingen (Van Geer, 2015), is given in the following notebook:

## Documentation
- [Metran practical example](https://github.com/pastas/metran/blob/main/examples/metran_practical_example.ipynb)

The docs can be viewed [here](https://metran.readthedocs.io/).
A notebook on how to use [Pastas](https://github.com/pastas/pastas) models output with Metran:

## Examples
- [Pastas Metran example](https://github.com/pastas/metran/blob/main/examples/pastas_metran_example.ipynb)

For a brief introduction of the theory behind Metran on multivariate timeseries analysis with
dynamic factor modeling see the notebook:
## Installation

- [The Dynamic Factor Model](https://github.com/pastas/metran/blob/main/examples/dynamic_factor_model.ipynb)
To install Metran, a working version of Python 3.8 or higher has to be installed on your computer.
We recommend using the [Anaconda distribution](https://www.anaconda.com/) as it includes most
of the python package dependencies and the Jupyter Notebook software to run the
notebooks. However, you are free to install any Python distribution you want.

A practical real-world example, as published in Stromingen (Van Geer, 2015), is given in the following notebook:
To install `metran`, type the following command

- [Metran practical example](https://github.com/pastas/metran/blob/main/examples/metran_practical_example.ipynb)
`pip install metran`

A notebook on how to use [Pastas](https://github.com/pastas/pastas) models output with Metran:
To install in development mode, clone the repository and type the following from the module root directory:

- [Pastas Metran example](https://github.com/pastas/metran/blob/main/examples/pastas_metran_example.ipynb)
`pip install -e .`

## Dependencies
### Dependencies

Metran has the following dependencies which are automatically installed if
not already available:

- numpy>=1.16.5
- pandas>=1.0
- scipy>=1.1
- matplotlib>=3.0
- pastas>=0.16.0
- numba
not already available: `numpy`, `scipy`, `pandas`, `matplotlib`, `numba` and `pastas`

## References

- Berendrecht, W.L. (2004). State space modeling of groundwater fluctuations.
- Berendrecht, W.L., F.C. van Geer (2016). A dynamic factor modeling framework for analyzing multiple groundwater head series simultaneously, Journal of Hydrology, 536, pp. 50-60, doi:<http://dx.doi.org/10.1016/j.jhydrol.2016.02.028>.
- Van Geer, F.C. en W.L. Berendrecht (2015) Meervoudige tijdreeksmodellen en de samenhang in stijghoogtereeksen. Stromingen 23 nummer 3, pp. 25-36.
- Berendrecht, W.L. (2004). [State space modeling of groundwater fluctuations](https://repository.tudelft.nl/islandora/object/uuid:f12775fc-a804-4d4a-8872-664e5a61cbf5/datastream/OBJ). Doctoral Thesis, Delft University of Technology.
- Berendrecht, W.L., F.C. van Geer (2016). [A dynamic factor modeling framework for analyzing multiple groundwater head series simultaneously](http://dx.doi.org/10.1016/j.jhydrol.2016.02.028). Journal of Hydrology, 536, pp. 50-60.
- Van Geer, F.C. en W.L. Berendrecht (2015) [Meervoudige tijdreeksmodellen en de samenhang in stijghoogtereeksen](https://edepot.wur.nl/378871). Stromingen 23 nummer 3, pp. 25-36.
59 changes: 29 additions & 30 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
import os
import sys

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath("."))
from metran import __version__


# -- Project information -----------------------------------------------------

project = 'metran'
copyright = '2021, W.L. Berendrecht'
author = 'W.L. Berendrecht'
project = "metran"
copyright = "2021, W.L. Berendrecht"
author = "W.L. Berendrecht"

# The short X.Y version
version = __version__
Expand All @@ -34,54 +33,54 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'IPython.sphinxext.ipython_console_highlighting', # lowercase didn't work
'sphinx.ext.autosectionlabel',
'nbsphinx',
'nbsphinx_link'
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"IPython.sphinxext.ipython_console_highlighting", # lowercase didn't work
"sphinx.ext.autosectionlabel",
"nbsphinx",
"nbsphinx_link",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
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']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- 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 = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

html_theme_options = {
'display_version': True,
'prev_next_buttons_location': 'bottom',
"display_version": True,
"prev_next_buttons_location": "bottom",
# 'style_external_links': False,
# 'vcs_pageview_mode': '',
# 'style_nav_header_background': 'white',
# Toc options
'collapse_navigation': False,
'sticky_navigation': False,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False,
"collapse_navigation": False,
"sticky_navigation": False,
"navigation_depth": 4,
"includehidden": True,
"titles_only": False,
"github_url": "https://github.com/pastas/metran",
}

# 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']
html_static_path = ["_static"]
Loading

0 comments on commit d8aef35

Please sign in to comment.