### Install nexradaws with pip Source: https://github.com/aarande/nexradaws/blob/master/README.md Install the base package or include optional pyart support using the [pyart] extra. ```bash pip install nexradaws pip install nexradaws[pyart] - to install with pyart support ``` -------------------------------- ### Install nexradaws with pip Source: https://github.com/aarande/nexradaws/blob/master/docs/source/index.rst Install the nexradaws module using pip. This is the standard installation command for the package. ```default pip install nexradaws ``` -------------------------------- ### Import dependencies and create temp directory Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Sets up the notebook environment for the nexradaws examples: enables inline matplotlib plots, imports plotting, tempfile, pytz, datetime, and pyart, and creates a temporary directory for downloads. ```python %matplotlib inline import matplotlib.pyplot as plt import tempfile import pytz from datetime import datetime import pyart templocation = tempfile.mkdtemp() ``` -------------------------------- ### Get all scans for a radar on a given day with get_avail_scans() Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Query all NEXRAD scans for a radar on a specific day using get_avail_scans(). Returns a list of AwsNexradFile objects. The example shows the KTLX radar on May 31, 2013, yielding 263 files. ```python availscans = conn.get_avail_scans('2013', '05', '31', 'KTLX') print("There are {} NEXRAD files available for May 31st, 2013 for the KTLX radar.\n".format(len(availscans))) print(availscans[0:4]) ``` ```text Output: There are 263 NEXRAD files available for May 31st, 2013 for the KTLX radar. [, , , ] ``` -------------------------------- ### Get available days with get_avail_days Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Queries the available days for a given year and month (2013-05) and prints the list. The output shows all 31 days as zero-padded strings. ```python days = conn.get_avail_days('2013','05') print(days) ``` ```text Output: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'] ``` -------------------------------- ### Get available months with get_avail_months Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Queries the available months for a given year (2013) and prints the list. The output shows all twelve months as zero-padded strings. ```python months = conn.get_avail_months('2013') print(months) ``` ```text Output: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] ``` -------------------------------- ### Get available radars with get_avail_radars Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Queries the available radars for a given year, month, and day (2013-05-31) and prints the list. The output includes radar identifiers such as KABR, KABX, and TJUA. ```python radars = conn.get_avail_radars('2013','05','31') print(radars) ``` ```text Output: ['DAN1', 'KABR', 'KABX', 'KAKQ', 'KAMA', 'KAMX', 'KAPX', 'KARX', 'KATX', 'KBBX', 'KBGM', 'KBHX', 'KBIS', 'KBLX', 'KBMX', 'KBOX', 'KBRO', 'KBUF', 'KBYX', 'KCAE', 'KCBW', 'KCBX', 'KCCX', 'KCLE', 'KCLX', 'KCRP', 'KCXX', 'KCYS', 'KDAX', 'KDDC', 'KDFX', 'KDGX', 'KDLH', 'KDMX', 'KDOX', 'KDTX', 'KDVN', 'KEAX', 'KEMX', 'KENX', 'KEOX', 'KEPZ', 'KESX', 'KEVX', 'KEWX', 'KEYX', 'KFCX', 'KFDR', 'KFFC', 'KFSD', 'KFSX', 'KFTG', 'KFWS', 'KGGW', 'KGJX', 'KGLD', 'KGRB', 'KGRK', 'KGRR', 'KGSP', 'KGWX', 'KGYX', 'KHDX', 'KHGX', 'KHNX', 'KHPX', 'KHTX', 'KICT', 'KICX', 'KILN', 'KILX', 'KIND', 'KINX', 'KIWA', 'KIWX', 'KJAX', 'KJGX', 'KJKL', 'KLBB', 'KLCH', 'KLGX', 'KLIX', 'KLNX', 'KLOT', 'KLRX', 'KLSX', 'KLTX', 'KLVX', 'KLWX', 'KLZK', 'KMAF', 'KMAX', 'KMBX', 'KMHX', 'KMKX', 'KMLB', 'KMOB', 'KMPX', 'KMQT', 'KMRX', 'KMSX', 'KMTX', 'KMUX', 'KMVX', 'KMXX', 'KNKX', 'KNQA', 'KOAX', 'KOHX', 'KOKX', 'KOTX', 'KPAH', 'KPBZ', 'KPDT', 'KPOE', 'KPUX', 'KRAX', 'KRGX', 'KRIW', 'KRLX', 'KRTX', 'KSFX', 'KSGF', 'KSHV', 'KSJT', 'KSOX', 'KSRX', 'KTBW', 'KTFX', 'KTLH', 'KTLX', 'KTWX', 'KTYX', 'KUDX', 'KUEX', 'KVNX', 'KVTX', 'KVWX', 'KYUX', 'PHKI', 'PHKM', 'PHMO', 'PHWA', 'TJUA'] ``` -------------------------------- ### Get scans in a time range with get_avail_scans_in_range() Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Query NEXRAD scans between a start and end time using get_avail_scans_in_range(). Accepts datetime objects; timezone-aware datetimes are converted to UTC, naive ones are assumed UTC. Example queries 5-7pm CST on May 31, 2013 for KTLX, returning 26 scans. ```python central_timezone = pytz.timezone('US/Central') radar_id = 'KTLX' start = central_timezone.localize(datetime(2013,5,31,17,0)) end = central_timezone.localize (datetime(2013,5,31,19,0)) scans = conn.get_avail_scans_in_range(start, end, radar_id) print("There are {} scans available between {} and {}\n".format(len(scans), start, end)) print(scans[0:4]) ``` ```text Output: There are 26 scans available between 2013-05-31 17:00:00-05:00 and 2013-05-31 19:00:00-05:00 [, , , ] ``` -------------------------------- ### Print failed download count with failed_count Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Prints the number of failed downloads using the failed_count attribute. The output shows zero failed downloads for this example. ```python print("{} downloads failed.".format(results.failed_count)) ``` ```text 0 downloads failed. ``` -------------------------------- ### Get available years with get_avail_years Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Queries the available years from the Nexrad S3 bucket and prints the list. The output shows years from 1991 through 2017. ```python years = conn.get_avail_years() print(years) ``` ```text Output: ['1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017'] ``` -------------------------------- ### Instantiate NexradAwsInterface Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Instantiates the NexradAwsInterface class, which provides methods to query and download from the Nexrad Amazon S3 Bucket. ```python import nexradaws conn = nexradaws.NexradAwsInterface() ``` -------------------------------- ### Download radar scans with conn.download Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Downloads the first four radar scans from the previous query using the connection's download method. The output shows the downloaded filenames and a summary of successful downloads with zero errors. ```python results = conn.download(scans[0:4], templocation) ``` ```text Downloaded KTLX20130531_221445_V06.gz Downloaded KTLX20130531_220537_V06.gz Downloaded KTLX20130531_221011_V06.gz Downloaded KTLX20130531_220114_V06.gz 4 out of 4 files downloaded...0 errors ``` -------------------------------- ### Plot reflectivity with pyart RadarDisplay Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Opens each successfully downloaded NEXRAD file with pyart and plots reflectivity data, zooming to within 150 km of the radar. The output shows the resulting matplotlib figure object. ```python fig = plt.figure(figsize=(16,12)) for i,scan in enumerate(results.iter_success(),start=1): ax = fig.add_subplot(2,2,i) radar = scan.open_pyart() display = pyart.graph.RadarDisplay(radar) display.plot('reflectivity',0,ax=ax,title="{} {}".format(scan.radar_id,scan.scan_time)) display.set_limits((-150, 150), (-150, 150), ax=ax) ``` ```text Result: ``` -------------------------------- ### Iterate successful downloads with iter_success Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Iterates over successfully downloaded files using the iter_success generator method and prints each radar ID and scan time. The output shows the radar ID and scan times for the four downloaded files. ```python for scan in results.iter_success(): print ("{} volume scan time {}".format(scan.radar_id,scan.scan_time)) ``` ```text KTLX volume scan time 2013-05-31 22:01:14+00:00 KTLX volume scan time 2013-05-31 22:05:37+00:00 KTLX volume scan time 2013-05-31 22:10:11+00:00 KTLX volume scan time 2013-05-31 22:14:45+00:00 ``` -------------------------------- ### Plot velocity with pyart RadarDisplay Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Opens each successfully downloaded NEXRAD file with pyart and plots velocity data, zooming to within 150 km of the radar. The output shows the resulting matplotlib figure object. ```python fig = plt.figure(figsize=(16,12)) for i,scan in enumerate(results.iter_success(),start=1): ax = fig.add_subplot(2,2,i) radar = scan.open_pyart() display = pyart.graph.RadarDisplay(radar) display.plot('velocity',1,ax=ax,title="{} {}".format(scan.radar_id,scan.scan_time)) display.set_limits((-150, 150), (-150, 150), ax=ax) ``` ```text Result: ``` -------------------------------- ### Print successful downloads with results.success Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Prints the success attribute of the DownloadResult object, which is a list of LocalNexradFile objects for successfully downloaded files. The output shows the local file paths for the four downloaded scans. ```python print(results.success) ``` ```text [, , , ] ``` -------------------------------- ### Print failed downloads list with results.failed Source: https://github.com/aarande/nexradaws/blob/master/docs/source/Tutorial.ipynb Prints the failed attribute, which is a list of AwsNexradFile objects for failed downloads. The output shows an empty list, indicating no failures. ```python print(results.failed) ``` ```text [] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.