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 authored Aug 24, 2024
2 parents 78b8a2c + d00544a commit d58a901
Show file tree
Hide file tree
Showing 43 changed files with 122 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:

- name: Install dependencies
shell: bash -l {0}
run: micromamba install --quiet --yes --file ci/${{ inputs.type }}_requirements.txt --file ci/extra_requirements.txt --file ci/requirements.txt
run: micromamba install --yes --file ci/${{ inputs.type }}_requirements.txt --file ci/extra_requirements.txt --file ci/requirements.txt

- name: Download Cartopy Maps
shell: bash -l {0}
Expand Down
17 changes: 4 additions & 13 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ concurrency:
cancel-in-progress: true

jobs:
flake8:
name: Flake8
lint:
name: Run Lint Tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -27,19 +27,10 @@ jobs:
run: python -m pip install -r ci/linting_requirements.txt

- name: Set up reviewdog
run: |
mkdir -p $HOME/bin
curl -sfL \
https://github.com/reviewdog/reviewdog/raw/master/install.sh | \
sh -s -- -b $HOME/bin
echo "$HOME/bin" >> $GITHUB_PATH
uses: reviewdog/action-setup@v1

- name: Run ruff
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
ruff check . | reviewdog -f=pep8 -name=ruff -reporter=github-check -filter-mode=nofilter
run: ruff check --output-format github

- name: Run flake8
env:
Expand Down
4 changes: 2 additions & 2 deletions ci/doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sphinx==7.3.7
pydata-sphinx-theme==0.15.2
sphinx-design==0.6.0
sphinx-gallery==0.16.0
sphinx-design==0.6.1
sphinx-gallery==0.17.1
myst-parser==3.0.1
netCDF4==1.7.1
geopandas==0.14.4
Expand Down
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.22.0
dask==2024.7.0
cartopy==0.23.0
dask==2024.8.0
shapely==2.0.5
6 changes: 3 additions & 3 deletions ci/linting_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ruff==0.5.2
ruff==0.6.1

flake8==7.1.0
pycodestyle==2.12.0
flake8==7.1.1
pycodestyle==2.12.1
pyflakes==3.2.0

flake8-continuation==1.0.5
Expand Down
6 changes: 3 additions & 3 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
matplotlib==3.9.1
numpy==1.26.4
matplotlib==3.9.2
numpy==2.0.1
pandas==2.2.2
pooch==1.8.2
pint==0.24.3
pyproj==3.6.1
scipy==1.13.1
traitlets==5.14.3
xarray==2024.6.0
xarray==2024.7.0
4 changes: 2 additions & 2 deletions ci/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packaging==24.1
pytest==8.2.2
pytest==8.3.2
pytest-mpl==0.17.0
netCDF4==1.7.1
coverage==7.5.3
coverage==7.6.1
2 changes: 1 addition & 1 deletion examples/meteogram_metpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def plot_pressure(self, p, plot_range=None):

# Parse dates from .csv file, knowing their format as a string and convert to datetime
def parse_date(date):
return dt.datetime.strptime(date.decode('ascii'), '%Y-%m-%d %H:%M:%S')
return dt.datetime.strptime(date, '%Y-%m-%d %H:%M:%S')


testdata = np.genfromtxt(get_test_data('timeseries.csv', False), names=True, dtype=None,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ filterwarnings = [

[tool.ruff]
line-length = 95
exclude = ["docs", "build", "src/metpy/io/_metar_parser/metar_parser.py"]
exclude = ["docs", "build", "src/metpy/io/_metar_parser/metar_parser.py", "talks"]
preview = true

[tool.ruff.lint]
Expand Down
2 changes: 1 addition & 1 deletion src/metpy/calc/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ def most_unstable_parcel(pressure, temperature, dewpoint, height=None, bottom=No
>>> # find most unstable parcel of depth 50 hPa
>>> most_unstable_parcel(p, T, Td, depth=50*units.hPa)
(<Quantity(1008.0, 'hectopascal')>, <Quantity(29.3, 'degree_Celsius')>,
<Quantity(26.5176931, 'degree_Celsius')>, 0)
<Quantity(26.5176931, 'degree_Celsius')>, np.int64(0))
See Also
--------
Expand Down
4 changes: 3 additions & 1 deletion src/metpy/plots/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,9 @@ def _build(self):
# If we're on a map, we use min/max for y and manually figure out origin to try to
# avoid upside down images created by images where y[0] > y[-1], as well as
# specifying the transform
kwargs['extent'] = (x_like[0], x_like[-1], y_like.min(), y_like.max())
# TODO item() shouldn't be necessary, but is until pydata/xarray#9043 is fixed.
kwargs['extent'] = (x_like[0].item(), x_like[-1].item(),
y_like.min().item(), y_like.max().item())
kwargs['origin'] = 'upper' if y_like[0] > y_like[-1] else 'lower'
kwargs.setdefault('cmap', self._cmap_obj)
kwargs.setdefault('norm', self._norm_obj)
Expand Down
9 changes: 7 additions & 2 deletions src/metpy/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
import contextlib
import functools
from importlib.metadata import requires, version
from importlib.metadata import PackageNotFoundError, requires, version
import operator as op
import re

Expand Down Expand Up @@ -55,7 +55,12 @@ def version_check(version_spec):
metadata_spec = _get_metadata_spec(module_name)
_, _, minimum_version_number = _parse_version_spec(metadata_spec)

installed_version = Version(version(module_name))
try:
installed_version = Version(version(module_name))
except PackageNotFoundError:
# Package not installed considered false condition for spec
return False

specified_version = Version(version_number)
minimum_version = Version(minimum_version_number)

Expand Down
Binary file modified tests/plots/baseline/test_au_plotting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_colorfill_no_colorbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_colorfill_with_image_range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_barb_gfs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_barb_gfs_knots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_colorbar_fontsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_contour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_contour_convert_units.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_contour_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_figsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_gridded_scale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_layers_plot_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_region_modifier_zoom_out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs_args.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs_change_units.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_smooth_contour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_smooth_contour_order.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_smooth_field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_us_states_scales.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_uslcc_plotting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion tests/plots/test_cartopy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

import metpy.plots as mpplots
from metpy.testing import version_check


@pytest.mark.mpl_image_compare(tolerance=0.053, remove_text=True)
Expand Down Expand Up @@ -48,7 +49,8 @@ def test_us_states_defaults(ccrs):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.092, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0.248 if version_check('cartopy<0.23') else 0.,
remove_text=True)
def test_us_states_scales(ccrs):
"""Test the default US States plotting with all scales."""
proj = ccrs.LambertConformal(central_longitude=-85.0, central_latitude=45.0)
Expand Down
Loading

0 comments on commit d58a901

Please sign in to comment.