Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Data Clients #3000

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
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==2024.12.1
shapely==2.0.6
boto3==1.35.88
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.parse()

###################
# 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(16).get_product('ABI-L1b-RadC', band=2)

# Retrieve using xarray + netcdf-c's S3 support
nc = prod.parse()
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

Check notice

Code scanning / CodeQL

'import *' may pollute namespace Note

Import pollutes the enclosing namespace, as the imported module
metpy.remote.aws
does not define '__all__'.
from ..package_tools import set_module

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

set_module(globals())
Loading
Loading