-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOC: Add basic example showing some of the client usage
- Loading branch information
1 parent
862f83f
commit d9e4261
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, GOES16Archive, GOES18Archive | ||
|
||
################### | ||
# 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 = GOES16Archive().get_product('ABI-L1b-RadC', datetime.utcnow(), channel=2) | ||
|
||
# Retrieve using xarray + netcdf-c's S3 support | ||
nc = prod.parse() |