Skip to content

Commit f0c1b91

Browse files
dopplershiftdcamron
authored andcommitted
ENH: Add clients for accessing AWS data
1 parent 3128d27 commit f0c1b91

3 files changed

Lines changed: 654 additions & 0 deletions

File tree

examples/remote/basic.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2023 MetPy Developers.
2+
# Distributed under the terms of the BSD 3-Clause License.
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
"""
5+
==================
6+
Remote Data Access
7+
==================
8+
9+
Use MetPy to access data hosted in known AWS S3 buckets
10+
"""
11+
from datetime import datetime, timedelta
12+
13+
from metpy.remote import GOESArchive, NEXRADLevel2Archive, NEXRADLevel3Archive
14+
15+
###################
16+
# NEXRAD Level 2
17+
18+
# Get the nearest product to a time
19+
prod = NEXRADLevel2Archive().get_product('KTLX', datetime(2013, 5, 22, 21, 53))
20+
21+
# Open using MetPy's Level2File class
22+
l2 = prod.access()
23+
24+
###################
25+
# NEXRAD Level 3
26+
start = datetime(2022, 10, 30, 15)
27+
end = start + timedelta(hours=2)
28+
products = NEXRADLevel3Archive().get_range('FTG', 'N0B', start, end)
29+
30+
# Get all the file names--could also get a file-like object or open with MetPy Level3File
31+
print([prod.name for prod in products])
32+
33+
################
34+
# GOES Archives
35+
prod = GOESArchive(19).get_product('ABI-L1b-RadC', band=2)
36+
37+
# Retrieve using xarray + netcdf-c's S3 support
38+
nc = prod.access()

src/metpy/remote/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2023 MetPy Developers.
2+
# Distributed under the terms of the BSD 3-Clause License.
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
"""Provide tools for accessing data from remote sources.
5+
6+
This currently includes clients for searching and downloading data from public cloud buckets.
7+
"""
8+
9+
from .aws import * # noqa: F403
10+
from ..package_tools import set_module
11+
12+
__all__ = aws.__all__[:] # pylint: disable=undefined-variable
13+
14+
set_module(globals())

0 commit comments

Comments
 (0)