Skip to content

Commit

Permalink
DOC: Add basic example showing some of the client usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dopplershift committed Apr 7, 2023
1 parent 862f83f commit d9e4261
Showing 1 changed file with 38 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, 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()

0 comments on commit d9e4261

Please sign in to comment.