diff --git a/.github/workflows/build_workflow.yml b/.github/workflows/build_workflow.yml index 8142d66f1..a72194b9c 100644 --- a/.github/workflows/build_workflow.yml +++ b/.github/workflows/build_workflow.yml @@ -9,80 +9,89 @@ on: workflow_dispatch: +env: + CANCEL_OTHERS: true + PATHS_IGNORE: '["**/README.md", "**/docs/**", "**/examples/**", "**/misc/**", "**/.vscode/**"]' + jobs: - check-jobs-to-skip: + pre-commit-hooks: runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} + timeout-minutes: 2 steps: - id: skip_check uses: fkirc/skip-duplicate-actions@master with: - cancel_others: true - paths_ignore: '["**/README.md", "**/docs/**", "**/examples/**", "**/misc/**"]' + cancel_others: ${{ env.CANCEL_OTHERS }} + paths_ignore: ${{ env.PATHS_IGNORE }} - pre-commit-hooks: - needs: check-jobs-to-skip - if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }} - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - name: Checkout Code Repository + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + name: Checkout Code Repository uses: actions/checkout@v2 - - name: Set up Python 3.7 + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.9 - # Run all pre-commit hooks on all the files. - # Getting only staged files can be tricky in case a new PR is opened - # since the action is run on a branch in detached head state - - name: Install and Run Pre-commit - uses: pre-commit/action@v2.0.0 + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + # Run all pre-commit hooks on all the files. + # Getting only staged files can be tricky in case a new PR is opened + # since the action is run on a branch in detached head state + name: Install and Run Pre-commit + uses: pre-commit/action@v2.0.3 build: - needs: check-jobs-to-skip - if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }} - runs-on: ubuntu-latest + name: Build (Python ${{ matrix.python-version }}) + runs-on: "ubuntu-latest" + timeout-minutes: 20 defaults: run: shell: bash -l {0} - timeout-minutes: 20 + strategy: + matrix: + python-version: ["3.8", "3.9"] steps: - - uses: actions/checkout@v2 + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + cancel_others: ${{ env.CANCEL_OTHERS }} + paths_ignore: ${{ env.PATHS_IGNORE }} - - name: Cache Conda + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + uses: actions/checkout@v2 + + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + name: Cache Conda uses: actions/cache@v2 env: - # Increase this value to reset cache if conda/e3sm_diags_env_dev.yml has not changed in the workflow + # Increase this value to reset cache if conda-env/ci.yml has not changed in the workflow CACHE_NUMBER: 0 with: path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('conda/e3sm_diags_env_dev.yml') }} + key: + ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{ + hashFiles('conda-env/dev.yml') }} - - name: Build Conda Environment + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + name: Set up Conda Environment uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: e3sm_diags_env_dev - environment-file: conda/e3sm_diags_env_dev.yml + activate-environment: "e3sm_diags_ci" + environment-file: conda-env/ci.yml channel-priority: strict auto-update-conda: true # IMPORTANT: This needs to be set for caching to work properly! use-only-tar-bz2: true + python-version: ${{ matrix.python-version }} - - if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }} - name: Show Conda Environment Info + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + name: Install e3sm_diags run: | - conda config --set anaconda_upload no - conda info - conda list - - - name: Install `e3sm-diags` Package - run: pip install . + python -m pip install . - - name: Run Tests + - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} + name: Run Tests env: CHECK_IMAGES: True run: bash tests/test.sh @@ -100,28 +109,25 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v2 + - name: Cache Conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if conda-env/docs.yml has not changed in the workflow + CACHE_NUMBER: 0 with: - python-version: 3.7 + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ + hashFiles('conda-env/docs.yml') }} - - name: Cache pip - uses: actions/cache@v2 + - name: Set up Conda Environment + uses: conda-incubator/setup-miniconda@v2 with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-publish-docs - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - # Using pip for Sphinx dependencies because it takes too long to reproduce a conda environment (~10 secs vs. 3-4 mins) - # Low risk trade-off with mismatching dependencies in `e3sm_diags_env_dev.yml` - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install sphinx==4.0.2 sphinx_rtd_theme==0.5.2 sphinx-multiversion==0.2.4 docutils==0.16 + activate-environment: "e3sm_diags_docs" + environment-file: conda-env/docs.yml + channel-priority: strict + auto-update-conda: true + # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: true - name: Build Sphinx Docs run: | diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index d8f80ab5f..b396128c1 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -17,28 +17,25 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Cache pip + - name: Cache Conda uses: actions/cache@v2 + env: + # Increase this value to reset cache if conda-env/docs.yml has not changed in the workflow + CACHE_NUMBER: 0 with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-publish-docs - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ + hashFiles('conda-env/docs.yml') }} - # Using pip for Sphinx dependencies because it takes too long to reproduce a conda environment (~10 secs vs. 3-4 mins) - # Low risk trade-off with mismatching dependencies in `e3sm_diags_env_dev.yml` - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install sphinx==4.0.2 sphinx_rtd_theme==0.5.2 sphinx-multiversion==0.2.4 docutils==0.16 + - name: Set up Conda Environment + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: "e3sm_diags_docs" + environment-file: conda-env/docs.yml + channel-priority: strict + auto-update-conda: true + # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: true - name: Build Sphinx Docs run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bcd0e42c8..5e93fc045 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,33 +4,33 @@ fail_fast: true repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.1.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 21.5b2 + rev: 22.1.0 hooks: - id: black - repo: https://github.com/timothycrosley/isort - rev: 5.7.0 + rev: 5.10.1 hooks: - id: isort # Need to use flake8 GitHub mirror due to CentOS git issue with GitLab # https://github.com/pre-commit/pre-commit/issues/1206 - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 4.0.1 hooks: - id: flake8 args: ["--config=setup.cfg"] additional_dependencies: [flake8-isort] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v0.931 hooks: - id: mypy args: ["--config=setup.cfg"] diff --git a/conda-env/ci.yml b/conda-env/ci.yml new file mode 100644 index 000000000..c2047b469 --- /dev/null +++ b/conda-env/ci.yml @@ -0,0 +1,28 @@ +# Conda continuous integration/continuous deployment (CI/CD) for running the repository's GitHub Actions CI/CD workflows. +# This env includes the latest dependencies required to build the package (similar to a conda recipe `meta.yaml` file). +# End-users are not expected to use this environment. +name: e3sm_diags_ci +channels: + - conda-forge + - defaults +dependencies: + # Base + # ================== + - python>=3.8 + - pip + - numpy + - matplotlib + - beautifulsoup4 + - cartopy + - cartopy_offlinedata + - cdp + - cdms2 + - cdtime + - cdutil + - genutil + - lxml + - netcdf4 + # Required in test suite + - dask + - scipy +prefix: /opt/miniconda3/envs/e3sm_diags_ci diff --git a/conda-env/dev.yml b/conda-env/dev.yml new file mode 100644 index 000000000..41ae24fab --- /dev/null +++ b/conda-env/dev.yml @@ -0,0 +1,47 @@ +# Conda development environment for testing local source code changes to `e3sm_diags` before merging them to production (`master` branch). +name: e3sm_diags_dev +channels: + - conda-forge + - defaults +dependencies: + # Base + # ================= + - python=3.9.10 + - pip=22.0.3 + - numpy=1.22.2 + - matplotlib=3.5.1 + - beautifulsoup4=4.10.0 + - cartopy=0.20.2 + - cartopy_offlinedata=0.2.4 + - cdp=1.7.0 + - cdms2=3.1.5 + - cdtime=3.1.4 + - cdutil=8.2.1 + - genutil=8.2.1 + - lxml=4.8.0 + - netcdf4=1.5.8 + # Required in test suite + - dask=2022.2.0 + - scipy=1.8.0 + # Quality Assurance + # ================= + # If versions are updated, also update 'rev' in `.pre-commit.config.yaml` + - black=22.1.0 + - flake8=4.0.1 + - flake8-isort=4.1.1 + - isort=5.10.1 + - mypy=0.931 + - pre-commit=2.17.0 + # Developer Tools + # ================= + - tbump==6.7.0 + # Documentation + # ================= + - sphinx=4.3.2 # FIXME: > 4.3 conflicts with another package, maybe lxml (not sure) + - sphinx_rtd_theme=1.0.0 + # Used when converting Jupyter notebooks to import to Sphinx + - nbconvert=6.4.2 + - pandoc=2.17.1 + - pip: + - sphinx-multiversion==0.2.4 +prefix: /opt/miniconda3/envs/e3sm_diags_dev diff --git a/conda-env/docs.yml b/conda-env/docs.yml new file mode 100644 index 000000000..f38634019 --- /dev/null +++ b/conda-env/docs.yml @@ -0,0 +1,17 @@ +# Conda documentation environment for building documentation, including through automation in CI/CD. +name: e3sm_diags_docs +channels: + - conda-forge + - defaults +dependencies: + # Base + # ================= + - python=3.9.10 + - pip=22.0.3 + # Documentation + # ================= + - sphinx=4.4.0 + - sphinx_rtd_theme=1.0.0 + - pip: + - sphinx-multiversion==0.2.4 +prefix: /opt/miniconda3/envs/e3sm_diags_docs diff --git a/conda-env/prod.yml b/conda-env/prod.yml new file mode 100644 index 000000000..29e2af07e --- /dev/null +++ b/conda-env/prod.yml @@ -0,0 +1,12 @@ +# Conda production environment for production runs using the latest stable release of `e3sm_diags`. +name: e3sm_diags_prod +channels: + - conda-forge + - defaults +dependencies: + # Base + # ================= + - python=3.9.10 + - pip=22.0.3 + - e3sm_diags=2.6.1 +prefix: /opt/miniconda3/envs/e3sm_diags_prod diff --git a/conda/e3sm_diags_env.yml b/conda/e3sm_diags_env.yml deleted file mode 100644 index 991aefdf6..000000000 --- a/conda/e3sm_diags_env.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: e3sm_diags_env -channels: - - conda-forge - - defaults -dependencies: - # Base - # ============== - - python=3.9.4 - - pip=21.1.2 - - numpy=1.20.3 - - matplotlib=3.4.2 - - beautifulsoup4=4.9.3 - - cartopy=0.19.0 - - cartopy_offlinedata - - cdp=1.7.0 - - cdms2=3.1.5 - - cdtime=3.1.4 - - cdutil=8.2.1 - - genutil=8.2.1 - - lxml=4.6.3 - - netcdf4=1.5.6 - # Additional - # ============== - - e3sm_diags=2.6.1 -prefix: /opt/miniconda3/envs/e3sm_diags_env diff --git a/conda/e3sm_diags_env_dev.yml b/conda/e3sm_diags_env_dev.yml deleted file mode 100644 index 1f69b1dca..000000000 --- a/conda/e3sm_diags_env_dev.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: e3sm_diags_env_dev -channels: - - conda-forge - - defaults -dependencies: - # Base - # ================= - - python=3.9.4 - - pip=21.1.2 - - numpy=1.20.3 - - matplotlib=3.4.2 - - beautifulsoup4=4.9.3 - - cartopy=0.19.0 - - cartopy_offlinedata - - cdp=1.7.0 - - cdms2=3.1.5 - - cdtime=3.1.4 - - cdutil=8.2.1 - - genutil=8.2.1 - - lxml=4.6.3 - - netcdf4=1.5.6 - # Quality Assurance - # ================= - # If versions are updated, also update 'rev' in `.pre-commit.config.yaml` - - black=21.5b2 - - flake8=3.9.2 - - flake8-isort=4.0.0 - - mypy=0.812 - - pre-commit=2.13.0 - # Testing - # ================= - - dask - - scipy - # Documentation - # ================= - - sphinx=4.0.2 - - sphinx_rtd_theme=0.5.2 - # Need to pin docutils because 0.17 has a bug with unordered lists - # https://github.com/readthedocs/sphinx_rtd_theme/issues/1115 - - docutils=0.16 - # Used when converting Jupyter notebooks to import to Sphinx - - nbconvert=6.0.7 - - pandoc=2.14 - - pip: - - sphinx-multiversion==0.2.4 - - tbump==6.3.2 -prefix: /opt/miniconda3/envs/e3sm_diags_env_dev diff --git a/conda/meta.yaml b/conda/meta.yaml deleted file mode 100644 index d49f50102..000000000 --- a/conda/meta.yaml +++ /dev/null @@ -1,45 +0,0 @@ -{% set name = "e3sm_diags" %} -{% set version = "2.6.1" %} - -package: - name: {{ name|lower }} - version: {{ version }} - -source: - git_url: git://github.com/E3SM-Project/e3sm_diags - git_rev: v{{ version }} - -build: - number: 0 - noarch: python - script: {{ PYTHON }} -m pip install . --no-deps -vv - -requirements: - host: - - python - - setuptools - - pip - - run: - - python - - cdp >=1.7.0 - - cdms2 - - cdutil - - genutil - - cdtime - - numpy - - netcdf4 - - matplotlib - - cartopy - - cartopy_offlinedata - - beautifulsoup4 - - lxml - - dask - - scipy - - output_viewer >=1.3.3 - -about: - home: https://github.com/E3SM-Project/e3sm_diags - license: BSD-3-Clause - license_file: LICENSE - summary: Diagnostics package for the DOE's Energy Exascale Earth System Model (E3SM) project. diff --git a/docs/source/dev_guide/releasing-e3sm-diags.rst b/docs/source/dev_guide/releasing-e3sm-diags.rst index 7db32ea7b..7b799cbb5 100644 --- a/docs/source/dev_guide/releasing-e3sm-diags.rst +++ b/docs/source/dev_guide/releasing-e3sm-diags.rst @@ -37,10 +37,8 @@ Bumping the Version + setup.py:113 version="2.6.0", - acme_diags/__init__.py:4 __version__ = "v2.5.0" + acme_diags/__init__.py:4 __version__ = "v2.6.0" - - conda/meta.yaml:2 {% set version = "2.5.0" %} - + conda/meta.yaml:2 {% set version = "2.6.0" %} - - conda/e3sm_diags_env.yml:22 - e3sm_diags=2.5.0 - + conda/e3sm_diags_env.yml:22 - e3sm_diags=2.6.0 + - conda-env/prod.yml:22 - e3sm_diags=2.5.0 + + conda-env/prod.yml:22 - e3sm_diags=2.6.0 - tbump.toml:5 current = "2.5.0" + tbump.toml:5 current = "2.6.0" => Would run these git commands diff --git a/docs/source/install.rst b/docs/source/install.rst index 214ec5515..89832153a 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -133,7 +133,7 @@ an SSL error unless you disable the SSL verification: :: - wget https://raw.githubusercontent.com/E3SM-Project/e3sm_diags/master/conda/e3sm_diags_env.yml + wget https://raw.githubusercontent.com/E3SM-Project/e3sm_diags/master/conda-env/prod.yml 3. Change ``prefix`` in that file to be your conda prefix. Typically, this will be ``~/miniconda3/envs/e3sm_diags_env``. @@ -150,7 +150,7 @@ an SSL error unless you disable the SSL verification: :: - conda env create -f e3sm_diags_env.yml + conda env create -f conda-env/prod.yml conda activate e3sm_diags_env .. _dev-env: @@ -231,7 +231,7 @@ Instead, the developer will ``pip install .`` to build ``e3sm-diags`` with chang :: - conda env create -f conda/e3sm_diags_env_dev.yml + conda env create -f conda-env/dev.yml conda activate e3sm_diags_env_dev 6. Install ``pre-commit``. diff --git a/e3sm_diags/derivations/acme.py b/e3sm_diags/derivations/acme.py index 2e55d7bd4..72b7190f4 100644 --- a/e3sm_diags/derivations/acme.py +++ b/e3sm_diags/derivations/acme.py @@ -159,7 +159,7 @@ def precst(precc, precl): def tauxy(taux, tauy): """tauxy = (taux^2 + tauy^2)sqrt""" - var = (taux ** 2 + tauy ** 2) ** 0.5 + var = (taux**2 + tauy**2) ** 0.5 var = convert_units(var, "N/m^2") var.long_name = "Total surface wind stress" return var @@ -261,7 +261,7 @@ def netcf4srf(fsntoa, fsntoac, flntoa, flntoac): def fldsc(ts, flnsc): """Clearsky Surf LW downwelling flux""" - var = 5.67e-8 * ts ** 4 - flnsc + var = 5.67e-8 * ts**4 - flnsc var.units = "W/m2" var.long_name = "Clearsky Surf LW downwelling flux" return var diff --git a/e3sm_diags/driver/qbo_driver.py b/e3sm_diags/driver/qbo_driver.py index eb5b51be2..8a6bc4dcf 100644 --- a/e3sm_diags/driver/qbo_driver.py +++ b/e3sm_diags/driver/qbo_driver.py @@ -137,7 +137,7 @@ def get_psd_from_deseason(xraw, period_new): # Calculate amplitude as a function of frequency amplitude0 = 2 * abs(x0[0 : int(NFFT0 / 2 + 1)]) # Calculate power spectral density as a function of frequency - psd_x0 = amplitude0 ** 2 / L0 + psd_x0 = amplitude0**2 / L0 # Total spectral power # In the next code block, we will perform an interpolation using the period # (interpolating values of amplitude0_flipped and psd_x0_flipped from period0_flipped to period_new). diff --git a/e3sm_diags/driver/tc_analysis_driver.py b/e3sm_diags/driver/tc_analysis_driver.py index 05a5166f9..0d515bdc9 100644 --- a/e3sm_diags/driver/tc_analysis_driver.py +++ b/e3sm_diags/driver/tc_analysis_driver.py @@ -348,7 +348,7 @@ def _derive_metrics_per_basin( wind_new = wind[wind > 35] mod_ace[np.where(years - yer[0] == 0)] = ( - mod_ace[np.where(years - yer[0] == 0)] + np.sum(wind_new ** 2) / 1e4 + mod_ace[np.where(years - yer[0] == 0)] + np.sum(wind_new**2) / 1e4 ) mod_vars = { @@ -490,7 +490,7 @@ def _calc_mean_ace(vsmc: "MaskedArray", yearic: np.ndarray, num_rows: int) -> fl if yearic[j] == OBS_YEARS[i]: wind = vsmc[j, :] wind_ts = wind[wind >= 35] - ace[i] = ace[i] + np.sum(wind_ts ** 2) / 1e4 + ace[i] = ace[i] + np.sum(wind_ts**2) / 1e4 return np.mean(ace) diff --git a/e3sm_diags/driver/utils/diurnal_cycle.py b/e3sm_diags/driver/utils/diurnal_cycle.py index 369c5705a..bb366e800 100644 --- a/e3sm_diags/driver/utils/diurnal_cycle.py +++ b/e3sm_diags/driver/utils/diurnal_cycle.py @@ -196,7 +196,7 @@ def fastAllGridFT(x, t): # Converting from complex-valued FFT to real-valued amplitude and phase a = X.real b = X.imag - S = numpy.sqrt(a ** 2 + b ** 2) + S = numpy.sqrt(a**2 + b**2) c = S[0] # Zeroth harmonic = mean-value "constant term" in Fourier series. for n in range(3): # Adding first + last terms, second + second-to-last, ... diff --git a/e3sm_diags/e3sm_diags_driver.py b/e3sm_diags/e3sm_diags_driver.py index 3ecea759e..5c540a28c 100644 --- a/e3sm_diags/e3sm_diags_driver.py +++ b/e3sm_diags/e3sm_diags_driver.py @@ -267,8 +267,7 @@ def run_diag(parameters): mod_str = "e3sm_diags.driver.{}_driver".format(set_name) try: module = importlib.import_module(mod_str) - # FIXME: error: Module has no attribute "run_diag" - single_result = module.run_diag(parameters) # type: ignore + single_result = module.run_diag(parameters) print("") results.append(single_result) except Exception: diff --git a/e3sm_diags/plot/__init__.py b/e3sm_diags/plot/__init__.py index 37b3b09a0..e454008e5 100644 --- a/e3sm_diags/plot/__init__.py +++ b/e3sm_diags/plot/__init__.py @@ -24,8 +24,7 @@ def _get_plot_fcn(backend, set_name): mod_str = "e3sm_diags.plot.{}.{}_plot".format(backend, set_name) module = importlib.import_module(mod_str) - # FIXME: error: Module has no attribute "plot" - return module.plot # type: ignore + return module.plot except ModuleNotFoundError: logger.error( diff --git a/e3sm_diags/plot/cartopy/arm_diags_plot.py b/e3sm_diags/plot/cartopy/arm_diags_plot.py index 4f8db7807..f8dade38a 100644 --- a/e3sm_diags/plot/cartopy/arm_diags_plot.py +++ b/e3sm_diags/plot/cartopy/arm_diags_plot.py @@ -243,7 +243,7 @@ def plot_convection_onset_statistics( ) # low_lim = -6.0 low_lim = -4.0 - ax3.set_ylim(10 ** low_lim, 100) + ax3.set_ylim(10**low_lim, 100) ax3.set_yticks(10 ** np.arange(low_lim, 2, dtype="float64")) ax3.tick_params(labelsize=axes_fontsize) ax3.tick_params(axis="x", pad=xtick_pad) diff --git a/e3sm_diags/plot/cartopy/diurnal_cycle_plot.py b/e3sm_diags/plot/cartopy/diurnal_cycle_plot.py index 1466c3dde..d73e4505e 100644 --- a/e3sm_diags/plot/cartopy/diurnal_cycle_plot.py +++ b/e3sm_diags/plot/cartopy/diurnal_cycle_plot.py @@ -183,7 +183,7 @@ def plot_panel(n, fig, proj, var, amp, amp_ref, title, parameter): ) theta, R = np.meshgrid(np.linspace(0, 2 * np.pi, 24), np.linspace(0, 1, 8)) H, S = np.meshgrid(np.linspace(0, 1, 24), np.linspace(0, 1, 8)) - image = np.dstack(((H - 0.5) % 1, S ** 0.5, np.ones_like(S))) + image = np.dstack(((H - 0.5) % 1, S**0.5, np.ones_like(S))) image = hsv_to_rgb(image) # bar_ax.set_theta_zero_location('N') bar_ax.set_theta_direction(-1) diff --git a/e3sm_diags/plot/cartopy/taylor_diagram.py b/e3sm_diags/plot/cartopy/taylor_diagram.py index 7829ce3e1..6feee0b2b 100644 --- a/e3sm_diags/plot/cartopy/taylor_diagram.py +++ b/e3sm_diags/plot/cartopy/taylor_diagram.py @@ -124,7 +124,7 @@ def add_contours(self, levels=5, **kwargs): np.linspace(self.smin, self.smax), np.linspace(0, np.pi / 2) ) # Compute centered RMS difference - rms = np.sqrt(self.refstd ** 2 + rs ** 2 - 2 * self.refstd * rs * np.cos(ts)) + rms = np.sqrt(self.refstd**2 + rs**2 - 2 * self.refstd * rs * np.cos(ts)) contours = self.ax.contour(ts, rs, rms, levels, **kwargs) diff --git a/setup.cfg b/setup.cfg index 8ec74d2ed..89a0eeba9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ exclude = model_data_preprocess [mypy] -python_version = 3.7 +python_version = 3.9 check_untyped_defs = True ignore_missing_imports = True warn_unused_ignores = True diff --git a/setup.py b/setup.py index d0137508a..1bc288560 100644 --- a/setup.py +++ b/setup.py @@ -116,14 +116,27 @@ def get_all_files_in_dir(directory, pattern): ] setup( + python_requires=">=3.8", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD 3-Clause License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + ], name="e3sm_diags", version="2.6.1", author="Chengzhu (Jill) Zhang, Tom Vo, Ryan Forsyth, Chris Golaz and Zeshawn Shaheen", author_email="zhang40@llnl.gov", description="E3SM Diagnostics", + license="BSD 3-Clause", scripts=["e3sm_diags/e3sm_diags_driver.py"], packages=find_packages(include=["e3sm_diags", "e3sm_diags.*"]), data_files=data_files, + test_suite="tests", entry_points={ "console_scripts": [ "e3sm_diags=e3sm_diags.e3sm_diags_driver:main", diff --git a/tbump.toml b/tbump.toml index 63c8642cc..ebc31d42f 100644 --- a/tbump.toml +++ b/tbump.toml @@ -29,10 +29,7 @@ src = "setup.py" src = "e3sm_diags/__init__.py" [[file]] -src = "conda/meta.yaml" - -[[file]] -src = "conda/e3sm_diags_env.yml" +src = "conda-env/prod.yml" search = "e3sm_diags={current_version}" # You can specify a list of commands to diff --git a/tests/integration/test_diags.py b/tests/integration/test_diags.py index 7f43b666d..47bde7f16 100644 --- a/tests/integration/test_diags.py +++ b/tests/integration/test_diags.py @@ -82,7 +82,7 @@ def compare_images( expected_png = Image.open(path_to_expected_png).convert("RGB") diff = ImageChops.difference(actual_png, expected_png) - diff_dir = "image_check_failures" + diff_dir = f"{TEST_ROOT_PATH}image_check_failures" if not os.path.isdir(diff_dir): os.mkdir(diff_dir)