Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/unidata/metpy into corfidi
Browse files Browse the repository at this point in the history
  • Loading branch information
wx4stg committed Nov 14, 2023
2 parents 382d1da + eaa93e7 commit 5823f9f
Show file tree
Hide file tree
Showing 37 changed files with 655 additions and 160 deletions.
11 changes: 8 additions & 3 deletions .github/actions/install-pypi/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
python-version:
description: 'What version of Python to use'
required: true
old-build:
description: 'Whether to enable old builds for shapely and cartopy'
required: false
default: 'false'

runs:
using: composite
Expand All @@ -30,13 +34,13 @@ runs:
ci/extra_requirements.txt
# This installs the stuff needed to build and install Shapely and CartoPy from source.
- name: Install CartoPy build dependencies
if: ${{ inputs.need-extras == 'true' }}
- name: Install CartoPy/Shapely build dependencies
if: ${{ inputs.old-build == 'true' }}
shell: bash
run: sudo apt-get install libgeos-dev

- name: Disable Shapely Wheels
if: ${{ inputs.need-extras == 'true' }}
if: ${{ inputs.old-build == 'true' }}
shell: bash
run: echo "PIP_NO_BINARY=shapely" >> $GITHUB_ENV

Expand All @@ -57,6 +61,7 @@ runs:
-c ci/${{ inputs.version-file }} -c ci/${{ inputs.type }}_requirements.txt -c ci/extra_requirements.txt
- name: Install additional test tools
if: ${{ inputs.type == 'test' }}
shell: bash
run: >
python -m pip install coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/assign-milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Assign Latest Milestone
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
name: Run script
with:
script: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backport-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
labels: backport

- name: Comment on completion
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Comment on error
if: failure()
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const workflow_url = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
os: Windows
- python-version: 3.11
os: macOS
- python-version: 3.12
os: macOS

steps:
- name: Checkout source
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,16 @@ jobs:
# Build our docs on Linux against multiple Pythons
#
Docs:
name: ${{ matrix.python-version }} ${{ matrix.dep-versions }}
name: "Linux ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11]
check-links: [false]
include:
- python-version: 3.9
check-links: false
dep-versions: requirements.txt
- python-version: '3.10'
check-links: false
dep-versions: requirements.txt
- python-version: 3.11
- python-version: 3.12
check-links: true
dep-versions: requirements.txt
outputs:
doc-version: ${{ steps.build-docs.outputs.doc-version }}

Expand All @@ -52,6 +47,7 @@ jobs:
with:
type: 'doc'
python-version: ${{ matrix.python-version }}
need-extras: true

- name: Build docs
id: build-docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
ruff check . | reviewdog -f=pep8 -name=flake8 -reporter=github-check -filter-mode=nofilter
ruff check . | reviewdog -f=pep8 -name=ruff -reporter=github-check -filter-mode=nofilter
- name: Run flake8
env:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nightly-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ on:
- main
paths:
- .github/workflows/nightly-builds.yml
- .github/workflows/unstable-builds.yml
pull_request:
paths:
- .github/workflows/nightly-builds.yml
- .github/workflows/unstable-builds.yml

jobs:
Builds:
Expand All @@ -42,7 +44,7 @@ jobs:
touch tests-nightly.log build.log linkchecker.log
- name: Report failures
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: [3.9, 3.12]
os: [macOS, Windows]
include:
- python-version: '3.10'
os: macOS
- python-version: 3.11
os: Windows

steps:
- name: Checkout source
Expand Down Expand Up @@ -66,3 +71,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
7 changes: 5 additions & 2 deletions .github/workflows/tests-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: [3.9, '3.10', 3.11, 3.12]
dep-versions: [Latest]
no-extras: ['']
include:
Expand All @@ -34,7 +34,8 @@ jobs:
- python-version: 3.9
dep-versions: Minimum
no-extras: 'No Extras'
- python-version: 3.11
- python-version: 3.12
dep-versions: Latest
no-extras: 'No Extras'

steps:
Expand Down Expand Up @@ -71,6 +72,7 @@ jobs:
need-extras: ${{ matrix.no-extras != 'No Extras' }}
type: 'test'
python-version: ${{ matrix.python-version }}
old-build: ${{ matrix.no-extras != 'No Extras' && matrix.dep-versions == 'Minimum' }}

- name: Run tests
uses: ./.github/actions/run-tests
Expand All @@ -94,3 +96,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
4 changes: 2 additions & 2 deletions .github/workflows/unstable-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
need-extras: true
type: test
version-file: Prerelease
python-version: 3.11
python-version: 3.12

- name: Run tests
id: tests
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
with:
type: doc
version-file: Prerelease
python-version: 3.11
python-version: 3.12

- name: Build docs
id: build
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ While the authors are no fans of blind adherence to style and so-called project
that go through and correct code style, MetPy has adopted this style from the outset.
Therefore, it makes sense to enforce this style as code is added to keep everything clean and
uniform. To this end, part of the automated testing for MetPy checks style. To check style
locally within the source directory you can use the [ruff](https://beta.ruff.rs/docs/) and
locally within the source directory you can use the [ruff](https://docs.astral.sh/ruff/) and
[flake8](https://flake8.pycqa.org/en/latest/) tools.
After setting up your [development environment](#setting-up-your-development-environment) above,
from within the ``metpy`` directory with your ``devel`` environment active,
Expand Down
2 changes: 1 addition & 1 deletion ci/doc_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ sphinx-design==0.5.0
sphinx-gallery==0.14.0
myst-parser==2.0.0
netCDF4==1.6.5
geopandas==0.14.0
geopandas==0.14.1
rtree==1.1.0
2 changes: 1 addition & 1 deletion ci/extra_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cartopy==0.22.0
dask==2023.10.1
dask==2023.11.0
shapely==2.0.2
6 changes: 3 additions & 3 deletions ci/linting_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
ruff==0.1.3
ruff==0.1.5

flake8==6.1.0
pycodestyle==2.11.1
pyflakes==3.1.0

flake8-continuation==1.0.5
flake8-copyright==0.2.4
flake8-isort==6.1.0
flake8-isort==6.1.1
isort==5.12.0
flake8-requirements==1.7.8
flake8-requirements==2.0.1

flake8-rst-docstrings==0.3.0

Expand Down
4 changes: 2 additions & 2 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
matplotlib==3.8.0
matplotlib==3.8.1
numpy==1.26.0
pandas==2.1.2
pandas==2.1.3
pooch==1.8.0
pint==0.22
pyproj==3.6.1
Expand Down
1 change: 1 addition & 0 deletions docs/_templates/overrides/metpy.calc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Soundings
ccl
critical_angle
cross_totals
downdraft_cape
el
k_index
lcl
Expand Down
11 changes: 6 additions & 5 deletions docs/api/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ References
Parameters in Forecasting Severe Storms <https://ejssm.org/archives/2006/vol-1-3-2006/>`_.
*Electronic J. Severe Storms Meteor.*, **1** (3), 1-22.
.. [Emanuel1994] Emanuel, K. A., 1994: Atmospheric Convection. Oxford University Press, 592 pp.
.. [Esterheld2008] Esterheld, J. M. and D. J. Giuliano, 2008: `Discriminating between Tornadic and
Non-Tornadic Supercells: A New Hodograph Technique <https://ejssm.org/archives/2008/vol-3-2-2008/>`_.
*Electronic J. Severe Storms Meteor.*, **3** (2), 1-50.
Expand Down Expand Up @@ -204,11 +206,10 @@ References
.. [WMO8] WMO, 2020: Guide to Meteorological Instruments and Methods of Observation,
Volume 1: Measurement of Meteorological Variables.
`WMO No.8 <https://library.wmo.int/index.php?lvl=notice_display&id=12407>`_.
`WMO No.8 <https://library.wmo.int/idurl/4/41650>`_.
.. [WMO306] WMO, 2011: Manual on Codes - International Codes, Volume I.1, Annex II to the WMO
Technical Regulations: Part A - Alphanumeric Codes. `WMO No.306
<https://library.wmo.int/index.php?lvl=notice_display&id=13617>`_.
Technical Regulations: Part A - Alphanumeric Codes. `WMO No.306 <https://library.wmo.int/idurl/4/35713>`_.
.. [WMO1966] WMO, 1966: International Meteorological Tables, `WMO-No. 188.TP.94
<https://library.wmo.int/doc_num.php?explnum_id=7997>`_.
.. [WMO1966] WMO, 1966: International Meteorological Tables,
`WMO-No. 188.TP.94 <https://library.wmo.int/idurl/4/59923>`_.
12 changes: 8 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
'reset_modules': [lambda conf, fname: sys.modules.pop('pint', None)]
}

# By default, only generate all the areas when running in CI
metpy_generate_all_areas = 'GITHUB_ACTIONS' in os.environ
# By default, only generate all the areas when running on a release CI job
metpy_generate_all_areas = (not os.environ.get('GITHUB_REF', '').startswith('refs/pull')
and sys.version_info < (3, 12))

# Turn off code and image links for embedded mpl plots
plot_html_show_source_link = False
Expand Down Expand Up @@ -431,7 +432,9 @@
r'https://doi\.org/10\.1289/ehp\.1206273',
# Couldn't fix these 403's with user agents
r'https://doi\.org/10\.1029/2010GL045777',
r'https://doi\.org/10\.1098/rspa\.2004\.1430'
r'https://doi\.org/10\.1098/rspa\.2004\.1430',
# Currently giving certificate errors on GitHub
r'https://library.wmo.int/.*'
]

# Dictionary of URL redirects allowed
Expand All @@ -440,7 +443,8 @@
r'https://conda.io/docs/': r'https://conda.io/en/latest/',
r'https://github.com/Unidata/MetPy/issues/new/choose': r'https://github.com/login.*choose',
r'https://doi.org/.*': r'https://.*',
r'https://gitter.im/Unidata/MetPy': r'https://app.gitter.im/.*MetPy.*'
r'https://gitter.im/Unidata/MetPy': r'https://app.gitter.im/.*MetPy.*',
r'https://library.wmo.int/idurl/.*': r'https://library.wmo.int/.*'
}

# Domain-specific HTTP headers for requests
Expand Down
2 changes: 2 additions & 0 deletions docs/make_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def generate_area_file(app):
if area in states_provinces:
code = textwrap.dedent(f"""
.. plot::
:context: reset
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
Expand All @@ -75,6 +76,7 @@ def generate_area_file(app):
else:
code = textwrap.dedent(f"""
.. plot::
:context: reset
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Intended Audience :: Science/Research",
Expand Down Expand Up @@ -101,12 +102,15 @@ markers = "xfail_dask: marks tests as expected to fail with Dask arrays"
norecursedirs = "build docs .idea"
doctest_optionflags = "NORMALIZE_WHITESPACE"
mpl-results-path = "test_output"
xfail_strict = true

[tool.ruff]
line-length = 95
exclude = ["docs", "build", "src/metpy/io/_metar_parser/metar_parser.py"]
select = ["A", "B", "C", "D", "E", "E226", "F", "G", "I", "N", "Q", "R", "S", "T", "U", "W"]
ignore = ["F405", "I001", "RET504", "RET505", "RET506", "RET507", "RUF100"]
preview = true
explicit-preview-rules = true

[tool.ruff.per-file-ignores]
"ci/filter_links.py" = ["E731", "T201", "S603", "S607"]
Expand Down
Loading

0 comments on commit 5823f9f

Please sign in to comment.