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
1 change: 1 addition & 0 deletions .codespellexclude
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
components that are earth-relative. The primary exception is NAM output with wind
col_head.SELV,
row_head.SELV,
by the archive (currently FOUR, PANG, GRAP, AURO), or the known names (
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ staticdata/*.tbl text eol=lf
*.ipynb diff=jupyternotebook
talks/* linguist-documentation
src/metpy/io/_metar_parser/metar_parser.py linguist-generated=true
src/metpy/_vendor/* linguist-vendored
src/metpy/_vendor/* linguist-vendored

# Mark the vcrpy cassettes as generated
tests/remote/fixtures/* linguist-generated=true
3 changes: 3 additions & 0 deletions .github/workflows/tests-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
# Only needed while we support numpy 1.20
if fname == 'requirements.txt':
out.write('pillow!=10.4.0\n')
# Needed until minium vcrpy is >=7.0.0 for urllib3>=2.3
elif fname == 'requirements.txt':
out.write('urllib3==2.2.3\n')
EOF

- name: Install from PyPI
Expand Down
1 change: 1 addition & 0 deletions ci/extra_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cartopy==0.24.0
dask==2025.2.0
shapely==2.0.7
boto3==1.35.88
1 change: 1 addition & 0 deletions ci/test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pytest==8.3.5
pytest-mpl==0.17.0
netCDF4==1.7.2
coverage==7.8.0
vcrpy==7.0.0
38 changes: 38 additions & 0 deletions examples/remote/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2023 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
==================
Remote Data Access
==================

Use MetPy to access data hosted in known AWS S3 buckets
"""
from datetime import datetime, timedelta

from metpy.remote import GOESArchive, NEXRADLevel2Archive, NEXRADLevel3Archive

###################
# NEXRAD Level 2

# Get the nearest product to a time
prod = NEXRADLevel2Archive().get_product('KTLX', datetime(2013, 5, 22, 21, 53))

# Open using MetPy's Level2File class
l2 = prod.access()

###################
# NEXRAD Level 3
start = datetime(2022, 10, 30, 15)
end = start + timedelta(hours=2)
products = NEXRADLevel3Archive().get_range('FTG', 'N0B', start, end)

# Get all the file names--could also get a file-like object or open with MetPy Level3File
print([prod.name for prod in products])

################
# GOES Archives
prod = GOESArchive(19).get_product('ABI-L1b-RadC', band=2)

# Retrieve using xarray + netcdf-c's S3 support
nc = prod.access()
43 changes: 43 additions & 0 deletions examples/remote/ml_forecast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) 2025 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
=========================================
ML Weather Prediction Access and Plotting
=========================================

Use MetPy to access machine learning weather prediction (MLWP) data in AWS S3 and plot using
the simplified plotting interface.
"""
from datetime import datetime

from metpy.plots import MapPanel, PanelContainer, RasterPlot
from metpy.remote import MLWPArchive

###################
# Access the GraphCast forecast closest to the desired date/time
dt = datetime(2025, 2, 15, 18)
ds = MLWPArchive().get_product('graphcast', dt).access()

###################
# Plot the data using MetPy's simplified plotting interface.
raster = RasterPlot()
raster.data = ds
raster.field = 't2'
raster.time = dt
raster.colorbar = 'horizontal'
raster.colormap = 'RdBu_r'

panel = MapPanel()
panel.area = 'co'
panel.projection = 'lcc'
panel.layers = ['coastline', 'borders', 'states']
panel.plots = [raster]
panel.title = f"{ds[raster.field].attrs['long_name']} @ {dt}"

pc = PanelContainer()
pc.size = (8, 8)
pc.panels = [panel]
pc.draw()

pc.show()
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ test = [
"netCDF4",
"packaging>=21.0",
"pytest>=7.0",
"pytest-mpl"
"pytest-mpl",
"vcrpy>=4.3.1"
]
extras = [
"cartopy>=0.21.0",
"dask>=2020.12.0",
"shapely>=1.6.4"
"shapely>=1.6.4",
"boto3>=1.26.45"
]

[project.urls]
Expand All @@ -77,7 +79,7 @@ extras = [
"MetPy Mondays" = "https://www.youtube.com/playlist?list=PLQut5OXpV-0ir4IdllSt1iEZKTwFBa7kO"

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

Expand Down
14 changes: 14 additions & 0 deletions src/metpy/remote/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2023 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Provide tools for accessing data from remote sources.

This currently includes clients for searching and downloading data from public cloud buckets.
"""

from .aws import * # noqa: F403
from ..package_tools import set_module

__all__ = aws.__all__[:] # pylint: disable=undefined-variable

set_module(globals())
Loading