Skip to content

Commit

Permalink
ENH: Add clients for accessing AWS data
Browse files Browse the repository at this point in the history
  • Loading branch information
dopplershift committed Jan 10, 2025
1 parent d9bcf95 commit 88329d3
Show file tree
Hide file tree
Showing 3 changed files with 646 additions and 0 deletions.
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 NEXRADLevel2Archive, NEXRADLevel3Archive, GOESArchive

###################
# 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()
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

0 comments on commit 88329d3

Please sign in to comment.