Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docs-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- python-version: 3.11
os: macOS
- python-version: 3.12
os: Windows
- python-version: 3.13
os: macOS

steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', 3.11]
python-version: ['3.10', 3.11, 3.12]
check-links: [false]
include:
- python-version: 3.12
- python-version: 3.13
check-links: true
outputs:
doc-version: ${{ steps.build-docs.outputs.doc-version }}
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Download doc build
uses: actions/download-artifact@v4
with:
name: Linux-3.11-docs
name: Linux-3.13-docs
path: ./docs/build/html

# This overrides the version "dev" with the proper version if we're building off a
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', 3.12]
python-version: ['3.10', 3.13]
os: [macOS, Windows]
include:
- python-version: 3.11
os: Windows
- python-version: 3.12
os: macOS

steps:
- name: Checkout source
Expand Down
4 changes: 2 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.10', 3.11, 3.12]
python-version: ['3.10', 3.11, 3.12, 3.13]
dep-versions: [Latest]
no-extras: ['']
include:
Expand All @@ -34,7 +34,7 @@ jobs:
- python-version: '3.10'
dep-versions: Minimum
no-extras: 'No Extras'
- python-version: 3.12
- python-version: 3.13
dep-versions: Latest
no-extras: 'No Extras'

Expand Down
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.12
python-version: 3.13

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

- name: Build docs
id: build
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ matplotlib==3.9.2
numpy==2.1.3
pandas==2.2.3
pooch==1.8.2
pint==0.24.3
pint==0.24.4
pyproj==3.7.0
scipy==1.14.1
traitlets==5.14.3
Expand Down
19 changes: 11 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,15 @@ def linkcode_resolve(domain, info):
else:
linespec = ""

fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__))

if "+" in metpy.__version__:
return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}"
if 'metpy' in fn:
fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__))

if "+" in metpy.__version__:
return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}"
else:
return (
f"https://github.com/Unidata/MetPy/blob/"
f"v{metpy.__version__}/src/metpy/{fn}{linespec}"
)
else:
return (
f"https://github.com/Unidata/MetPy/blob/"
f"v{metpy.__version__}/src/metpy/{fn}{linespec}"
)
return None
1 change: 1 addition & 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.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Intended Audience :: Science/Research",
Expand Down
40 changes: 22 additions & 18 deletions src/metpy/calc/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import functools
from inspect import Parameter, signature
from operator import itemgetter
import textwrap

import numpy as np

Expand Down Expand Up @@ -982,32 +983,35 @@ def wrapper(f, **kwargs):

def _add_grid_params_to_docstring(docstring: str, orig_includes: dict) -> str:
"""Add documentation for some dynamically added grid parameters to the docstring."""
other_params = docstring.find('Other Parameters')
blank = docstring.find('\n\n', other_params)
other_params = 'Other Parameters'
other_ind = docstring.find(other_params)
indent = docstring.find('-', other_ind) - other_ind - len(other_params) - 1 # -1 for \n
blank = docstring.find('\n\n', other_ind)

entries = {
'longitude': """
longitude : `pint.Quantity`, optional
Longitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates
used as input. Also optional if parallel_scale and meridional_scale are given. If
otherwise omitted, calculation will be carried out on a Cartesian, rather than
geospatial, grid. Keyword-only argument.""",
longitude : `pint.Quantity`, optional
Longitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates
used as input. Also optional if parallel_scale and meridional_scale are given. If
otherwise omitted, calculation will be carried out on a Cartesian, rather than
geospatial, grid. Keyword-only argument.""",
'latitude': """
latitude : `pint.Quantity`, optional
Latitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates
used as input. Also optional if parallel_scale and meridional_scale are given. If
otherwise omitted, calculation will be carried out on a Cartesian, rather than
geospatial, grid. Keyword-only argument.""",
latitude : `pint.Quantity`, optional
Latitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates
used as input. Also optional if parallel_scale and meridional_scale are given. If
otherwise omitted, calculation will be carried out on a Cartesian, rather than
geospatial, grid. Keyword-only argument.""",
'crs': """
crs : `pyproj.crs.CRS`, optional
Coordinate Reference System of data. Optional if `xarray.DataArray` with MetPy CRS
used as input. Also optional if parallel_scale and meridional_scale are given. If
otherwise omitted, calculation will be carried out on a Cartesian, rather than
geospatial, grid. Keyword-only argument."""
crs : `pyproj.crs.CRS`, optional
Coordinate Reference System of data. Optional if `xarray.DataArray` with MetPy CRS
used as input. Also optional if parallel_scale and meridional_scale are given. If
otherwise omitted, calculation will be carried out on a Cartesian, rather than
geospatial, grid. Keyword-only argument."""
}

return ''.join([docstring[:blank],
*(entries[p] for p, included in orig_includes.items() if not included),
*(textwrap.indent(entries[p], ' ' * indent)
for p, included in orig_includes.items() if not included),
docstring[blank:]])


Expand Down