diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index c3b07ebbc..6aca49db1 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -10,10 +10,15 @@ jobs: benchmark: if: ${{ contains( github.event.pull_request.labels.*.name, 'run-benchmark') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} name: Linux - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: ASV_DIR: "./asv_bench" - + defaults: + run: + shell: bash -l {0} + strategy: + matrix: + python-version: ["3.10"] steps: # We need the full repo to avoid this issue # https://github.com/actions/checkout/issues/23 @@ -21,19 +26,20 @@ jobs: with: fetch-depth: 0 - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v3 + - name: Set up conda (micromamba) + uses: mamba-org/setup-micromamba@v1 with: - # installer-url: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh - installer-url: https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh + environment-name: climpred-benchmarks + cache-environment: true + create-args: >- + python=${{ matrix.python-version }} + conda - - name: Setup some dependencies - shell: bash -l {0} + - name: Set Up Dependencies run: | - pip install asv + python -m pip install asv sudo apt-get update -y - name: Run benchmarks - shell: bash -l {0} id: benchmark env: OPENBLAS_NUM_THREADS: 1 diff --git a/.github/workflows/climpred_installs.yml b/.github/workflows/climpred_installs.yml index 40294610e..7b22c1589 100644 --- a/.github/workflows/climpred_installs.yml +++ b/.github/workflows/climpred_installs.yml @@ -25,7 +25,7 @@ jobs: keyword: "[skip-ci]" install-climpred-complete: # Installs climpred on various OS. - name: Install climpred[complete], ${{ matrix.os }} + name: Install climpred[complete], ${{ matrix.os }}, Python${{ matrix.python-version }} runs-on: ${{ matrix.os }} needs: detect-ci-trigger if: needs.detect-ci-trigger.outputs.triggered == 'false' @@ -33,19 +33,20 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.9"] steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | pip install -e .[complete] python -c "import climpred" install-climpred: # Installs climpred on various OS. - name: Install climpred, ${{ matrix.os }} + name: Install climpred, ${{ matrix.os }}, Python${{ matrix.python-version }} runs-on: ${{ matrix.os }} needs: detect-ci-trigger if: needs.detect-ci-trigger.outputs.triggered == 'false' @@ -53,6 +54,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.9"] steps: - uses: actions/checkout@v4 with: @@ -60,7 +62,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | pip install -e . diff --git a/.github/workflows/climpred_testing.yml b/.github/workflows/climpred_testing.yml index 7f84f6734..af9532850 100644 --- a/.github/workflows/climpred_testing.yml +++ b/.github/workflows/climpred_testing.yml @@ -27,13 +27,16 @@ jobs: keyword: "[skip-ci]" minimum-test: # Runs testing suite with minimal dependencies - name: Test minimum dependencies, Python3.9 + name: Test minimum dependencies, Python${{ matrix.python-version }} runs-on: ubuntu-latest needs: detect-ci-trigger if: needs.detect-ci-trigger.outputs.triggered == 'false' defaults: run: shell: bash -l {0} + strategy: + matrix: + python-version: ["3.9", "3.12"] steps: - uses: actions/checkout@v4 with: @@ -45,7 +48,7 @@ jobs: environment-name: climpred-minimum-tests cache-environment: true create-args: >- - python=3.9 + python=${{ matrix.python-version }} conda - name: Install climpred run: | @@ -75,16 +78,22 @@ jobs: strategy: fail-fast: false matrix: - env: [""] include: - env: "climpred-maximum-tests" python-version: "3.9" + extras: "esmpy=*=mpi*" # Ensures MPI works with version of esmpy. os: ubuntu-latest - env: "climpred-maximum-tests" python-version: "3.10" + extras: "esmpy=*=mpi*" # Ensures MPI works with version of esmpy. os: ubuntu-latest - env: "climpred-maximum-tests-upstream" python-version: "3.11" + extras: "esmpy=*=mpi*" # Ensures MPI works with version of esmpy. + os: ubuntu-latest + - env: "climpred-maximum-tests" + python-version: "3.12" + extras: "esmpy" # MPI is not supported in lastest esmpy conda packages for Python3.12 os: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -96,10 +105,11 @@ jobs: environment-file: ci/requirements/maximum-tests.yml environment-name: climpred-maximum-tests cache-environment: true - cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" + cache-environment-key: "${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ env.TODAY }}-${{ hashFiles(env.CONDA_ENV_FILE) }}" create-args: >- - python=${{matrix.python-version}} conda + python=${{ matrix.python-version }} + ${{ matrix.extras }} - name: Install climpred[complete] run: | python -m pip install -e .[complete] @@ -128,11 +138,14 @@ jobs: fail_ci_if_error: false doctest: # tests all docstrings - name: Doctests, Python3.9 - runs-on: "ubuntu-latest" + name: Doctests, Python${{ matrix.python-version }} + runs-on: ubuntu-latest defaults: run: shell: bash -l {0} + strategy: + matrix: + python-version: ["3.9"] steps: - uses: actions/checkout@v4 - name: Setup conda (micromamba) @@ -142,7 +155,7 @@ jobs: environment-name: climpred-maximum-tests cache-environment: true create-args: >- - python=3.9 + python=${{ matrix.python-version }} conda - name: Install climpred[complete] run: | @@ -156,14 +169,17 @@ jobs: conda list - name: Run doctests run: | - python -m pytest --doctest-modules climpred --ignore climpred/tests + python -m pytest --doctest-modules src/climpred --ignore src/climpred/tests notebooks: # Checks that pre-compiled notebooks in docs still work. - name: Notebooks, Python3.9 + name: Notebooks, Python${{ matrix.python-version }} runs-on: ubuntu-latest defaults: run: shell: bash -l {0} + strategy: + matrix: + python-version: ["3.9"] steps: - uses: actions/checkout@v4 - name: Set up conda (micromamba) @@ -173,7 +189,7 @@ jobs: environment-name: climpred-docs cache-environment: true create-args: >- - python=3.9 + python=${{ matrix.python-version }} conda - name: Install climpred run: | diff --git a/.github/workflows/publish-production-pypi.yml b/.github/workflows/publish-production-pypi.yml index ca775f328..8988b16e1 100644 --- a/.github/workflows/publish-production-pypi.yml +++ b/.github/workflows/publish-production-pypi.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python3 uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: "3.x" - name: Install packaging libraries run: | python -m pip install --upgrade pip diff --git a/.github/workflows/publish-staging-testpypi.yml b/.github/workflows/publish-staging-testpypi.yml index 17042ef3a..822cba1c8 100644 --- a/.github/workflows/publish-staging-testpypi.yml +++ b/.github/workflows/publish-staging-testpypi.yml @@ -34,7 +34,7 @@ jobs: - name: Set up Python3 uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: "3.x" - name: Install packaging libraries run: | python -m pip install --upgrade pip diff --git a/.github/workflows/upstream-dev-ci.yml b/.github/workflows/upstream-dev-ci.yml index 953433c31..7b6bf1c56 100644 --- a/.github/workflows/upstream-dev-ci.yml +++ b/.github/workflows/upstream-dev-ci.yml @@ -28,7 +28,7 @@ jobs: keyword: "[test-upstream]" upstream-dev: - name: upstream-dev + name: upstream-dev, Python${{ matrix.python-version }} runs-on: ubuntu-latest needs: detect-ci-trigger if: | diff --git a/.gitignore b/.gitignore index 80b2ee324..238a9947a 100644 --- a/.gitignore +++ b/.gitignore @@ -114,6 +114,10 @@ asv_bench/.asv/ # VS Code .vscode/ +# PyCharm +.idea/ + +# dask dask-worker-space # End of https://www.gitignore.io/api/python diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0c08fcea..10b7a292f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,11 @@ repos: exclude: '.ipynb|asv.conf.json' - id: trailing-whitespace + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort-fix + - repo: https://github.com/psf/black-pre-commit-mirror rev: 24.4.2 hooks: @@ -30,6 +35,7 @@ repos: rev: 7.1.0 hooks: - id: flake8 + args: [ '--max-line-length=93', '--extend-ignore=W503' ] - repo: https://github.com/PyCQA/isort rev: 5.13.2 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d70fa3127..86fa860d5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,6 +22,9 @@ Internals/Minor Fixes - Fixed some issues with the documentation build to address rendering errors and reduce the number of warnings on ReadTheDocs. (pr:`843`) `Trevor James Smith`_ - Fixed some issues with the typing hints of classes functions. (pr:`850`) `Trevor James Smith`_ - Fixed several issues with incompatible dependency configurations in the CI and addressed a few deprecations. (pr:`861`) `Trevor James Smith`_ +- `climpred` has adopted `PEP 621 `_ for specifying project metadata. (pr:`862`) `Trevor James Smith`_ +- `climpred` now uses the `src layout `_ for the package file structure. (pr:`862`) `Trevor James Smith`_ +- Drop ``python<=3.8`` support. (:pr:`862`) `Trevor James Smith`_. climpred v2.4.0 (2023-11-09) ============================ @@ -224,7 +227,6 @@ Data variables: using :py:func:`~climpred.reference.compute_persistence_from_first_lead`. (:issue:`637`, :pr:`706`) `Aaron Spring`_. - Internals/Minor Fixes --------------------- - Reduce dependencies. (:pr:`686`) `Aaron Spring`_. @@ -1038,6 +1040,7 @@ Documentation - Add page for `publications `_ and `helpful links `_. (:pr:`270`) `Riley X. Brady`_. + climpred v1.1.0 (2019-09-23) ============================ @@ -1072,6 +1075,7 @@ Documentation - Add scope of package to docs for clarity for users and developers. (:pr:`235`) `Riley X. Brady`_. + climpred v1.0.1 (2019-07-04) ============================ diff --git a/README.rst b/README.rst index 0442c3350..324c86597 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,6 @@ .. image:: https://i.imgur.com/HPOdOsR.png -Verification of weather and climate forecasts. +Verification of weather and climate forecasts .. Table version of badges inspired by pySTEPS. @@ -128,7 +128,7 @@ You can install the latest release of ``climpred`` using ``pip`` or ``conda``: .. code-block:: bash - pip install climpred[complete] + python -m pip install climpred[complete] .. code-block:: bash @@ -141,7 +141,7 @@ repository or installing directly from GitHub: git clone https://github.com/pangeo-data/climpred.git cd climpred - pip install . --upgrade + python -m pip install . --upgrade .. code-block:: bash diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index d72256738..e0043da2d 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -29,7 +29,7 @@ dependencies: - importlib-metadata <8.0.0 # Pin needed for esmpy compatibility. See: https://github.com/pangeo-data/xESMF/issues/374 - nc-time-axis >=1.4.0 - numba >=0.52 - - numpy >=1.25.0 + - numpy >=1.25.0,<2.0.0 # Pin below v2.0.0 until xclim supports it. - xclim - xesmf - xrft diff --git a/ci/requirements/maximum-tests.yml b/ci/requirements/maximum-tests.yml index e91ee1a19..3964f510f 100644 --- a/ci/requirements/maximum-tests.yml +++ b/ci/requirements/maximum-tests.yml @@ -3,18 +3,18 @@ channels: - conda-forge - nodefaults dependencies: - - python >=3.9 + - python >=3.9,<3.13 - bias_correction - cftime >=1.5.0 - coveralls - dask-core - eofs - - esmpy =*=mpi* # Ensures MPI works with version of esmpy. + # - esmpy =*=mpi* # Ensures MPI works with version of esmpy. # Commented out for CI testing. - h5netcdf - - importlib-metadata <8.0.0 # Pin needed for esmpy compatibility. See: https://github.com/pangeo-data/xESMF/issues/374 + - importlib-metadata <8.0.0 # Pin needed for esmpy compatibility. See: https://github.com/pangeo-data/xESMF/issues/374 - matplotlib-base - nc-time-axis >=1.4.0 - - numpy >=1.25.0 + - numpy >=1.25.0,<2.0.0 # Pin below v2.0.0 until xclim supports it. - pip - pooch - pytest <8.0.0 diff --git a/ci/requirements/minimum-tests.yml b/ci/requirements/minimum-tests.yml index d9be0fa2a..a6cd92acd 100644 --- a/ci/requirements/minimum-tests.yml +++ b/ci/requirements/minimum-tests.yml @@ -3,7 +3,7 @@ channels: - conda-forge - nodefaults dependencies: - - python >=3.9,<3.10 + - python >=3.9,<3.13 - cftime >=1.5.0 - coveralls - dask-core diff --git a/pyproject.toml b/pyproject.toml index 09c112759..2d9c6391c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,160 @@ +[build-system] +requires = [ + "setuptools>=64", + "setuptools_scm>=8", + "wheel" +] +build-backend = "setuptools.build_meta" + +[project] +name = "climpred" +authors = [ + {name = "Aaron Spring", email = "aaron.spring@mpimet.mpg.de"}, + {name = "Riley Brady", email = "riley.brady@colorado.edu"} +] +maintainers = [ + {name = "Aaron Spring", email = "aaron.spring@mpimet.mpg.de"}, + {name = "Trevor James Smith", email = "smith.trevorj@ouranos.ca"} +] +readme = "README.rst" +license = {file = "LICENSE.txt"} +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Atmospheric Science" +] +dependencies = [ + "cf_xarray >=0.6.0", + "cftime >=1.5.0", + "dask >=2021.10.0", + "numpy >=1.25.0", + "packaging", + "pooch >=1.4", + "xarray >=0.19.0", + "xskillscore >=0.0.20" +] +dynamic = ["version", "description"] + +[project.optional-dependencies] +accel = ["numba >=0.52", "bottleneck"] +bias-correction = ["xclim >=0.46", "bias-correction >=0.4", "numpy >=1.25.0,<2.0.0"] # pinned until xclim supports numpy>=2.0.0 +io = ["netcdf4"] # use h5netcdf when encountering seg faults as in GitHub Actions CI +regridding = ["xesmf"] # for installation see https://pangeo-xesmf.readthedocs.io/ +relative_entropy = ["eofs"] +test = ["netcdf4", "pre-commit", "pytest <8.0.0", "pytest-cov", "pytest-lazy-fixture", "pytest-xdist"] +viz = ["matplotlib", "nc-time-axis >=1.4.0"] +vwmp = ["xrft"] +complete = ["climpred[accel,bias-correction,viz,io,test,relative_entropy,vwmp]"] +docs = [ + "climpred[complete]", + "myst_nb", + "sphinx", + "sphinx-book-theme >=0.3.3", + "sphinx-copybutton", + "sphinxcontrib-bibtex", + "sphinxcontrib-napoleon" +] + +[project.urls] +"Homepage" = "https://climpred.readthedocs.io/en/stable/" +"Source" = "https://github.com/pangeo-data/climpred" +"Changelog" = "https://climpred.readthedocs.io/en/stable/changelog.html" +"Issue Tracker" = "https://github.com/pangeo-data/climpred/issues" + [tool.black] line-length = 88 +target-version = ["py39", "py310", "py311", "py312"] -[build-system] - requires = [ - "setuptools>=42", - "wheel", - "setuptools_scm[toml]>=3.4", - "setuptools_scm_git_archive", - ] - build-backend = "setuptools.build_meta" - - [tool.setuptools_scm] - fallback_version = "999" +[tool.isort] +known_first_party = "climpred" +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +line_length = 88 +combine_as_imports = true +skip = [ + "docs/source/conf.py" +] + +[tool.mypy] +exclude = "asv_bench|doc" +files = "." +show_error_codes = true +ignore_missing_imports = true + +[tool.mypy.overrides] +"bottleneck.*" = {ignore_missing_imports = true} +"cftime.*" = {ignore_missing_imports = true} +"mypy-dask.*" = {ignore_missing_imports = true} +"mypy-distributed.*" = {ignore_missing_imports = true} +"mypy-fsspec.*" = {ignore_missing_imports = true} +"mypy-matplotlib.*" = {ignore_missing_imports = true} +"mypy-nc_time_axis.*" = {ignore_missing_imports = true} +"mypy-numpy.*" = {ignore_missing_imports = true} +"mypy-netCDF4.*" = {ignore_missing_imports = true} +"mypy-pandas.*" = {ignore_missing_imports = true} +"mypy-pytest.*" = {ignore_missing_imports = true} +"mypy-scipy.*" = {ignore_missing_imports = true} +"mypy-setuptools" = {ignore_missing_imports = true} +"mypy-toolz.*" = {ignore_missing_imports = true} + +[tool.pytest.ini_options] +python_files = ["test_*.py"] +addopts = [ + "--color=yes", + "--verbose" +] +testpaths = [ + "climpred/tests" +] +filterwarnings = [ + # xarray + "ignore: Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning", + # upstream xarray + "ignore: Mean of empty slice:RuntimeWarning", + # only shows up during CI: no idea where its coming from, something inside bootstrapping + "ignore: `np.alen` is deprecated, use `len` instead:DeprecationWarning", + # ignore UserWarnings raise by warnings.warn() which do not break functionality + # therefore ignore in testing + "ignore::UserWarning", + # xarray + "ignore: tostring:DeprecationWarning", + # properscoring + "ignore: invalid value encountered:RuntimeWarning", + "ignore: divide by zero:RuntimeWarning", + # xarray + "ignore: 'base' in .resample():FutureWarning", + # matplotlib + "ignore: More than 20 figures:RuntimeWarning", + # numpy https://stackoverflow.com/questions/40659212/futurewarning-elementwise-comparison-failed-returning-scalar-but-in-the-futur#46721064 + "ignore: elementwise comparison failed", + # pydap + "ignore: Using or importing the ABCs from", + # xarray + "ignore: Passing method to CFTimeIndex.get_loc is deprecated", + # statsmodels + "ignore: pandas.Int64Index is deprecated" +] +markers = [ + "mistral: tests requiring being on MPI supercomputer", + "slow: marks tests as slow (deselect with '-m \"not slow\"')" +] + +[tool.setuptools.dynamic] +description = {file = "src/climpred/__init__.py"} + +[tool.setuptools_scm] +fallback_version = "999" +version_scheme = "post-release" +local_scheme = "dirty-tag" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8fbfcefd8..000000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -cf_xarray>=0.6.0 -cftime>=1.5.0 -dask>=2021.10.0 -numpy>=1.25.0 -packaging -pooch>=1.4 -xarray>=0.19.0 -xskillscore>=0.0.20 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 928477613..000000000 --- a/setup.cfg +++ /dev/null @@ -1,109 +0,0 @@ -[bdist_wheel] -universal = 1 - -[flake8] -ignore = W503 -# allowing doctests -max-line-length = 93 - -[black] -line-length = 88 - -[isort] -known_first_party=climpred -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True -line_length = 88 -combine_as_imports=True -skip= - docs/source/conf.py - setup.py - -[tool:pytest] -python_files=test_*.py -addopts = - --color=yes - --verbose -testpaths=climpred/tests -filterwarnings = - # from xarray - ignore:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning - # upstream xarray - ignore: Mean of empty slice:RuntimeWarning - # upstream xarray - ignore:dropping variables using `drop` will be deprecated; using drop_vars is encouraged:PendingDeprecationWarning - # only shows up during CI: no idea where its coming from, something inside bootstrapping - ignore:`np.alen` is deprecated, use `len` instead:DeprecationWarning - # ignore UserWarnings raise by warnings.warn() which do not break functionality - # therefore ignore in testing - ignore::UserWarning - # from xarray - ignore:tostring:DeprecationWarning - # from properscoring - ignore: invalid value encountered:RuntimeWarning - ignore: divide by zero:RuntimeWarning - # from xarray - ignore: 'base' in .resample():FutureWarning - # matplotlib - ignore: More than 20 figures:RuntimeWarning - # numpy https://stackoverflow.com/questions/40659212/futurewarning-elementwise-comparison-failed-returning-scalar-but-in-the-futur#46721064 - ignore: elementwise comparison failed - # pydap - ignore: Using or importing the ABCs from - # xarray - ignore: Passing method to CFTimeIndex.get_loc is deprecated - # statsmodels - ignore: pandas.Int64Index is deprecated -markers = - mistral: tests requiring being on MPI supercomputer - markers = - slow: marks tests as slow (deselect with '-m "not slow"') - serial - -[aliases] -test = pytest - -[doc8] -max-line-length=88 -ignore-path=climpred/tests - -[mypy] -exclude = asv_bench|doc -files = . -show_error_codes = True - -# Most of the numerical computing stack doesn't have type annotations yet. -[mypy-bottleneck.*] -ignore_missing_imports = True -[mypy-cftime.*] -ignore_missing_imports = True -[mypy-dask.*] -ignore_missing_imports = True -[mypy-distributed.*] -ignore_missing_imports = True -[mypy-fsspec.*] -ignore_missing_imports = True -[mypy-matplotlib.*] -ignore_missing_imports = True -[mypy-nc_time_axis.*] -ignore_missing_imports = True -[mypy-numpy.*] -ignore_missing_imports = True -[mypy-netCDF4.*] -ignore_missing_imports = True -[mypy-pandas.*] -ignore_missing_imports = True -[mypy-pytest.*] -ignore_missing_imports = True -[mypy-scipy.*] -ignore_missing_imports = True -[mypy-setuptools] -ignore_missing_imports = True -[mypy-toolz.*] -ignore_missing_imports = True -# version spanning code is hard to type annotate (and most of this module will -# be going away soon anyways) -[mypy-xarray.core.pycompat] -ignore_errors = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 07c59210e..000000000 --- a/setup.py +++ /dev/null @@ -1,79 +0,0 @@ -from os.path import exists - -from setuptools import find_packages, setup - -if exists("README.rst"): - with open("README.rst") as f: - long_description = f.read() -else: - long_description = "" - -with open("requirements.txt") as f: - install_requires = f.read().strip().split("\n") - -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Education", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Atmospheric Science", -] - -extras_require = { - "accel": ["numba>=0.52", "bottleneck"], - "bias-correction": ["xclim>=0.46", "bias-correction>=0.4"], - "viz": ["matplotlib", "nc-time-axis>=1.4.0"], - "io": ["netcdf4"], # use h5netcdf when encountering seg faults as in GHA CI - "regridding": [ - "xesmf" - ], # for installation see https://pangeo-xesmf.readthedocs.io/ - "relative_entropy": ["eofs"], - "vwmp": ["xrft"], -} -extras_require["complete"] = sorted({v for req in extras_require.values() for v in req}) -extras_require["complete"].remove( - "xesmf" -) # circumventing esmpy/xesmf installation issues; use conda -# after complete is set, add in test -extras_require["test"] = [ - "netcdf4", - "pre-commit", - "pytest<8", - "pytest-cov", - "pytest-lazy-fixture", - "pytest-xdist", -] -extras_require["docs"] = extras_require["complete"] + [ - "myst_nb", - "sphinx", - "sphinx-copybutton", - "sphinx-book-theme>=0.3.3", - "sphinxcontrib-bibtex", - "sphinxcontrib-napoleon", -] - -setup( - maintainer="Aaron Spring", - maintainer_email="aaron.spring@mpimet.mpg.de", - description="Verification of weather and climate forecasts." + " prediction.", - install_requires=install_requires, - python_requires=">=3.8", - license="MIT", - long_description=long_description, - classifiers=CLASSIFIERS, - name="climpred", - packages=find_packages(), - test_suite="climpred/tests", - tests_require=["pytest"], - url="https://github.com/pangeo-data/climpred", - use_scm_version={"version_scheme": "post-release", "local_scheme": "dirty-tag"}, - zip_safe=False, - extras_require=extras_require, -) diff --git a/climpred/__init__.py b/src/climpred/__init__.py similarity index 90% rename from climpred/__init__.py rename to src/climpred/__init__.py index 6e3de9023..6fed9f331 100644 --- a/climpred/__init__.py +++ b/src/climpred/__init__.py @@ -1,3 +1,5 @@ +"""Verification of weather and climate forecasts and prediction.""" + # flake8: noqa from importlib.metadata import PackageNotFoundError, version as _get_version diff --git a/climpred/alignment.py b/src/climpred/alignment.py similarity index 100% rename from climpred/alignment.py rename to src/climpred/alignment.py diff --git a/climpred/bias_removal.py b/src/climpred/bias_removal.py similarity index 100% rename from climpred/bias_removal.py rename to src/climpred/bias_removal.py diff --git a/climpred/bootstrap.py b/src/climpred/bootstrap.py similarity index 99% rename from climpred/bootstrap.py rename to src/climpred/bootstrap.py index 066b60c7f..4ef60a2a2 100644 --- a/climpred/bootstrap.py +++ b/src/climpred/bootstrap.py @@ -394,7 +394,7 @@ def _maybe_auto_chunk(ds, dims): xr.Dataset: auto-chunked along `dims` """ - if dask.is_dask_collection(ds) and dims is not []: + if dask.is_dask_collection(ds) and dims != []: if isinstance(dims, str): dims = [dims] chunks = [d for d in dims if d in ds.dims] diff --git a/climpred/checks.py b/src/climpred/checks.py similarity index 100% rename from climpred/checks.py rename to src/climpred/checks.py diff --git a/climpred/classes.py b/src/climpred/classes.py similarity index 100% rename from climpred/classes.py rename to src/climpred/classes.py diff --git a/climpred/comparisons.py b/src/climpred/comparisons.py similarity index 100% rename from climpred/comparisons.py rename to src/climpred/comparisons.py diff --git a/climpred/conftest.py b/src/climpred/conftest.py similarity index 100% rename from climpred/conftest.py rename to src/climpred/conftest.py diff --git a/climpred/constants.py b/src/climpred/constants.py similarity index 100% rename from climpred/constants.py rename to src/climpred/constants.py diff --git a/climpred/exceptions.py b/src/climpred/exceptions.py similarity index 100% rename from climpred/exceptions.py rename to src/climpred/exceptions.py diff --git a/climpred/graphics.py b/src/climpred/graphics.py similarity index 100% rename from climpred/graphics.py rename to src/climpred/graphics.py diff --git a/climpred/horizon.py b/src/climpred/horizon.py similarity index 100% rename from climpred/horizon.py rename to src/climpred/horizon.py diff --git a/climpred/logging.py b/src/climpred/logging.py similarity index 100% rename from climpred/logging.py rename to src/climpred/logging.py diff --git a/climpred/metrics.py b/src/climpred/metrics.py similarity index 100% rename from climpred/metrics.py rename to src/climpred/metrics.py diff --git a/climpred/options.py b/src/climpred/options.py similarity index 100% rename from climpred/options.py rename to src/climpred/options.py diff --git a/climpred/prediction.py b/src/climpred/prediction.py similarity index 100% rename from climpred/prediction.py rename to src/climpred/prediction.py diff --git a/climpred/preprocessing/__init__.py b/src/climpred/preprocessing/__init__.py similarity index 100% rename from climpred/preprocessing/__init__.py rename to src/climpred/preprocessing/__init__.py diff --git a/climpred/preprocessing/mpi.py b/src/climpred/preprocessing/mpi.py similarity index 100% rename from climpred/preprocessing/mpi.py rename to src/climpred/preprocessing/mpi.py diff --git a/climpred/preprocessing/shared.py b/src/climpred/preprocessing/shared.py similarity index 100% rename from climpred/preprocessing/shared.py rename to src/climpred/preprocessing/shared.py diff --git a/climpred/reference.py b/src/climpred/reference.py similarity index 99% rename from climpred/reference.py rename to src/climpred/reference.py index a0ce9b40c..b0cc85639 100644 --- a/climpred/reference.py +++ b/src/climpred/reference.py @@ -103,7 +103,9 @@ def climatology( init_lead["time"] = init_lead["time"].to_index().to_datetimeindex() init_lead = init_lead["time"] climatology_day = verif.groupby(f"time.{seasonality_str}").mean() - with warnings.catch_warnings(): # ignore numpy warning https://stackoverflow.com/questions/40659212/futurewarning-elementwise-comparison-failed-returning-scalar-but-in-the-futur#46721064 # noqa: E501 + with ( + warnings.catch_warnings() + ): # ignore numpy warning https://stackoverflow.com/questions/40659212/futurewarning-elementwise-comparison-failed-returning-scalar-but-in-the-futur#46721064 # noqa: E501 warnings.simplefilter(action="ignore", category=FutureWarning) # enlarge times to get climatology_forecast times # this prevents errors if verification.time and hindcast.init are too much apart diff --git a/climpred/relative_entropy.py b/src/climpred/relative_entropy.py similarity index 100% rename from climpred/relative_entropy.py rename to src/climpred/relative_entropy.py diff --git a/climpred/smoothing.py b/src/climpred/smoothing.py similarity index 100% rename from climpred/smoothing.py rename to src/climpred/smoothing.py diff --git a/climpred/stats.py b/src/climpred/stats.py similarity index 100% rename from climpred/stats.py rename to src/climpred/stats.py diff --git a/climpred/testing.py b/src/climpred/testing.py similarity index 100% rename from climpred/testing.py rename to src/climpred/testing.py diff --git a/climpred/tests/__init__.py b/src/climpred/tests/__init__.py similarity index 100% rename from climpred/tests/__init__.py rename to src/climpred/tests/__init__.py diff --git a/climpred/tests/test_HindcastEnsemble_class.py b/src/climpred/tests/test_HindcastEnsemble_class.py similarity index 100% rename from climpred/tests/test_HindcastEnsemble_class.py rename to src/climpred/tests/test_HindcastEnsemble_class.py diff --git a/climpred/tests/test_PerfectModelEnsemble_class.py b/src/climpred/tests/test_PerfectModelEnsemble_class.py similarity index 100% rename from climpred/tests/test_PerfectModelEnsemble_class.py rename to src/climpred/tests/test_PerfectModelEnsemble_class.py diff --git a/climpred/tests/test_PredictionEnsemble.py b/src/climpred/tests/test_PredictionEnsemble.py similarity index 100% rename from climpred/tests/test_PredictionEnsemble.py rename to src/climpred/tests/test_PredictionEnsemble.py diff --git a/climpred/tests/test_alignment.py b/src/climpred/tests/test_alignment.py similarity index 100% rename from climpred/tests/test_alignment.py rename to src/climpred/tests/test_alignment.py diff --git a/climpred/tests/test_bias_removal.py b/src/climpred/tests/test_bias_removal.py similarity index 100% rename from climpred/tests/test_bias_removal.py rename to src/climpred/tests/test_bias_removal.py diff --git a/climpred/tests/test_bootstrap.py b/src/climpred/tests/test_bootstrap.py similarity index 100% rename from climpred/tests/test_bootstrap.py rename to src/climpred/tests/test_bootstrap.py diff --git a/climpred/tests/test_checks.py b/src/climpred/tests/test_checks.py similarity index 100% rename from climpred/tests/test_checks.py rename to src/climpred/tests/test_checks.py diff --git a/climpred/tests/test_comparisons.py b/src/climpred/tests/test_comparisons.py similarity index 100% rename from climpred/tests/test_comparisons.py rename to src/climpred/tests/test_comparisons.py diff --git a/climpred/tests/test_compute_dims.py b/src/climpred/tests/test_compute_dims.py similarity index 100% rename from climpred/tests/test_compute_dims.py rename to src/climpred/tests/test_compute_dims.py diff --git a/climpred/tests/test_demo_data.py b/src/climpred/tests/test_demo_data.py similarity index 100% rename from climpred/tests/test_demo_data.py rename to src/climpred/tests/test_demo_data.py diff --git a/climpred/tests/test_effective_p_value.py b/src/climpred/tests/test_effective_p_value.py similarity index 100% rename from climpred/tests/test_effective_p_value.py rename to src/climpred/tests/test_effective_p_value.py diff --git a/climpred/tests/test_graphics.py b/src/climpred/tests/test_graphics.py similarity index 100% rename from climpred/tests/test_graphics.py rename to src/climpred/tests/test_graphics.py diff --git a/climpred/tests/test_hindcast_prediction.py b/src/climpred/tests/test_hindcast_prediction.py similarity index 100% rename from climpred/tests/test_hindcast_prediction.py rename to src/climpred/tests/test_hindcast_prediction.py diff --git a/climpred/tests/test_horizon.py b/src/climpred/tests/test_horizon.py similarity index 100% rename from climpred/tests/test_horizon.py rename to src/climpred/tests/test_horizon.py diff --git a/climpred/tests/test_lead_time_resolutions.py b/src/climpred/tests/test_lead_time_resolutions.py similarity index 100% rename from climpred/tests/test_lead_time_resolutions.py rename to src/climpred/tests/test_lead_time_resolutions.py diff --git a/climpred/tests/test_logging.py b/src/climpred/tests/test_logging.py similarity index 100% rename from climpred/tests/test_logging.py rename to src/climpred/tests/test_logging.py diff --git a/climpred/tests/test_map.py b/src/climpred/tests/test_map.py similarity index 100% rename from climpred/tests/test_map.py rename to src/climpred/tests/test_map.py diff --git a/climpred/tests/test_metrics.py b/src/climpred/tests/test_metrics.py similarity index 100% rename from climpred/tests/test_metrics.py rename to src/climpred/tests/test_metrics.py diff --git a/climpred/tests/test_metrics_perfect.py b/src/climpred/tests/test_metrics_perfect.py similarity index 100% rename from climpred/tests/test_metrics_perfect.py rename to src/climpred/tests/test_metrics_perfect.py diff --git a/climpred/tests/test_options.py b/src/climpred/tests/test_options.py similarity index 100% rename from climpred/tests/test_options.py rename to src/climpred/tests/test_options.py diff --git a/climpred/tests/test_perfect_model_prediction.py b/src/climpred/tests/test_perfect_model_prediction.py similarity index 100% rename from climpred/tests/test_perfect_model_prediction.py rename to src/climpred/tests/test_perfect_model_prediction.py diff --git a/climpred/tests/test_preprocessing.py b/src/climpred/tests/test_preprocessing.py similarity index 100% rename from climpred/tests/test_preprocessing.py rename to src/climpred/tests/test_preprocessing.py diff --git a/climpred/tests/test_probabilistic.py b/src/climpred/tests/test_probabilistic.py similarity index 100% rename from climpred/tests/test_probabilistic.py rename to src/climpred/tests/test_probabilistic.py diff --git a/climpred/tests/test_reference.py b/src/climpred/tests/test_reference.py similarity index 100% rename from climpred/tests/test_reference.py rename to src/climpred/tests/test_reference.py diff --git a/climpred/tests/test_relative_entropy.py b/src/climpred/tests/test_relative_entropy.py similarity index 100% rename from climpred/tests/test_relative_entropy.py rename to src/climpred/tests/test_relative_entropy.py diff --git a/climpred/tests/test_repr.py b/src/climpred/tests/test_repr.py similarity index 100% rename from climpred/tests/test_repr.py rename to src/climpred/tests/test_repr.py diff --git a/climpred/tests/test_smoothing.py b/src/climpred/tests/test_smoothing.py similarity index 100% rename from climpred/tests/test_smoothing.py rename to src/climpred/tests/test_smoothing.py diff --git a/climpred/tests/test_stats.py b/src/climpred/tests/test_stats.py similarity index 100% rename from climpred/tests/test_stats.py rename to src/climpred/tests/test_stats.py diff --git a/climpred/tests/test_uninitialized.py b/src/climpred/tests/test_uninitialized.py similarity index 100% rename from climpred/tests/test_uninitialized.py rename to src/climpred/tests/test_uninitialized.py diff --git a/climpred/tests/test_utils.py b/src/climpred/tests/test_utils.py similarity index 100% rename from climpred/tests/test_utils.py rename to src/climpred/tests/test_utils.py diff --git a/climpred/tests/test_valid_time.py b/src/climpred/tests/test_valid_time.py similarity index 100% rename from climpred/tests/test_valid_time.py rename to src/climpred/tests/test_valid_time.py diff --git a/climpred/tests/test_versioning.py b/src/climpred/tests/test_versioning.py similarity index 100% rename from climpred/tests/test_versioning.py rename to src/climpred/tests/test_versioning.py diff --git a/climpred/tutorial.py b/src/climpred/tutorial.py similarity index 100% rename from climpred/tutorial.py rename to src/climpred/tutorial.py diff --git a/climpred/utils.py b/src/climpred/utils.py similarity index 100% rename from climpred/utils.py rename to src/climpred/utils.py diff --git a/climpred/versioning/__init__.py b/src/climpred/versioning/__init__.py similarity index 100% rename from climpred/versioning/__init__.py rename to src/climpred/versioning/__init__.py diff --git a/climpred/versioning/print_versions.py b/src/climpred/versioning/print_versions.py similarity index 100% rename from climpred/versioning/print_versions.py rename to src/climpred/versioning/print_versions.py