From 6c94d18a07da5464ded90f2516e240ef0a26af98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 16 Apr 2023 12:35:12 +0200 Subject: [PATCH 1/5] move to src based structure; add archive support --- .git_archival.txt | 4 + .gitattributes | 1 + .gitignore | 130 ++++++++++++++++-- MANIFEST.in | 10 +- pyproject.toml | 83 +++++++++-- setup.cfg | 67 --------- {anaflow => src/anaflow}/__init__.py | 0 {anaflow => src/anaflow}/flow/__init__.py | 0 .../anaflow}/flow/ext_grf_model.py | 0 .../anaflow}/flow/heterogeneous.py | 0 {anaflow => src/anaflow}/flow/homogeneous.py | 0 {anaflow => src/anaflow}/flow/laplace.py | 0 {anaflow => src/anaflow}/tools/__init__.py | 0 .../anaflow}/tools/coarse_graining.py | 0 {anaflow => src/anaflow}/tools/laplace.py | 0 {anaflow => src/anaflow}/tools/mean.py | 0 {anaflow => src/anaflow}/tools/special.py | 0 17 files changed, 202 insertions(+), 93 deletions(-) create mode 100644 .git_archival.txt create mode 100644 .gitattributes delete mode 100644 setup.cfg rename {anaflow => src/anaflow}/__init__.py (100%) rename {anaflow => src/anaflow}/flow/__init__.py (100%) rename {anaflow => src/anaflow}/flow/ext_grf_model.py (100%) rename {anaflow => src/anaflow}/flow/heterogeneous.py (100%) rename {anaflow => src/anaflow}/flow/homogeneous.py (100%) rename {anaflow => src/anaflow}/flow/laplace.py (100%) rename {anaflow => src/anaflow}/tools/__init__.py (100%) rename {anaflow => src/anaflow}/tools/coarse_graining.py (100%) rename {anaflow => src/anaflow}/tools/laplace.py (100%) rename {anaflow => src/anaflow}/tools/mean.py (100%) rename {anaflow => src/anaflow}/tools/special.py (100%) diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000..8fb235d --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..00a7b00 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst diff --git a/.gitignore b/.gitignore index 3991d94..ce93941 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,121 @@ -*.pyc -*.orig -*~ -.spyproject/ +# Byte-compiled / optimized / DLL files __pycache__/ -docs/build/ -docs/source/generated/ -docs/source/examples/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# IDE project settings +.spyderproject +.spyproject +.vscode + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +tags +/test_* + +# own stuff info/ -#_build -#_static -#_templates -#docs/ + +# Cython generated C code +*.c + +# JOSS stuff +paper/compile + +# setuptools_scm generated version files +src/anaflow/_version.py + +# generated docs +docs/source/examples/ +docs/source/api/ diff --git a/MANIFEST.in b/MANIFEST.in index ffe9e94..15fa4ed 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,4 @@ -prune * -graft anaflow -graft tests - -include LICENSE README.md pyproject.toml setup.cfg -global-exclude __pycache__ *.py[cod] .* +prune ** +recursive-include tests *.py +recursive-include src/anaflow *.py +include LICENSE README.md pyproject.toml diff --git a/pyproject.toml b/pyproject.toml index de68c82..cb46f56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,25 +1,90 @@ [build-system] requires = [ - "setuptools>=42", - "wheel", - "setuptools_scm[toml]>=3.5", + "setuptools>=64", + "setuptools_scm>=7", ] build-backend = "setuptools.build_meta" +[project] +requires-python = ">=3.7" +name = "anaflow" +authors = [{name = "Sebastian Mueller", email = "sebastian.mueller@ufz.de"}] +readme = "README.md" +license = {text = "MIT"} +dynamic = ["version"] +description = "AnaFlow - analytical solutions for the groundwater-flow equation." +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: MacOS", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: Unix", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Scientific/Engineering", + "Topic :: Software Development", + "Topic :: Utilities", +] +dependencies = [ + "numpy>=1.14.5", + "pentapy>=1.1.0", + "scipy>=1.1.0", +] + +[project.optional-dependencies] +doc = [ + "m2r2>=0.2.8", + "matplotlib>=3", + "numpydoc>=1.1", + "sphinx>=4", + "sphinx-gallery>=0.8", + "sphinx-rtd-theme>=1,<1.1", +] +test = ["pytest-cov>=3"] +check = [ + "black>=23,<24", + "isort[colors]<6", + "pylint<3", +] + +[project.urls] +Homepage = "https://github.com/GeoStat-Framework/AnaFlow" +Documentation = "https://anaflow.readthedocs.io" +Source = "https://github.com/GeoStat-Framework/anaflow" +Tracker = "https://github.com/GeoStat-Framework/anaflow/issues" +Changelog = "https://github.com/GeoStat-Framework/anaflow/blob/main/CHANGELOG.md" +Conda-Forge = "https://anaconda.org/conda-forge/anaflow" + +[tool.setuptools] +license-files = ["LICENSE"] + [tool.setuptools_scm] -write_to = "anaflow/_version.py" +write_to = "src/anaflow/_version.py" write_to_template = "__version__ = '{version}'" local_scheme = "no-local-version" fallback_version = "0.0.0.dev0" +[tool.isort] +profile = "black" +multi_line_output = 3 +line_length = 79 + [tool.black] exclude = "_version.py" line-length = 79 -target-version = [ - "py36", - "py37", - "py38", -] +target-version = ["py37"] [tool.coverage] [tool.coverage.run] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ac032b0..0000000 --- a/setup.cfg +++ /dev/null @@ -1,67 +0,0 @@ -[metadata] -name = anaflow -description = AnaFlow - analytical solutions for the groundwater-flow equation. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/GeoStat-Framework/AnaFlow -author = Sebastian Mueller -author_email = sebastian.mueller@ufz.de -maintainer = Sebastian Mueller -maintainer_email = sebastian.mueller@ufz.de -license = MIT -license_file = LICENSE -platforms = any -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - Intended Audience :: End Users/Desktop - Intended Audience :: Science/Research - License :: OSI Approved :: MIT License - Natural Language :: English - Operating System :: MacOS - Operating System :: MacOS :: MacOS X - Operating System :: Microsoft - Operating System :: Microsoft :: Windows - Operating System :: POSIX - Operating System :: Unix - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Topic :: Scientific/Engineering - Topic :: Software Development - Topic :: Utilities -project_urls = - Documentation = https://anaflow.readthedocs.io - Source = https://github.com/GeoStat-Framework/anaflow - Tracker = https://github.com/GeoStat-Framework/anaflow/issues - Changelog = https://github.com/GeoStat-Framework/anaflow/blob/main/CHANGELOG.md - Conda-Forge = https://anaconda.org/conda-forge/anaflow - -[options] -packages = find: -install_requires = - numpy>=1.14.5,<2 - pentapy>=1.1.0,<2 - scipy>=1.1.0,<2 -python_requires = >=3.6 -zip_safe = False - -[options.packages.find] -exclude = - tests* - docs* - -[options.extras_require] -doc = - numpydoc>=1.1 - sphinx>=3 - sphinx-gallery>=0.8 - sphinx-rtd-theme>=0.5 -test = - coverage[toml]>=5.2.1 - pytest>=6.0 - pytest-cov>=2.11.0 diff --git a/anaflow/__init__.py b/src/anaflow/__init__.py similarity index 100% rename from anaflow/__init__.py rename to src/anaflow/__init__.py diff --git a/anaflow/flow/__init__.py b/src/anaflow/flow/__init__.py similarity index 100% rename from anaflow/flow/__init__.py rename to src/anaflow/flow/__init__.py diff --git a/anaflow/flow/ext_grf_model.py b/src/anaflow/flow/ext_grf_model.py similarity index 100% rename from anaflow/flow/ext_grf_model.py rename to src/anaflow/flow/ext_grf_model.py diff --git a/anaflow/flow/heterogeneous.py b/src/anaflow/flow/heterogeneous.py similarity index 100% rename from anaflow/flow/heterogeneous.py rename to src/anaflow/flow/heterogeneous.py diff --git a/anaflow/flow/homogeneous.py b/src/anaflow/flow/homogeneous.py similarity index 100% rename from anaflow/flow/homogeneous.py rename to src/anaflow/flow/homogeneous.py diff --git a/anaflow/flow/laplace.py b/src/anaflow/flow/laplace.py similarity index 100% rename from anaflow/flow/laplace.py rename to src/anaflow/flow/laplace.py diff --git a/anaflow/tools/__init__.py b/src/anaflow/tools/__init__.py similarity index 100% rename from anaflow/tools/__init__.py rename to src/anaflow/tools/__init__.py diff --git a/anaflow/tools/coarse_graining.py b/src/anaflow/tools/coarse_graining.py similarity index 100% rename from anaflow/tools/coarse_graining.py rename to src/anaflow/tools/coarse_graining.py diff --git a/anaflow/tools/laplace.py b/src/anaflow/tools/laplace.py similarity index 100% rename from anaflow/tools/laplace.py rename to src/anaflow/tools/laplace.py diff --git a/anaflow/tools/mean.py b/src/anaflow/tools/mean.py similarity index 100% rename from anaflow/tools/mean.py rename to src/anaflow/tools/mean.py diff --git a/anaflow/tools/special.py b/src/anaflow/tools/special.py similarity index 100% rename from anaflow/tools/special.py rename to src/anaflow/tools/special.py From c9a129b2e04ad1b60b0c6e9dc85697c0047da4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 16 Apr 2023 13:00:18 +0200 Subject: [PATCH 2/5] simplify docs; run black+isort --- docs/source/_static/custom.css | 3 ++ docs/source/_templates/autosummary/class.rst | 13 ++++++++ docs/source/_templates/autosummary/module.rst | 9 +++++ docs/source/_templates/layout.html | 25 +++++++++----- docs/source/{package.rst => api.rst} | 6 ---- docs/source/changelog.rst | 1 + docs/source/conf.py | 21 ++++++++---- docs/source/contents.rst | 5 +-- docs/source/flow.laplace.rst | 11 ------- docs/source/flow.rst | 13 -------- docs/source/tools.coarse_graining.rst | 11 ------- docs/source/tools.laplace.rst | 11 ------- docs/source/tools.mean.rst | 11 ------- docs/source/tools.rst | 16 --------- docs/source/tools.special.rst | 11 ------- examples/01_call_theis.py | 2 +- examples/02_call_ext_theis2d.py | 3 +- examples/03_call_ext_theis3d.py | 4 +-- examples/04_call_ext_theis_tpl.py | 2 +- examples/05_call_neuman2004.py | 3 +- examples/06_compare_extthiem2d_grfsteady.py | 4 +-- examples/07_compare_extthiem3d_grfsteady.py | 4 +-- examples/08_compare_extthiem2d_neuman.py | 2 +- examples/09_compare_exttheis2d_neuman.py | 2 +- examples/10_convergence_ext_theis_tpl.py | 1 + examples/11_convergence_ext_grf.py | 1 + examples/12_compare_theis_quasi_steady.py | 2 +- examples/13_self_defined_transmissivity.py | 5 +-- examples/14_interval_theis.py | 2 +- examples/15_accruing_theis.py | 6 ++-- src/anaflow/__init__.py | 31 +++++++++-------- src/anaflow/flow/__init__.py | 23 ++++++------- src/anaflow/flow/ext_grf_model.py | 3 +- src/anaflow/flow/heterogeneous.py | 33 ++++++++++--------- src/anaflow/flow/homogeneous.py | 3 +- src/anaflow/flow/laplace.py | 12 ++++--- src/anaflow/tools/__init__.py | 23 ++++++------- src/anaflow/tools/coarse_graining.py | 2 +- src/anaflow/tools/laplace.py | 6 ++-- src/anaflow/tools/mean.py | 3 +- src/anaflow/tools/special.py | 16 ++++----- tests/test_anaflow.py | 3 +- 42 files changed, 164 insertions(+), 204 deletions(-) create mode 100644 docs/source/_static/custom.css create mode 100644 docs/source/_templates/autosummary/class.rst create mode 100644 docs/source/_templates/autosummary/module.rst rename docs/source/{package.rst => api.rst} (64%) create mode 100644 docs/source/changelog.rst delete mode 100644 docs/source/flow.laplace.rst delete mode 100644 docs/source/flow.rst delete mode 100644 docs/source/tools.coarse_graining.rst delete mode 100644 docs/source/tools.laplace.rst delete mode 100644 docs/source/tools.mean.rst delete mode 100644 docs/source/tools.rst delete mode 100644 docs/source/tools.special.rst diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css new file mode 100644 index 0000000..e02ca17 --- /dev/null +++ b/docs/source/_static/custom.css @@ -0,0 +1,3 @@ +dl.py.property { + display: block !important; +} diff --git a/docs/source/_templates/autosummary/class.rst b/docs/source/_templates/autosummary/class.rst new file mode 100644 index 0000000..c5c858a --- /dev/null +++ b/docs/source/_templates/autosummary/class.rst @@ -0,0 +1,13 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :undoc-members: + :inherited-members: + :show-inheritance: + +.. raw:: latex + + \clearpage diff --git a/docs/source/_templates/autosummary/module.rst b/docs/source/_templates/autosummary/module.rst new file mode 100644 index 0000000..04aefe9 --- /dev/null +++ b/docs/source/_templates/autosummary/module.rst @@ -0,0 +1,9 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ fullname }} + +.. automodule:: {{ fullname }} + +.. raw:: latex + + \clearpage diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html index 95d563e..9a5e3b2 100644 --- a/docs/source/_templates/layout.html +++ b/docs/source/_templates/layout.html @@ -4,17 +4,24 @@ {{ super() }}
- AnaFlow GitHub - AnaFlow Zenodo DOI - AnaFlow PyPI +
- GeoStat Website - GeoStat Github - GeoStat ReadTheDocs - GeoStat PyPI +

- Index - Sitemap + {% endblock %} diff --git a/docs/source/package.rst b/docs/source/api.rst similarity index 64% rename from docs/source/package.rst rename to docs/source/api.rst index bcab50b..6e812eb 100644 --- a/docs/source/package.rst +++ b/docs/source/api.rst @@ -7,9 +7,3 @@ AnaFlow API .. raw:: latex \clearpage - -.. toctree:: - :hidden: - - flow.rst - tools.rst diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst new file mode 100644 index 0000000..ab37940 --- /dev/null +++ b/docs/source/changelog.rst @@ -0,0 +1 @@ +.. mdinclude:: ../../CHANGELOG.md diff --git a/docs/source/conf.py b/docs/source/conf.py index 546ce39..f638bc5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # anaflow documentation build configuration file, created by # sphinx-quickstart on Fri Jan 5 14:20:43 2018. @@ -21,6 +20,7 @@ # pip install sphinx_rtd_theme # is needed in order to build the documentation import datetime + from anaflow import __version__ as ver @@ -48,13 +48,14 @@ def setup(app): "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.coverage", - "sphinx.ext.imgmath", + "sphinx.ext.mathjax", "sphinx.ext.ifconfig", "sphinx.ext.viewcode", "sphinx.ext.autosummary", "sphinx.ext.napoleon", # parameters look better than with numpydoc only "numpydoc", "sphinx_gallery.gen_gallery", + "m2r2", ] # autosummaries from source-files @@ -71,7 +72,10 @@ def setup(app): # Notes in boxes napoleon_use_admonition_for_notes = True # Attributes like parameters -# napoleon_use_ivar = True +napoleon_use_ivar = True +# keep "Other Parameters" section +# https://github.com/sphinx-doc/sphinx/issues/10330 +napoleon_use_param = False # this is a nice class-doc layout numpydoc_show_class_members = True # class members have no separate file, so they are not in a toctree @@ -112,7 +116,7 @@ def setup(app): # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -144,14 +148,18 @@ def setup(app): # Toc options "collapse_navigation": False, "sticky_navigation": True, - "navigation_depth": 4, + "navigation_depth": 6, "includehidden": True, "titles_only": False, } # 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"] + +# These paths are either relative to html_static_path +# or fully qualified paths (eg. https://...) +html_css_files = ["custom.css"] # Custom sidebar templates, must be a dictionary that maps document names # to template names. @@ -238,7 +246,6 @@ def setup(app): # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - "Python 3.6": ("https://docs.python.org/3.6", None), "Python": ("https://docs.python.org/", None), "NumPy": ("http://docs.scipy.org/doc/numpy/", None), "SciPy": ("http://docs.scipy.org/doc/scipy/reference", None), diff --git a/docs/source/contents.rst b/docs/source/contents.rst index 9160e69..03dfe74 100644 --- a/docs/source/contents.rst +++ b/docs/source/contents.rst @@ -4,8 +4,9 @@ Contents .. toctree:: :includehidden: - :maxdepth: 3 + :maxdepth: 6 index examples/index - package + api + changelog diff --git a/docs/source/flow.laplace.rst b/docs/source/flow.laplace.rst deleted file mode 100644 index ea3241c..0000000 --- a/docs/source/flow.laplace.rst +++ /dev/null @@ -1,11 +0,0 @@ -anaflow.flow.laplace -==================== - -.. automodule:: anaflow.flow.laplace - :members: - :undoc-members: - :show-inheritance: - -.. raw:: latex - - \clearpage \ No newline at end of file diff --git a/docs/source/flow.rst b/docs/source/flow.rst deleted file mode 100644 index f59acd6..0000000 --- a/docs/source/flow.rst +++ /dev/null @@ -1,13 +0,0 @@ -anaflow.flow -============ - -.. automodule:: anaflow.flow - -.. raw:: latex - - \clearpage - -.. toctree:: - :hidden: - - flow.laplace.rst diff --git a/docs/source/tools.coarse_graining.rst b/docs/source/tools.coarse_graining.rst deleted file mode 100644 index 4ac5439..0000000 --- a/docs/source/tools.coarse_graining.rst +++ /dev/null @@ -1,11 +0,0 @@ -anaflow.tools.coarse_graining -============================= - -.. automodule:: anaflow.tools.coarse_graining - :members: - :undoc-members: - :show-inheritance: - -.. raw:: latex - - \clearpage \ No newline at end of file diff --git a/docs/source/tools.laplace.rst b/docs/source/tools.laplace.rst deleted file mode 100644 index 4aefcd6..0000000 --- a/docs/source/tools.laplace.rst +++ /dev/null @@ -1,11 +0,0 @@ -anaflow.tools.laplace -===================== - -.. automodule:: anaflow.tools.laplace - :members: - :undoc-members: - :show-inheritance: - -.. raw:: latex - - \clearpage \ No newline at end of file diff --git a/docs/source/tools.mean.rst b/docs/source/tools.mean.rst deleted file mode 100644 index 656ce3d..0000000 --- a/docs/source/tools.mean.rst +++ /dev/null @@ -1,11 +0,0 @@ -anaflow.tools.mean -================== - -.. automodule:: anaflow.tools.mean - :members: - :undoc-members: - :show-inheritance: - -.. raw:: latex - - \clearpage \ No newline at end of file diff --git a/docs/source/tools.rst b/docs/source/tools.rst deleted file mode 100644 index 4213ca3..0000000 --- a/docs/source/tools.rst +++ /dev/null @@ -1,16 +0,0 @@ -anaflow.tools -============= - -.. automodule:: anaflow.tools - -.. raw:: latex - - \clearpage - -.. toctree:: - :hidden: - - tools.laplace.rst - tools.mean.rst - tools.special.rst - tools.coarse_graining.rst diff --git a/docs/source/tools.special.rst b/docs/source/tools.special.rst deleted file mode 100644 index 1b4e568..0000000 --- a/docs/source/tools.special.rst +++ /dev/null @@ -1,11 +0,0 @@ -anaflow.tools.special -===================== - -.. automodule:: anaflow.tools.special - :members: - :undoc-members: - :show-inheritance: - -.. raw:: latex - - \clearpage \ No newline at end of file diff --git a/examples/01_call_theis.py b/examples/01_call_theis.py index dd8e5ce..d7281dc 100644 --- a/examples/01_call_theis.py +++ b/examples/01_call_theis.py @@ -9,8 +9,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis +from anaflow import theis time = [10, 100, 1000] rad = np.geomspace(0.1, 10) diff --git a/examples/02_call_ext_theis2d.py b/examples/02_call_ext_theis2d.py index 8aaa867..c37490d 100644 --- a/examples/02_call_ext_theis2d.py +++ b/examples/02_call_ext_theis2d.py @@ -14,7 +14,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis, ext_theis_2d + +from anaflow import ext_theis_2d, theis ############################################################################### # We use three time steps: 10s, 10min, 10h diff --git a/examples/03_call_ext_theis3d.py b/examples/03_call_ext_theis3d.py index b711de4..19d56bc 100644 --- a/examples/03_call_ext_theis3d.py +++ b/examples/03_call_ext_theis3d.py @@ -16,9 +16,9 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis, ext_theis_3d -from anaflow.tools.special import aniso +from anaflow import ext_theis_3d, theis +from anaflow.tools.special import aniso ############################################################################### # We use three time steps: 10s, 10min, 10h diff --git a/examples/04_call_ext_theis_tpl.py b/examples/04_call_ext_theis_tpl.py index 060ad5a..82271b0 100755 --- a/examples/04_call_ext_theis_tpl.py +++ b/examples/04_call_ext_theis_tpl.py @@ -15,8 +15,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis, ext_theis_tpl +from anaflow import ext_theis_tpl, theis ############################################################################### # We use three time steps: 10s, 10min, 10h diff --git a/examples/05_call_neuman2004.py b/examples/05_call_neuman2004.py index 0da212c..c35c6cb 100755 --- a/examples/05_call_neuman2004.py +++ b/examples/05_call_neuman2004.py @@ -16,7 +16,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis, neuman2004 + +from anaflow import neuman2004, theis ############################################################################### # We use three time steps: 10s, 10min, 10h diff --git a/examples/06_compare_extthiem2d_grfsteady.py b/examples/06_compare_extthiem2d_grfsteady.py index 5a45256..2540e81 100755 --- a/examples/06_compare_extthiem2d_grfsteady.py +++ b/examples/06_compare_extthiem2d_grfsteady.py @@ -13,9 +13,9 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import ext_thiem_2d, ext_grf_steady -from anaflow.tools.coarse_graining import T_CG +from anaflow import ext_grf_steady, ext_thiem_2d +from anaflow.tools.coarse_graining import T_CG rad = np.geomspace(0.05, 4) # radius from the pumping well in [0, 4] r_ref = 2.0 # reference radius diff --git a/examples/07_compare_extthiem3d_grfsteady.py b/examples/07_compare_extthiem3d_grfsteady.py index 71a635d..208c273 100755 --- a/examples/07_compare_extthiem3d_grfsteady.py +++ b/examples/07_compare_extthiem3d_grfsteady.py @@ -10,9 +10,9 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import ext_thiem_3d, ext_grf_steady -from anaflow.tools.coarse_graining import K_CG +from anaflow import ext_grf_steady, ext_thiem_3d +from anaflow.tools.coarse_graining import K_CG rad = np.geomspace(0.05, 4) # radius from the pumping well in [0, 4] r_ref = 2.0 # reference radius diff --git a/examples/08_compare_extthiem2d_neuman.py b/examples/08_compare_extthiem2d_neuman.py index 4245f8a..4e442c8 100755 --- a/examples/08_compare_extthiem2d_neuman.py +++ b/examples/08_compare_extthiem2d_neuman.py @@ -15,8 +15,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import ext_thiem_2d, neuman2004_steady +from anaflow import ext_thiem_2d, neuman2004_steady rad = np.geomspace(0.05, 4) # radius from the pumping well in [0, 4] r_ref = 30.0 # reference radius diff --git a/examples/09_compare_exttheis2d_neuman.py b/examples/09_compare_exttheis2d_neuman.py index ed37df9..25fbd4e 100755 --- a/examples/09_compare_exttheis2d_neuman.py +++ b/examples/09_compare_exttheis2d_neuman.py @@ -15,8 +15,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import ext_theis_2d, neuman2004 +from anaflow import ext_theis_2d, neuman2004 time_labels = ["10 s", "10 min", "10 h"] time = [10, 600, 36000] # 10s, 10min, 10h diff --git a/examples/10_convergence_ext_theis_tpl.py b/examples/10_convergence_ext_theis_tpl.py index b208b7b..dee18fd 100755 --- a/examples/10_convergence_ext_theis_tpl.py +++ b/examples/10_convergence_ext_theis_tpl.py @@ -9,6 +9,7 @@ """ import numpy as np from matplotlib import pyplot as plt + from anaflow import ext_theis_tpl, ext_thiem_tpl time = 1e4 # time point for steady state diff --git a/examples/11_convergence_ext_grf.py b/examples/11_convergence_ext_grf.py index a3d7fe8..518aed7 100755 --- a/examples/11_convergence_ext_grf.py +++ b/examples/11_convergence_ext_grf.py @@ -11,6 +11,7 @@ """ import numpy as np from matplotlib import pyplot as plt + from anaflow import ext_grf, ext_grf_steady, grf time = 1e4 # time point for steady state diff --git a/examples/12_compare_theis_quasi_steady.py b/examples/12_compare_theis_quasi_steady.py index 0439e28..ea89012 100755 --- a/examples/12_compare_theis_quasi_steady.py +++ b/examples/12_compare_theis_quasi_steady.py @@ -7,8 +7,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis, thiem +from anaflow import theis, thiem time = [10, 100, 1000] rad = np.geomspace(0.1, 10) diff --git a/examples/13_self_defined_transmissivity.py b/examples/13_self_defined_transmissivity.py index f060d5c..72fe491 100755 --- a/examples/13_self_defined_transmissivity.py +++ b/examples/13_self_defined_transmissivity.py @@ -15,11 +15,12 @@ Reference: (not yet published) """ +import matplotlib.gridspec as gridspec import numpy as np from matplotlib import pyplot as plt -import matplotlib.gridspec as gridspec + from anaflow import ext_grf, ext_grf_steady -from anaflow.tools import specialrange_cut, annular_hmean, step_f +from anaflow.tools import annular_hmean, specialrange_cut, step_f def cond(rad, K_far, K_well, len_scale): diff --git a/examples/14_interval_theis.py b/examples/14_interval_theis.py index da4bc48..ad9be56 100755 --- a/examples/14_interval_theis.py +++ b/examples/14_interval_theis.py @@ -10,8 +10,8 @@ """ import numpy as np from matplotlib import pyplot as plt -from anaflow import theis +from anaflow import theis time = np.linspace(10, 200) rad = [1, 5] diff --git a/examples/15_accruing_theis.py b/examples/15_accruing_theis.py index 62564a4..523d041 100755 --- a/examples/15_accruing_theis.py +++ b/examples/15_accruing_theis.py @@ -7,12 +7,12 @@ This could be interpreted as that the water pump needs a certain time to reach its constant rate state. """ +import matplotlib.gridspec as gridspec import numpy as np -from scipy.special import erf from matplotlib import pyplot as plt -import matplotlib.gridspec as gridspec -from anaflow import theis +from scipy.special import erf +from anaflow import theis time = np.geomspace(1, 600) rad = [1, 5] diff --git a/src/anaflow/__init__.py b/src/anaflow/__init__.py index cc2b8f9..3f22418 100644 --- a/src/anaflow/__init__.py +++ b/src/anaflow/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Purpose ======= @@ -10,8 +9,10 @@ =========== .. autosummary:: - flow - tools + :toctree: api + + flow + tools Solutions ========= @@ -76,32 +77,30 @@ step_f specialrange specialrange_cut - - """ from anaflow.flow import ( - thiem, - theis, - grf, - ext_thiem_2d, - ext_thiem_3d, - ext_thiem_tpl, - ext_thiem_tpl_3d, + ext_grf, + ext_grf_steady, ext_theis_2d, ext_theis_3d, ext_theis_tpl, ext_theis_tpl_3d, + ext_thiem_2d, + ext_thiem_3d, + ext_thiem_tpl, + ext_thiem_tpl_3d, + grf, neuman2004, neuman2004_steady, - ext_grf, - ext_grf_steady, + theis, + thiem, ) from anaflow.tools import ( - get_lap_inv, get_lap, - step_f, + get_lap_inv, specialrange, specialrange_cut, + step_f, ) try: diff --git a/src/anaflow/flow/__init__.py b/src/anaflow/flow/__init__.py index fff0b58..ef0a959 100644 --- a/src/anaflow/flow/__init__.py +++ b/src/anaflow/flow/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing flow-solutions for the groundwater flow equation. @@ -8,7 +7,9 @@ .. currentmodule:: anaflow.flow .. autosummary:: - laplace + :toctree: + + laplace Solutions ^^^^^^^^^ @@ -19,7 +20,7 @@ Solutions for homogeneous aquifers .. autosummary:: - :toctree: generated + :toctree: thiem theis @@ -31,7 +32,7 @@ Solutions for heterogeneous aquifers .. autosummary:: - :toctree: generated + :toctree: ext_thiem_2d ext_thiem_3d @@ -50,25 +51,25 @@ The extended general radial flow model. .. autosummary:: - :toctree: generated + :toctree: ext_grf ext_grf_steady """ -from anaflow.flow.homogeneous import thiem, theis, grf +from anaflow.flow.ext_grf_model import ext_grf, ext_grf_steady from anaflow.flow.heterogeneous import ( - ext_thiem_2d, - ext_thiem_3d, - ext_thiem_tpl, - ext_thiem_tpl_3d, ext_theis_2d, ext_theis_3d, ext_theis_tpl, ext_theis_tpl_3d, + ext_thiem_2d, + ext_thiem_3d, + ext_thiem_tpl, + ext_thiem_tpl_3d, neuman2004, neuman2004_steady, ) -from anaflow.flow.ext_grf_model import ext_grf, ext_grf_steady +from anaflow.flow.homogeneous import grf, theis, thiem __all__ = [ "thiem", diff --git a/src/anaflow/flow/ext_grf_model.py b/src/anaflow/flow/ext_grf_model.py index 3285539..fdc34b1 100644 --- a/src/anaflow/flow/ext_grf_model.py +++ b/src/anaflow/flow/ext_grf_model.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing the extended GRF Model. @@ -14,8 +13,8 @@ import numpy as np from scipy.integrate import quad as integ -from anaflow.tools.laplace import get_lap_inv from anaflow.flow.laplace import grf_laplace +from anaflow.tools.laplace import get_lap_inv from anaflow.tools.special import Shaper, sph_surf __all__ = ["ext_grf", "ext_grf_steady"] diff --git a/src/anaflow/flow/heterogeneous.py b/src/anaflow/flow/heterogeneous.py index b46db1b..4ac1a33 100644 --- a/src/anaflow/flow/heterogeneous.py +++ b/src/anaflow/flow/heterogeneous.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing flow solutions in heterogeneous aquifers. @@ -24,17 +23,17 @@ import numpy as np from scipy.special import exp1, expi -from anaflow.tools.special import aniso, specialrange_cut, neuman2004_trans -from anaflow.tools.mean import annular_hmean +from anaflow.flow.ext_grf_model import ext_grf, ext_grf_steady from anaflow.tools.coarse_graining import ( - T_CG, - T_CG_error, K_CG, - K_CG_error, + T_CG, TPL_CG, + K_CG_error, + T_CG_error, TPL_CG_error, ) -from anaflow.flow.ext_grf_model import ext_grf, ext_grf_steady +from anaflow.tools.mean import annular_hmean +from anaflow.tools.special import aniso, neuman2004_trans, specialrange_cut __all__ = [ "ext_thiem_2d", @@ -74,6 +73,7 @@ def ext_thiem_2d( The type curve is describing the effective drawdown in a 2D statistical framework, where the transmissivity distribution is following a log-normal distribution with a gaussian correlation function. + Presented in [Zech2013]_. Parameters ---------- @@ -146,10 +146,10 @@ def ext_thiem_2d( chi = -var / 2.0 if T_well is None else np.log(T_well / trans_gmean) C = (prop / len_scale) ** 2 # derive the result - res = -expi(-chi / (1.0 + C * rad ** 2)) - res -= np.exp(-chi) * exp1(chi / (1.0 + C * rad ** 2) - chi) - res += expi(-chi / (1.0 + C * r_ref ** 2)) - res += np.exp(-chi) * exp1(chi / (1.0 + C * r_ref ** 2) - chi) + res = -expi(-chi / (1.0 + C * rad**2)) + res -= np.exp(-chi) * exp1(chi / (1.0 + C * rad**2) - chi) + res += expi(-chi / (1.0 + C * r_ref**2)) + res += np.exp(-chi) * exp1(chi / (1.0 + C * r_ref**2) - chi) res *= -rate / (4.0 * np.pi * trans_gmean) res += h_ref return res @@ -182,6 +182,7 @@ def ext_thiem_3d( in a 3D statistical framework, where the conductivity distribution is following a log-normal distribution with a gaussian correlation function and taking vertical anisotropy into account. + Presented in [Zech2013]_. Parameters ---------- @@ -272,15 +273,15 @@ def ext_thiem_3d( C = (prop / len_scale / anis ** (1.0 / 3.0)) ** 2 - sub11 = np.sqrt(1.0 + C * r_ref ** 2) - sub12 = np.sqrt(1.0 + C * rad ** 2) + sub11 = np.sqrt(1.0 + C * r_ref**2) + sub12 = np.sqrt(1.0 + C * rad**2) sub21 = np.log(sub12 + 1.0) - np.log(sub11 + 1.0) sub21 -= 1.0 / sub12 - 1.0 / sub11 sub22 = np.log(sub12) - np.log(sub11) - sub22 -= 0.50 / sub12 ** 2 - 0.50 / sub11 ** 2 - sub22 -= 0.25 / sub12 ** 4 - 0.25 / sub11 ** 4 + sub22 -= 0.50 / sub12**2 - 0.50 / sub11**2 + sub22 -= 0.25 / sub12**4 - 0.25 / sub11**4 # derive the result res = np.exp(-chi) * (np.log(rad) - np.log(r_ref)) @@ -1265,6 +1266,7 @@ def neuman2004( This solution is build on the apparent transmissivity from Neuman 2004, which represents a mean drawdown in an ensemble of pumping tests in heterogeneous transmissivity fields following an exponential covariance. + Presented in [Neuman2004]_. Parameters ---------- @@ -1371,6 +1373,7 @@ def neuman2004_steady( This solution is build on the apparent transmissivity from Neuman 1994, which represents a mean drawdown in an ensemble of pumping tests in heterogeneous transmissivity fields following an exponential covariance. + Presented in [Neuman2004]_. Parameters ---------- diff --git a/src/anaflow/flow/homogeneous.py b/src/anaflow/flow/homogeneous.py index 7d685c0..2fa0865 100644 --- a/src/anaflow/flow/homogeneous.py +++ b/src/anaflow/flow/homogeneous.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing flow solutions in homogeneous aquifers. @@ -14,8 +13,8 @@ # pylint: disable=C0103 import numpy as np -from anaflow.tools.special import well_solution, grf_solution from anaflow.flow.ext_grf_model import ext_grf, ext_grf_steady +from anaflow.tools.special import grf_solution, well_solution __all__ = ["thiem", "theis", "grf"] diff --git a/src/anaflow/flow/laplace.py b/src/anaflow/flow/laplace.py index 01d8a09..a48ee33 100644 --- a/src/anaflow/flow/laplace.py +++ b/src/anaflow/flow/laplace.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing flow solutions in laplace space. @@ -7,14 +6,17 @@ The following functions are provided .. autosummary:: + :toctree: + grf_laplace """ # pylint: disable=C0103 import warnings import numpy as np -from scipy.special import kv, iv, gamma, erfcx from pentapy import solve +from scipy.special import erfcx, gamma, iv, kv + from anaflow.tools.special import sph_surf __all__ = ["grf_laplace"] @@ -33,7 +35,7 @@ def periodic(s, a=0): """ if np.isclose(a, 0): return constant(s) - return 1.0 / (s + a ** 2 / s) + return 1.0 / (s + a**2 / s) def slug(s): @@ -198,7 +200,7 @@ def grf_laplace( # calculate the head for ri, re in enumerate(rad): if re < R_part[-1]: - res[si, ri] = re ** nu * ( + res[si, ri] = re**nu * ( As * kv(nu, Cs * re) + Bs * iv(nu, Cs * re) ) @@ -300,7 +302,7 @@ def grf_laplace( k0_sub[np.abs(X[2 * pos]) < cut_off_prec] = 0 i0_sub = X[2 * pos + 1] * iv(nu, Cs[pos] * rad) i0_sub[np.abs(X[2 * pos + 1]) < cut_off_prec] = 0 - res[si, :] = rad ** nu * (k0_sub + i0_sub) + res[si, :] = rad**nu * (k0_sub + i0_sub) # set problematic values to 0 # --> the algorithm tends to violate small values, diff --git a/src/anaflow/tools/__init__.py b/src/anaflow/tools/__init__.py index f997996..6d9671d 100644 --- a/src/anaflow/tools/__init__.py +++ b/src/anaflow/tools/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing miscellaneous tools. @@ -8,10 +7,12 @@ .. currentmodule:: anaflow.tools .. autosummary:: - laplace - mean - special - coarse_graining + :toctree: + + laplace + mean + special + coarse_graining Functions ^^^^^^^^^ @@ -67,22 +68,22 @@ get_lap get_lap_inv """ +from anaflow.tools.coarse_graining import K_CG, T_CG, TPL_CG +from anaflow.tools.laplace import get_lap, get_lap_inv from anaflow.tools.mean import ( - annular_fmean, annular_amean, + annular_fmean, annular_gmean, annular_hmean, annular_pmean, ) from anaflow.tools.special import ( - step_f, + aniso, + neuman2004_trans, specialrange, specialrange_cut, - neuman2004_trans, - aniso, + step_f, ) -from anaflow.tools.coarse_graining import T_CG, K_CG, TPL_CG -from anaflow.tools.laplace import get_lap, get_lap_inv __all__ = [ "get_lap", diff --git a/src/anaflow/tools/coarse_graining.py b/src/anaflow/tools/coarse_graining.py index a22e172..a2f28ac 100644 --- a/src/anaflow/tools/coarse_graining.py +++ b/src/anaflow/tools/coarse_graining.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing helper functions related to coarse graining. @@ -7,6 +6,7 @@ The following functions are provided .. autosummary:: + :toctree: T_CG T_CG_inverse diff --git a/src/anaflow/tools/laplace.py b/src/anaflow/tools/laplace.py index 74fff02..467fd78 100644 --- a/src/anaflow/tools/laplace.py +++ b/src/anaflow/tools/laplace.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing functions concerning the laplace transformation. @@ -7,13 +6,15 @@ The following functions are provided .. autosummary:: + :toctree: get_lap get_lap_inv lap_trans stehfest """ -from math import floor, factorial +from math import factorial, floor + import numpy as np from scipy.integrate import quad @@ -121,7 +122,6 @@ def integrand(val): return integrand for phase_i, phase_e in np.ndenumerate(phase): - integ = make_integrand(phase_e) result[phase_i] = quad(integ, 0, np.inf)[0] diff --git a/src/anaflow/tools/mean.py b/src/anaflow/tools/mean.py index 3b671ce..a06323f 100644 --- a/src/anaflow/tools/mean.py +++ b/src/anaflow/tools/mean.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing several mean calculating routines. @@ -7,6 +6,7 @@ The following functions are provided .. autosummary:: + :toctree: annular_fmean annular_amean @@ -16,7 +16,6 @@ """ # pylint: disable=E1137, C0103 import numpy as np - from scipy.integrate import quad as integ __all__ = [ diff --git a/src/anaflow/tools/special.py b/src/anaflow/tools/special.py index 067c519..a545645 100644 --- a/src/anaflow/tools/special.py +++ b/src/anaflow/tools/special.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Anaflow subpackage providing special functions. @@ -7,6 +6,7 @@ The following functions are provided .. autosummary:: + :toctree: Shaper step_f @@ -22,7 +22,7 @@ """ import numpy as np -from scipy.special import gamma, gammaincc, exp1, expn, hyp2f1 +from scipy.special import exp1, expn, gamma, gammaincc, hyp2f1 __all__ = [ "Shaper", @@ -278,11 +278,11 @@ def aniso(e): elif np.isclose(e, 0): res = 0.0 else: - res = e / (2 * (1.0 - e ** 2)) + res = e / (2 * (1.0 - e**2)) res *= ( 1.0 - / np.sqrt(1.0 - e ** 2) - * np.arctan(np.sqrt(1.0 / e ** 2 - 1.0)) + / np.sqrt(1.0 - e**2) + * np.arctan(np.sqrt(1.0 / e**2 - 1.0)) - e ) @@ -378,7 +378,7 @@ def well_solution( res[Input.time_gz, :] = ( rate / (4.0 * np.pi * transmissivity) - * exp1(rad_mat ** 2 * storage / (4 * transmissivity * time_mat)) + * exp1(rad_mat**2 * storage / (4 * transmissivity * time_mat)) ) res = Input.reshape(res) if rate > 0: @@ -456,7 +456,7 @@ def grf_solution( time_mat = Input.time_mat rad_mat = Input.rad_mat - u = storage * rad_mat ** 2 / (4 * conductivity * time_mat) + u = storage * rad_mat**2 / (4 * conductivity * time_mat) nu = 1.0 - dim / 2.0 res = np.zeros((Input.time_no, Input.rad_no)) @@ -493,7 +493,7 @@ def inc_gamma(s, x): if np.isclose(s, np.around(s)) and s < -0.5: return x ** (s - 1) * expn(int(1 - np.around(s)), x) if s < 0: - return (inc_gamma(s + 1, x) - x ** s * np.exp(-x)) / s + return (inc_gamma(s + 1, x) - x**s * np.exp(-x)) / s return gamma(s) * gammaincc(s, x) diff --git a/tests/test_anaflow.py b/tests/test_anaflow.py index abe0193..afa76d3 100644 --- a/tests/test_anaflow.py +++ b/tests/test_anaflow.py @@ -1,10 +1,11 @@ -# -*- coding: utf-8 -*- """ This is the unittest of AnaFlow. """ import unittest + import numpy as np + import anaflow as af # import matplotlib.pyplot as plt From a7e58a21bef71d85ea8940402ccf3262f3991df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 16 Apr 2023 13:17:26 +0200 Subject: [PATCH 3/5] pylint: fixes --- src/anaflow/flow/__init__.py | 1 - src/anaflow/flow/ext_grf_model.py | 10 +-- src/anaflow/flow/heterogeneous.py | 100 +++++++++++++++--------------- src/anaflow/flow/laplace.py | 14 ++--- src/anaflow/tools/special.py | 8 +-- 5 files changed, 66 insertions(+), 67 deletions(-) diff --git a/src/anaflow/flow/__init__.py b/src/anaflow/flow/__init__.py index ef0a959..059bb19 100644 --- a/src/anaflow/flow/__init__.py +++ b/src/anaflow/flow/__init__.py @@ -74,7 +74,6 @@ __all__ = [ "thiem", "theis", - "grf_model", "ext_thiem_2d", "ext_thiem_3d", "ext_thiem_tpl", diff --git a/src/anaflow/flow/ext_grf_model.py b/src/anaflow/flow/ext_grf_model.py index fdc34b1..207c8e3 100644 --- a/src/anaflow/flow/ext_grf_model.py +++ b/src/anaflow/flow/ext_grf_model.py @@ -175,13 +175,13 @@ def ext_grf_steady( kwargs.update(arg_dict) Input = Shaper(rad=rad) q_fac = rate / (sph_surf(dim) * lat_ext ** (3.0 - dim)) # pumping factor - if not r_ref > 0.0: + if r_ref <= 0.0: raise ValueError("The reference radius needs to be positive.") - if not Input.rad_min > 0.0: + if Input.rad_min <= 0.0: raise ValueError("The given radii need to be positive.") - if not dim > 0.0 or dim > 3.0: + if dim <= 0.0 or dim > 3.0: raise ValueError("The dimension needs to be positiv and <= 3.") - if not lat_ext > 0.0: + if lat_ext <= 0.0: raise ValueError("The lateral extend needs to be positiv.") if callable(conductivity): @@ -195,7 +195,7 @@ def integrand(val): res[ri] = integ(integrand, re, r_ref)[0] else: con = float(conductivity) - if not con > 0: + if con <= 0: raise ValueError("The Conductivity needs to be positive.") if np.isclose(dim, 2): res = np.log(r_ref / Input.rad) / con diff --git a/src/anaflow/flow/heterogeneous.py b/src/anaflow/flow/heterogeneous.py index 4ac1a33..0cfd06b 100644 --- a/src/anaflow/flow/heterogeneous.py +++ b/src/anaflow/flow/heterogeneous.py @@ -17,7 +17,7 @@ neuman2004 neuman2004_steady """ -# pylint: disable=C0103 +# pylint: disable=C0103,C0302 import functools as ft import numpy as np @@ -239,9 +239,9 @@ def ext_thiem_3d( """ rad = np.array(rad, dtype=float) # check the input - if not r_ref > 0.0: + if r_ref <= 0.0: raise ValueError("The reference radius needs to be positive.") - if not np.min(rad) > 0.0: + if np.min(rad) <= 0.0: raise ValueError("The given radii need to be positive.") if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float): raise ValueError( @@ -249,17 +249,17 @@ def ext_thiem_3d( ) if isinstance(K_well, float) and K_well <= 0.0: raise ValueError("The well-conductivity needs to be positive.") - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The gmean conductivity needs to be positive.") if var < 0.0: raise ValueError("The variance needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") - if not lat_ext > 0.0: + if lat_ext <= 0.0: raise ValueError("The aquifer-thickness needs to be positive.") if not 0.0 < anis <= 1.0: raise ValueError("The anisotropy-ratio must be > 0 and <= 1") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionalityfactor needs to be positive.") # define some substitions to shorten the result @@ -390,19 +390,19 @@ def ext_theis_2d( # check the input if r_well < 0.0: raise ValueError("The wellradius needs to be >= 0") - if not r_bound > r_well: + if r_bound <= r_well: raise ValueError("The upper boundary needs to be > well radius") - if not storage > 0.0: + if storage <= 0.0: raise ValueError("The Storage needs to be positive.") - if not trans_gmean > 0.0: + if trans_gmean <= 0.0: raise ValueError("The Transmissivity needs to be positive.") if var < 0.0: raise ValueError("The variance needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") - if T_well is not None and not T_well > 0.0: + if T_well is not None and T_well <= 0.0: raise ValueError("The well Transmissivity needs to be positive.") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionality factor needs to be positive.") if parts <= 1: raise ValueError("The numbor of partitions needs to be at least 2") @@ -546,25 +546,25 @@ def ext_theis_3d( # check the input if r_well < 0.0: raise ValueError("The wellradius needs to be >= 0") - if not r_bound > r_well: + if r_bound <= r_well: raise ValueError("The upper boundary needs to be > well radius") - if not storage > 0.0: + if storage <= 0.0: raise ValueError("The storage needs to be positive.") - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The gmean conductivity needs to be positive.") if var < 0.0: raise ValueError("The variance needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float): raise ValueError( "The well-conductivity should be given as float or 'KA' resp 'KH'" ) - if isinstance(K_well, float) and not K_well > 0.0: + if isinstance(K_well, float) and K_well <= 0.0: raise ValueError("The well-conductivity needs to be positive.") - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The conductivity needs to be positive.") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionality factor needs to be positive.") if parts <= 1: raise ValueError("The numbor of partitions needs to be at least 2") @@ -728,27 +728,27 @@ def ext_theis_tpl( # check the input if r_well < 0.0: raise ValueError("The wellradius needs to be >= 0") - if not r_bound > r_well: + if r_bound <= r_well: raise ValueError("The upper boundary needs to be > well radius") - if not storage > 0.0: + if storage <= 0.0: raise ValueError("The storage needs to be positive.") - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The gmean conductivity needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") if not 0 < hurst < 1: raise ValueError("Hurst coefficient needs to be in (0,1)") if var is not None and var < 0.0: raise ValueError("The variance needs to be positive.") - if var is None and not c > 0.0: + if var is None and c <= 0.0: raise ValueError("The intensity of variation needs to be positive.") if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float): raise ValueError( "The well-conductivity should be given as float or 'KA' resp 'KH'" ) - if isinstance(K_well, float) and not K_well > 0.0: + if isinstance(K_well, float) and K_well <= 0.0: raise ValueError("The well-conductivity needs to be positive.") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionality factor needs to be positive.") if parts <= 1: raise ValueError("The numbor of partitions needs to be at least 2") @@ -907,27 +907,27 @@ def ext_theis_tpl_3d( # check the input if r_well < 0.0: raise ValueError("The wellradius needs to be >= 0") - if not r_bound > r_well: + if r_bound <= r_well: raise ValueError("The upper boundary needs to be > well radius") - if not storage > 0.0: + if storage <= 0.0: raise ValueError("The storage needs to be positive.") - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The gmean conductivity needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") if not 0 < hurst < 1: raise ValueError("Hurst coefficient needs to be in (0,1)") if var is not None and var < 0.0: raise ValueError("The variance needs to be positive.") - if var is None and not c > 0.0: + if var is None and c <= 0.0: raise ValueError("The intensity of variation needs to be positive.") if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float): raise ValueError( "The well-conductivity should be given as float or 'KA' resp 'KH'" ) - if isinstance(K_well, float) and not K_well > 0.0: + if isinstance(K_well, float) and K_well <= 0.0: raise ValueError("The well-conductivity needs to be positive.") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionality factor needs to be positive.") if parts <= 1: raise ValueError("The numbor of partitions needs to be at least 2") @@ -1059,23 +1059,23 @@ def ext_thiem_tpl( ``r = sqrt(x**2 + y**2)`` """ # check the input - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The gmean conductivity needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") if not 0 < hurst < 1: raise ValueError("Hurst coefficient needs to be in (0,1)") if var is not None and var < 0.0: raise ValueError("The variance needs to be positive.") - if var is None and not c > 0.0: + if var is None and c <= 0.0: raise ValueError("The intensity of variation needs to be positive.") if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float): raise ValueError( "The well-conductivity should be given as float or 'KA' resp 'KH'" ) - if isinstance(K_well, float) and not K_well > 0.0: + if isinstance(K_well, float) and K_well <= 0.0: raise ValueError("The well-conductivity needs to be positive.") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionality factor needs to be positive.") cond = ft.partial( TPL_CG, @@ -1199,23 +1199,23 @@ def ext_thiem_tpl_3d( ``r = sqrt(x**2 + y**2)`` """ # check the input - if not cond_gmean > 0.0: + if cond_gmean <= 0.0: raise ValueError("The gmean conductivity needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") if not 0 < hurst < 1: raise ValueError("Hurst coefficient needs to be in (0,1)") if var is not None and var < 0.0: raise ValueError("The variance needs to be positive.") - if var is None and not c > 0.0: + if var is None and c <= 0.0: raise ValueError("The intensity of variation needs to be positive.") if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float): raise ValueError( "The well-conductivity should be given as float or 'KA' resp 'KH'" ) - if isinstance(K_well, float) and not K_well > 0.0: + if isinstance(K_well, float) and K_well <= 0.0: raise ValueError("The well-conductivity needs to be positive.") - if not prop > 0.0: + if prop <= 0.0: raise ValueError("The proportionality factor needs to be positive.") cond = ft.partial( TPL_CG, @@ -1320,15 +1320,15 @@ def neuman2004( # check the input if r_well < 0.0: raise ValueError("The wellradius needs to be >= 0") - if not r_bound > r_well: + if r_bound <= r_well: raise ValueError("The upper boundary needs to be > well radius") - if not storage > 0.0: + if storage <= 0.0: raise ValueError("The Storage needs to be positive.") - if not trans_gmean > 0.0: + if trans_gmean <= 0.0: raise ValueError("The Transmissivity needs to be positive.") if var < 0.0: raise ValueError("The variance needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") if parts <= 1: raise ValueError("The numbor of partitions needs to be at least 2") @@ -1404,11 +1404,11 @@ def neuman2004_steady( Water resources research 40.4, 2004 """ # check the input - if not trans_gmean > 0.0: + if trans_gmean <= 0.0: raise ValueError("The Transmissivity needs to be positive.") if var < 0.0: raise ValueError("The variance needs to be positive.") - if not len_scale > 0.0: + if len_scale <= 0.0: raise ValueError("The correlationlength needs to be positive.") return ext_grf_steady( diff --git a/src/anaflow/flow/laplace.py b/src/anaflow/flow/laplace.py index a48ee33..a7256ce 100644 --- a/src/anaflow/flow/laplace.py +++ b/src/anaflow/flow/laplace.py @@ -10,7 +10,7 @@ grf_laplace """ -# pylint: disable=C0103 +# pylint: disable=C0103,R0915 import warnings import numpy as np @@ -152,19 +152,19 @@ def grf_laplace( raise ValueError("R_part, S_part and K_part need matching lengths.") if R_part[0] < 0.0: raise ValueError("The wellradius needs to be >= 0.") - if not all([r1 < r2 for r1, r2 in zip(R_part[:-1], R_part[1:])]): + if not all(r1 < r2 for r1, r2 in zip(R_part[:-1], R_part[1:])): raise ValueError("The radii values need to be sorted.") if not np.min(rad) > R_part[0] or np.max(rad) > R_part[-1]: raise ValueError("The given radii need to be in the given range.") - if not all([con > 0 for con in K_part]): + if not all(con > 0 for con in K_part): raise ValueError("The Conductivity needs to be positiv.") - if not all([stor > 0 for stor in S_part]): + if not all(stor > 0 for stor in S_part): raise ValueError("The Storage needs to be positiv.") - if not dim > 0.0 or dim > 3.0: + if dim <= 0.0 or dim > 3.0: raise ValueError("The dimension needs to be positiv and <= 3.") - if not lat_ext > 0.0: + if lat_ext <= 0.0: raise ValueError("The lateral extend needs to be positiv.") - if not K_well > 0: + if K_well <= 0: raise ValueError("The well conductivity needs to be positiv.") # initialize the result diff --git a/src/anaflow/tools/special.py b/src/anaflow/tools/special.py index a545645..98888fd 100644 --- a/src/anaflow/tools/special.py +++ b/src/anaflow/tools/special.py @@ -20,7 +20,7 @@ tpl_hyp neuman2004_trans """ - +# pylint: disable=C0103,R0903 import numpy as np from scipy.special import exp1, expn, gamma, gammaincc, hyp2f1 @@ -39,7 +39,7 @@ ] -class Shaper(object): +class Shaper: """ A class to reshape radius-time input-output in a good way. @@ -84,7 +84,7 @@ def __init__(self, time=0, rad=0, struc_grid=True): np.ones_like(self.time[self.time_gz]), self.rad ) - if not self.struc_grid and not self.rad_shape == self.time_shape: + if not self.struc_grid and self.rad_shape != self.time_shape: raise ValueError("No struc_grid: shape of time & radius differ") if np.any(self.time < 0.0): raise ValueError("The given times need to be positive.") @@ -183,7 +183,7 @@ def specialrange(val_min, val_max, steps, typ="exp"): ) ) ** typ else: - print("specialrange: unknown typ '{}'. Using linear range".format(typ)) + print(f"specialrange: unknown typ '{typ}'. Using linear range") rng = np.linspace(val_min, val_max, steps) return rng From 5556c813116f92d5696a9fb032f9e7cc1a76a94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 16 Apr 2023 13:17:38 +0200 Subject: [PATCH 4/5] CI: update checks; update python versions --- .github/workflows/main.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90da604..3f18d32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,22 +26,27 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip - pip install black #pylint - pip install --editable . + pip install --editable .[check] + - name: black check run: | - python -m black --check . - # - name: pylint check - # run: | - # python -m pylint anaflow/ + python -m black --check --diff --color . + + - name: isort check + run: | + python -m isort --check --diff --color . + + - name: pylint check + run: | + python -m pylint src/anaflow/ build_sdist: name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }} @@ -50,7 +55,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 From 13087263f4b34d90b543f6f23a02cfe52dea9205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 16 Apr 2023 13:29:46 +0200 Subject: [PATCH 5/5] update changelog and year --- CHANGELOG.md | 12 ++++++++++++ LICENSE | 2 +- README.md | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11b28b5..32dff10 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to **AnaFlow** will be documented in this file. +## [1.1.0] - 2023-04 + +See [#11](https://github.com/GeoStat-Framework/AnaFlow/pull/11) + +### Enhancements +- move to `src/` base package structure +- drop py36 support +- added archive support +- simplify documentation + + ## [1.0.1] - 2020-04-02 ### Bugfixes @@ -77,6 +88,7 @@ Containing: - lap_transgwflow_cyl - Solution for a diskmodel in laplace inversion +[1.0.1]: https://github.com/GeoStat-Framework/AnaFlow/compare/v1.0.1...v1.1.0 [1.0.1]: https://github.com/GeoStat-Framework/AnaFlow/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/GeoStat-Framework/AnaFlow/compare/v0.4.0...v1.0.0 [0.4.0]: https://github.com/GeoStat-Framework/AnaFlow/compare/v0.3.0...v0.4.0 diff --git a/LICENSE b/LICENSE index 51e42f7..3eec3e7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 - 2021 Sebastian Mueller +Copyright (c) 2019 - 2023 Sebastian Mueller Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index ffb323b..8cbca09 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ You can contact us via . ## License -[MIT][mit_link] © 2019 - 2021 +[MIT][mit_link] © 2019 - 2023 [mit_link]: https://github.com/GeoStat-Framework/AnaFlow/blob/main/LICENSE [doc_link]: https://anaflow.readthedocs.io