API Docs¶
-
class
nexradaws.
NexradAwsInterface
[source]¶ Instantiate an instance of this class to get a connection to the Nexrad AWS bucket. This class provides methods to query for various metadata of the AWS bucket as well as download files.
>>> import nexradaws >>> conn = nexradaws.NexradAwsInterface()
-
get_avail_years
()[source]¶ This method allows you to get the years that are currently available.
>>> print conn.get_avail_years() >>> [u'1991', u'1992', u'1993', u'1994', u'1995', u'1996', u'1997', u'1998', u'1999', u'2000', u'2001', u'2002', u'2003', u'2004', u'2005', u'2006', u'2007', u'2008', u'2009', u'2010', u'2011', u'2012', u'2013', u'2014', u'2015', u'2016', u'2017']
Returns: A list of strings representing the years available Rtype list:
-
get_avail_months
(year)[source]¶ This method allows you to get the available months in a given year.
>>> print conn.get_avail_months('2013') >>> [u'01', u'02', u'03', u'04', u'05', u'06', u'07', u'08', u'09', u'10', u'11', u'12']
Parameters: year (str or int) – the year we are requesting available months for (i.e. 2010) Returns: A list of strings representing the months available for that year Rtype list:
-
get_avail_days
(year, month)[source]¶ This method allows you to get the available days in a given year and month.
>>> print conn.get_avail_days('2013','05') >>> [u'01', u'02', u'03', u'04', u'05', u'06', u'07', u'08', u'09', u'10', u'11', u'12', u'13', u'14', u'15', u'16', u'17', u'18', u'19', u'20', u'21', u'22', u'23', u'24', u'25', u'26', u'27', u'28', u'29', u'30', u'31']
Parameters: - year (str or int) – the year we are requesting available days for (i.e 2010)
- month (str or int) – the month we are requesting available days for (i.e. 05)
Returns: A list of strings representing the days available in the given month and year
Rtype list:
-
get_avail_radars
(year, month, day)[source]¶ This method allows you to get the available radars in a given year, month, and day.
>>> print conn.get_avail_radars('2013','05','31') >>> [u'DAN1', u'KABR', u'KABX', u'KAKQ', u'KAMA', u'KAMX', u'KAPX', u'KARX', u'KATX', u'KBBX', u'KBGM', u'KBHX', u'KBIS', u'KBLX', u'KBMX', u'KBOX', u'KBRO', u'KBUF', u'KBYX', u'KCAE', u'KCBW', u'KCBX', u'KCCX', u'KCLE', u'KCLX', u'KCRP', u'KCXX', u'KCYS', u'KDAX', u'KDDC', u'KDFX', u'KDGX', u'KDLH', u'KDMX', u'KDOX', u'KDTX', u'KDVN', u'KEAX', u'KEMX', u'KENX', u'KEOX', u'KEPZ', u'KESX', u'KEVX', u'KEWX', u'KEYX', u'KFCX', u'KFDR', u'KFFC', u'KFSD', u'KFSX', u'KFTG', u'KFWS', u'KGGW', u'KGJX', u'KGLD', u'KGRB', u'KGRK', u'KGRR', u'KGSP', u'KGWX', u'KGYX', u'KHDX', u'KHGX', u'KHNX', u'KHPX', u'KHTX', u'KICT', u'KICX', u'KILN', u'KILX', u'KIND', u'KINX', u'KIWA', u'KIWX', u'KJAX', u'KJGX', u'KJKL', u'KLBB', u'KLCH', u'KLGX', u'KLIX', u'KLNX', u'KLOT', u'KLRX', u'KLSX', u'KLTX', u'KLVX', u'KLWX', u'KLZK', u'KMAF', u'KMAX', u'KMBX', u'KMHX', u'KMKX', u'KMLB', u'KMOB', u'KMPX', u'KMQT', u'KMRX', u'KMSX', u'KMTX', u'KMUX', u'KMVX', u'KMXX', u'KNKX', u'KNQA', u'KOAX', u'KOHX', u'KOKX', u'KOTX', u'KPAH', u'KPBZ', u'KPDT', u'KPOE', u'KPUX', u'KRAX', u'KRGX', u'KRIW', u'KRLX', u'KRTX', u'KSFX', u'KSGF', u'KSHV', u'KSJT', u'KSOX', u'KSRX', u'KTBW', u'KTFX', u'KTLH', u'KTLX', u'KTWX', u'KTYX', u'KUDX', u'KUEX', u'KVNX', u'KVTX', u'KVWX', u'KYUX', u'PHKI', u'PHKM', u'PHMO', u'PHWA', u'TJUA']
Parameters: - year (str or int) – the year we are requesting available radars for (i.e 2010)
- month (str or int) – the month we are requesting available radars for (i.e. 05)
- day (str or int) – the day we are requesting available radars for (i.e. 01)
Returns: A list of string representing the radar sites available in the given day, month, and year
Rtype list:
-
get_avail_scans
(year, month, day, radar)[source]¶ This method allows you to get the available radar scans for a given year, month, day, and radar.
>>> print conn.get_avail_scans('2013','05','31','KTLX') >>> [AwsNexradFile object - 2013/05/31/KTLX/KTLX20130531_000358_V06.gz, AwsNexradFile object - 2013/05/31/KTLX/KTLX20130531_000834_V06.gz, AwsNexradFile object - 2013/05/31/KTLX/KTLX20130531_001311_V06.gz,...
Parameters: - year (str or int) – the year we are requesting available scans for (i.e 2010)
- month (str or int) – the month we are requesting available scans for (i.e. 05)
- day (str or int) – the day we are requesting available scans for (i.e. 01)
- radar (str) – the radar id we are requesting available scans for (i.e. KTLX)
Returns: A list of
AwsNexradFile
objects representing the radar scans available for a given radar, day, month, and yearRtype list:
-
get_avail_scans_in_range
(start, end, radar)[source]¶ Get all available scans for a radar between start and end date. If datetime’s do not include a timezone they will be set to UTC.
>>> from datetime import datetime >>> radarid = 'KTLX' >>> start = datetime(2013, 5, 31, 20, 0) >>> end = datetime(2013, 5, 31, 23, 0) >>> print conn.get_avail_scans_in_range(start,end,radarid) >>> [AwsNexradFile object - 2013/05/31/KTLX/KTLX20130531_200046_V06.gz, AwsNexradFile object - 2013/05/31/KTLX/KTLX20130531_200415_V06.gz, AwsNexradFile object - 2013/05/31/KTLX/KTLX20130531_200745_V06.gz,...
Parameters: - start (datetime) – start time for range
- end (datetime) – end time for range
- radar (str) – radar id
Returns: A list of
AwsNexradFile
objects representing the radar scans available in the passed time range.Rtype list:
-
download
(awsnexradfiles, basepath, keep_aws_folders=False, threads=6)[source]¶ This method will download the passed AwsNexradFile object(s) to the given basepath folder. If keep_aws_folders is True then subfolders will be created under the basepath with the same structure as on AWS (year/month/day/radar/).
Parameters: - awsnexradfiles (list) – A list of
AwsNexradFile
objects to download - basepath (str) – location to save downloaded files
- keep_aws_folders (bool) – weather or not to use the aws folder structure inside the basepath…(year/month/day/radar/)
- threads (int) – number of download threads to utilize (default=6)
Returns: A
DownloadResults
object that contains successful downloads asLocalNexradFile
objects as well as anyAwsNexradFile
objects that failed:rtype
DownloadResults
:- awsnexradfiles (list) – A list of
-
-
class
nexradaws.resources.awsnexradfile.
AwsNexradFile
(scandict)[source]¶ This class contains metadata about the remote NEXRAD file on AWS
Variables: - key (str) – AWS key for this NEXRAD file
- last_modified (datetime) – when the file was last modified on AWS
- awspath (str) – filepath on AWS to NEXRAD file
- filename (str) – the NEXRAD filename
- scan_time (datetime) – volume scan time for the NEXRAD file
- radar_id (str) – the four letter radar id (i.e. KTLX)
- filepath – absolute path to the downloaded file on the local system
-
class
nexradaws.resources.localnexradfile.
LocalNexradFile
(awsnexradfile, localfilepath)[source]¶ This class contains metadata about the local NEXRAD file as well as methods to open the file.
Variables: - key (str) – AWS key for this NEXRAD file
- last_modified (datetime) – when the file was last modified on AWS
- filename (str) – the NEXRAD filename
- scan_time (datetime) – volume scan time for the NEXRAD file
- radar_id (str) – the four letter radar id (i.e. KTLX)
- filepath – absolute path to the downloaded file on the local system
-
class
nexradaws.resources.downloadresults.
DownloadResults
(localfiles, failedfiles)[source]¶ This class contains the results of the download call as well as methods for accessing the results.
Variables: - success (list) – a list of
LocalNexradFile
objects representing the successful downloads - failed – a list of any
AwsNexradFile
objects that failed to download - success_count (int) – The number of successful downloads
- failed_count (int) – The number of downloads that failed
- total (int) – The total number of nexrad files that were attempted
- success (list) – a list of