Skip to content

Commit

Permalink
Merge branch 'Unidata:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
winash12 committed Sep 1, 2024
2 parents d58a901 + 24834b1 commit e80d5b5
Show file tree
Hide file tree
Showing 53 changed files with 495 additions and 143 deletions.
18 changes: 18 additions & 0 deletions .codespellexclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
r'^(z|lv_|bottom_top|sigma|h(ei)?ght|altitude|depth|isobaric|pres|isotherm)'
| ``(thta, u, v, dx, dy, dim_order='yx')`` |
Changed signature from ``(thta, u, v, dx, dy, dim_order='yx')``
dpres = gempak.PRES.values
pres = 1
thta = 2
lambda grid: grid if grid.PARM in parameter else False,
col_head.SELV,
'SELV': col_head.SELV,
col_head.SELV,
row_head.SELV,
'SELV': row_head.SELV,
'SELV': col_head.SELV,
# GFS, NAM, RAP, or other gridded dataset (e.g., NARR).
# This attribute can be set to False if the vector components are grid relative (e.g., for NAM
components that are earth-relative. The primary exception is NAM output with wind
col_head.SELV,
row_head.SELV,
20 changes: 1 addition & 19 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
r'^(z|lv_|bottom_top|sigma|h(ei)?ght|altitude|depth|isobaric|pres|isotherm)'
| ``(thta, u, v, dx, dy, dim_order='yx')`` |
Changed signature from ``(thta, u, v, dx, dy, dim_order='yx')``
dpres = gempak.PRES.values
pres = 1
thta = 2
lambda grid: grid if grid.PARM in parameter else False,
col_head.SELV,
'SELV': col_head.SELV,
col_head.SELV,
row_head.SELV,
'SELV': row_head.SELV,
'SELV': col_head.SELV,
Klystron Warmup Integer*2 N/A 0 to 1 1 0=Normal, 1=Preheat 146
# GFS, NAM, RAP, or other gridded dataset (e.g., NARR).
# This attribute can be set to False if the vector components are grid relative (e.g., for NAM
components that are earth-relative. The primary exception is NAM output with wind
col_head.SELV,
row_head.SELV,
trough
2 changes: 0 additions & 2 deletions .github/workflows/docs-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: 3.9
os: Windows
- python-version: '3.10'
os: Windows
- python-version: 3.11
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: ['3.10', 3.11]
check-links: [false]
include:
- python-version: 3.12
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.9, 3.12]
python-version: ['3.10', 3.12]
os: [macOS, Windows]
include:
- python-version: '3.10'
os: macOS
- python-version: 3.11
os: Windows

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11, 3.12]
python-version: ['3.10', 3.11, 3.12]
dep-versions: [Latest]
no-extras: ['']
include:
- python-version: 3.9
- python-version: '3.10'
dep-versions: Minimum
- python-version: 3.9
- python-version: '3.10'
dep-versions: Minimum
no-extras: 'No Extras'
- python-version: 3.12
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on a future ``1.x`` version.
For additional MetPy examples not included in this repository, please see the [Unidata Python
Gallery](https://unidata.github.io/python-gallery/).

We support Python >= 3.9.
We support Python >= 3.10.

Need Help?
----------
Expand Down
8 changes: 4 additions & 4 deletions ci/doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sphinx==7.3.7
pydata-sphinx-theme==0.15.2
sphinx==8.0.2
pydata-sphinx-theme==0.15.4
sphinx-design==0.6.1
sphinx-gallery==0.17.1
myst-parser==3.0.1
myst-parser==4.0.0
netCDF4==1.7.1
geopandas==0.14.4
geopandas==1.0.1
rtree==1.3.0
4 changes: 2 additions & 2 deletions ci/extra_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cartopy==0.23.0
dask==2024.8.0
shapely==2.0.5
dask==2024.8.1
shapely==2.0.6
2 changes: 1 addition & 1 deletion ci/linting_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruff==0.6.1
ruff==0.6.2

flake8==7.1.1
pycodestyle==2.12.1
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
matplotlib==3.9.2
numpy==2.0.1
numpy==2.1.0
pandas==2.2.2
pooch==1.8.2
pint==0.24.3
pyproj==3.6.1
scipy==1.13.1
scipy==1.14.1
traitlets==5.14.3
xarray==2024.7.0
2 changes: 1 addition & 1 deletion docs/_static/theme-unidata.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ html {

.bd-header .navbar-nav>.nav-item>.nav-link,
.bd-header .dropdown-toggle,
.bd-header .fa-solid,
.bd-header .pst-navbar-icon,
.bd-header .btn {
color: #fff !important;
}
Expand Down
16 changes: 8 additions & 8 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Reference Guide
.. autosummary::
:toctree: generated/

metpy.constants
metpy.units
metpy.io
metpy.calc
metpy.plots
metpy.plots.ctables
metpy.interpolate
metpy.xarray
constants
units
io
calc
plots
plots.ctables
interpolate
xarray

.. toctree::
:maxdepth: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/devel/infrastructureguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Versioning
----------

To manage identifying the version of the code, MetPy relies upon `setuptools_scm
<https://github.com/pypa/setuptools_scm>`_. ``setuptools_scm`` takes the current version of the
<https://github.com/pypa/setuptools-scm>`_. ``setuptools_scm`` takes the current version of the
source from git tags and any additional commits. For development, the version will have a
string like ``0.10.0.post209+gff2e549f.d20190918``, which comes from ``git describe``. This
version means that the current code is 209 commits past the 0.10.0 tag, on git hash
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MetPy
=====

MetPy is a collection of tools in Python for reading, visualizing, and performing calculations
with weather data. MetPy supports Python >= 3.9 and is freely available under a permissive
with weather data. MetPy supports Python >= 3.10 and is freely available under a permissive
`open source license <https://github.com/Unidata/MetPy/blob/main/LICENSE>`_.

If you're new to MetPy, check out our :doc:`Getting Started <userguide/startingguide>` guide.
Expand Down
2 changes: 1 addition & 1 deletion docs/userguide/installguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Requirements
------------
In general, MetPy tries to support minor versions of dependencies released within the last two
years. For Python itself, that generally means supporting the last two minor releases; MetPy
currently supports Python >= 3.9.
currently supports Python >= 3.10.

.. literalinclude:: ../../pyproject.toml
:start-at: matplotlib
Expand Down
2 changes: 1 addition & 1 deletion docs/userguide/media.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Talks and Other Media
.. _`2016 AMS Annual Meeting`: https://ams.confex.com/ams/96Annual/webprogram/Paper286983.html
.. _`SSEC/Wisconsin AOS Python Workshop`: https://www.youtube.com/watch?v=RRvJI_vouQc
.. _`SciPy 2016`: https://www.youtube.com/watch?v=moLKGjbXvgE
.. _`Episode 100 of Podcast.__init__`: https://www.pythonpodcast.com/episode-100-metpy-with-ryan-may-sean-arms-and-john-leeman/
.. _`Episode 100 of Podcast.__init__`: https://www.pythonpodcast.com/episodepage/episode-100-metpy-with-ryan-may-sean-arms-and-john-leeman/
.. _`SciPy 2017 talk`: https://www.youtube.com/watch?v=qCo9bkT9sow
.. _`SciPy 2017 poster`: https://github.com/jrleeman/CAPE-SciPy-2017/blob/master/Poster/SciPy_Poster_2017.pdf
.. _`2018 AMS Annual Meeting`: https://ams.confex.com/ams/98Annual/webprogram/Paper333578.html
Expand Down
2 changes: 1 addition & 1 deletion examples/Advanced_Sounding_With_Complex_Layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
# mixed layer parcel properties!
ml_t, ml_td = mpcalc.mixed_layer(p, T, Td, depth=50 * units.hPa)
ml_p, _, _ = mpcalc.mixed_parcel(p, T, Td, depth=50 * units.hPa)
mlcape, mlcin = mpcalc.mixed_layer_cape_cin(p, T, prof, depth=50 * units.hPa)
mlcape, mlcin = mpcalc.mixed_layer_cape_cin(p, T, Td, depth=50 * units.hPa)

# most unstable parcel properties!
mu_p, mu_t, mu_td, _ = mpcalc.most_unstable_parcel(p, T, Td, depth=50 * units.hPa)
Expand Down
1 change: 0 additions & 1 deletion examples/cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@

# Adjust the y-axis to be logarithmic
ax.set_yscale('symlog')
ax.set_yticklabels(np.arange(1000, 50, -100))
ax.set_ylim(cross['isobaric'].max(), cross['isobaric'].min())
ax.set_yticks(np.arange(1000, 50, -100))

Expand Down
3 changes: 2 additions & 1 deletion examples/formats/NEXRAD_Level_2_File.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
fig = plt.figure(figsize=(15, 8))
add_metpy_logo(fig, 190, 85, size='large')

for var_data, var_range, ax_rect in zip((ref, rho), (ref_range, rho_range), spec):
for var_data, var_range, ax_rect in zip((ref, rho), (ref_range, rho_range), spec,
strict=False):
# Turn into an array, then mask
data = np.ma.array(var_data)
data[np.isnan(data)] = np.ma.masked
Expand Down
2 changes: 1 addition & 1 deletion examples/formats/NEXRAD_Level_3_File.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ctables = (('NWSStormClearReflectivity', -20, 0.5), # dBZ
('NWS8bitVel', -100, 1.0)) # m/s

for v, ctable, ax_rect in zip(('N0Q', 'N0U'), ctables, spec):
for v, ctable, ax_rect in zip(('N0Q', 'N0U'), ctables, spec, strict=False):
# Open the file
name = get_test_data(f'nids/KOUN_SDUS54_{v}TLX_201305202016', as_file_obj=False)
f = Level3File(name)
Expand Down
10 changes: 5 additions & 5 deletions examples/gridding/Inverse_Distance_Verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def draw_circle(ax, x, y, r, m, label):
#
# The variable ``indices`` represents the index of each matched coordinate within the
# cKDTree's ``data`` list.
grid_points = np.array(list(zip(sim_gridx, sim_gridy)))
grid_points = np.array(list(zip(sim_gridx, sim_gridy, strict=False)))

radius = 40
obs_tree = cKDTree(list(zip(xp, yp)))
obs_tree = cKDTree(list(zip(xp, yp, strict=False)))
indices = obs_tree.query_ball_point(grid_points, r=radius)

###########################################
Expand All @@ -83,7 +83,7 @@ def draw_circle(ax, x, y, r, m, label):
barnes_dist = dist_2(sim_gridx[1], sim_gridy[1], x2, y2)
barnes_obs = zp[indices[1]]

kappa = calc_kappa(average_spacing(list(zip(xp, yp))))
kappa = calc_kappa(average_spacing(list(zip(xp, yp, strict=False))))

barnes_val = barnes_point(barnes_dist, barnes_obs, kappa)

Expand Down Expand Up @@ -121,7 +121,7 @@ def draw_circle(ax, x, y, r, m, label):
mx, my = obs_tree.data[indices[0]].T
mz = zp[indices[0]]

for x, y, z in zip(mx, my, mz):
for x, y, z in zip(mx, my, mz, strict=False):
d = np.sqrt((sim_gridx[0] - x)**2 + (y - sim_gridy[0])**2)
ax.plot([sim_gridx[0], x], [sim_gridy[0], y], '--')

Expand Down Expand Up @@ -160,7 +160,7 @@ def draw_circle(ax, x, y, r, m, label):
mx, my = obs_tree.data[indices[1]].T
mz = zp[indices[1]]

for x, y, z in zip(mx, my, mz):
for x, y, z in zip(mx, my, mz, strict=False):
d = np.sqrt((sim_gridx[1] - x)**2 + (y - sim_gridy[1])**2)
ax.plot([sim_gridx[1], x], [sim_gridy[1], y], '--')

Expand Down
7 changes: 4 additions & 3 deletions examples/gridding/Natural_Neighbor_Verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
ax.set_title('Triangulation of observations and test grid cell '
'natural neighbor interpolation values')

members, circumcenters = geometry.find_natural_neighbors(tri, list(zip(sim_gridx, sim_gridy)))
members, circumcenters = geometry.find_natural_neighbors(tri, list(zip(sim_gridx, sim_gridy,
strict=False)))

val = natural_neighbor_point(xp, yp, zp, (sim_gridx[0], sim_gridy[0]), tri, members[0],
circumcenters)
Expand Down Expand Up @@ -164,7 +165,7 @@ def draw_circle(ax, x, y, r, m, label):
# spatial data structure that we use here simply to show areal ratios.
# Notice that the two natural neighbor triangle circumcenters are also vertices
# in the Voronoi plot (green dots), and the observations are in the polygons (blue dots).
vort = Voronoi(list(zip(xp, yp)))
vort = Voronoi(list(zip(xp, yp, strict=False)))

fig, ax = plt.subplots(1, 1, figsize=(15, 10))
ax.ishold = lambda: True # Work-around for Matplotlib 3.0.0 incompatibility
Expand All @@ -175,7 +176,7 @@ def draw_circle(ax, x, y, r, m, label):
x_0 = xp[nn_ind]
y_0 = yp[nn_ind]

for x, y, z in zip(x_0, y_0, z_0):
for x, y, z in zip(x_0, y_0, z_0, strict=False):
ax.annotate(f'{x}, {y}: {z:.3f} F', xy=(x, y))

ax.plot(sim_gridx[0], sim_gridy[0], 'k+', markersize=10)
Expand Down
2 changes: 1 addition & 1 deletion examples/plots/Plotting_Surface_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def plot_bulletin(ax, data):
# Handle H/L points using MetPy's StationPlot class
for field in ('HIGH', 'LOW'):
rows = data[data.feature == field]
x, y = zip(*((pt.x, pt.y) for pt in rows.geometry))
x, y = zip(*((pt.x, pt.y) for pt in rows.geometry), strict=False)
sp = StationPlot(ax, x, y, transform=ccrs.PlateCarree(), clip_on=True)
sp.plot_text('C', [field[0]] * len(x), **complete_style[field])
sp.plot_parameter('S', rows.strength, **complete_style[field])
Expand Down
2 changes: 1 addition & 1 deletion examples/plots/US_Counties.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
ax2 = fig.add_subplot(1, 3, 2, projection=proj)
ax3 = fig.add_subplot(1, 3, 3, projection=proj)

for scale, axis in zip(['20m', '5m', '500k'], [ax1, ax2, ax3]):
for scale, axis in zip(['20m', '5m', '500k'], [ax1, ax2, ax3], strict=False):
axis.set_extent([270.25, 270.9, 38.15, 38.75], ccrs.Geodetic())
axis.add_feature(USCOUNTIES.with_scale(scale))
2 changes: 1 addition & 1 deletion examples/plots/nhc_wind_probabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# cities we selected above. Geopandas provides a spatial join method, which merges the two
# GeoDataFrames and can tell us which wind speed probability polygon each of our city points
# lies within. That information is stored in the 'PERCENTAGE' column below.
cities = geopandas.sjoin(cities, wind_data, how='left', op='within')
cities = geopandas.sjoin(cities, wind_data, how='left', predicate='within')
cities

###########################
Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Matplotlib",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -24,17 +23,17 @@ classifiers = [
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License"
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"matplotlib>=3.5.0",
"numpy>=1.20.0",
"numpy>=1.22.0",
"pandas>=1.4.0",
"pint>=0.17",
"pooch>=1.2.0",
"pyproj>=3.0.0",
"pyproj>=3.3.0",
"scipy>=1.8.0",
"traitlets>=5.0.5",
"xarray>=0.21.0"
"traitlets>=5.1.0",
"xarray>=2022.6.0"
]

[project.entry-points."xarray.backends"]
Expand All @@ -57,7 +56,7 @@ examples = [
test = [
"netCDF4",
"packaging>=21.0",
"pytest>=6.2",
"pytest>=7.0",
"pytest-mpl"
]
extras = [
Expand All @@ -77,7 +76,8 @@ extras = [

[tool.codespell]
skip = "*.tbl,*.ipynb,AUTHORS.txt,gempak.rst,.git,./staticdata,./docs/build,*.pdf,./talks"
exclude-file = ".codespellignore"
exclude-file = ".codespellexclude"
ignore-words = ".codespellignore"

[tool.doc8]
ignore-path = ["docs/build", "docs/api/generated", "docs/_templates", "docs/tutorials",
Expand Down Expand Up @@ -116,6 +116,8 @@ filterwarnings = [
"ignore:Conversion of an array with ndim > 0 to a scalar is deprecated:DeprecationWarning:pyproj.geod:404",
# Pandas >=2.2 warns about PyArrow being a future dependency
'ignore:\nPyarrow will become a required dependency of pandas:DeprecationWarning',
# Not yet fixed in xarray
"ignore:__array__ implementation doesn't accept a copy keyword:DeprecationWarning"
]

[tool.ruff]
Expand Down
2 changes: 1 addition & 1 deletion src/metpy/calc/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ def zoom_xarray(input_field, zoom, output=None, order=3, mode='constant', cval=0
if not np.iterable(zoom):
zoom = tuple(zoom for _ in input_field.dims)
zoomed_dim_coords = {}
for dim_name, dim_zoom in zip(input_field.dims, zoom):
for dim_name, dim_zoom in zip(input_field.dims, zoom, strict=False):
if dim_name in input_field.coords:
zoomed_dim_coords[dim_name] = scipy_zoom(
input_field[dim_name].data, dim_zoom, order=order, mode=mode, cval=cval,
Expand Down
Loading

0 comments on commit e80d5b5

Please sign in to comment.