def test_get_fntime_date_values(): row1 = ' DT /JULY 15 /JULY 16 /JULY 17 / \n' row2 = ' HR 06 09 12 15 18 21 00 03 06 09 12 15 18 21 00 03 06 09 12 18 00 \n' fntimes = mp.get_fntime( row1, row2, { 'station': 'K0V1', 'model': 'AVN MOS GUIDANCE', 'runtime': datetime.datetime(2000, 7, 15, 0, 0, tzinfo=tzutc()) }) truth = [ datetime.datetime(2000, 7, 15, 6, 0), datetime.datetime(2000, 7, 15, 9, 0), datetime.datetime(2000, 7, 15, 12, 0), datetime.datetime(2000, 7, 15, 15, 0), datetime.datetime(2000, 7, 15, 18, 0), datetime.datetime(2000, 7, 15, 21, 0), datetime.datetime(2000, 7, 16, 0, 0), datetime.datetime(2000, 7, 16, 3, 0), datetime.datetime(2000, 7, 16, 6, 0), datetime.datetime(2000, 7, 16, 9, 0), datetime.datetime(2000, 7, 16, 12, 0), datetime.datetime(2000, 7, 16, 15, 0), datetime.datetime(2000, 7, 16, 18, 0), datetime.datetime(2000, 7, 16, 21, 0), datetime.datetime(2000, 7, 17, 0, 0), datetime.datetime(2000, 7, 17, 3, 0), datetime.datetime(2000, 7, 17, 6, 0), datetime.datetime(2000, 7, 17, 9, 0), datetime.datetime(2000, 7, 17, 12, 0), datetime.datetime(2000, 7, 17, 18, 0), datetime.datetime(2000, 7, 18, 0, 0) ] assert fntimes == truth
def test_get_fntime_leap_year(): row1 = ' DT /FEB 27 /FEB 28 /FEB 29 / \n' row2 = ' HR 12 15 18 21 00 03 06 09 12 15 18 21 00 03 06 09 12 15 18 00 06 \n' fntimes = mp.get_fntime( row1, row2, { 'station': 'KNYC', 'model': 'GFS MOS GUIDANCE', 'runtime': datetime.datetime(2016, 2, 27, 6, 0, tzinfo=tzutc()) }) truth = [ datetime.datetime(2016, 2, 27, 12, 0), datetime.datetime(2016, 2, 27, 15, 0), datetime.datetime(2016, 2, 27, 18, 0), datetime.datetime(2016, 2, 27, 21, 0), datetime.datetime(2016, 2, 28, 0, 0), datetime.datetime(2016, 2, 28, 3, 0), datetime.datetime(2016, 2, 28, 6, 0), datetime.datetime(2016, 2, 28, 9, 0), datetime.datetime(2016, 2, 28, 12, 0), datetime.datetime(2016, 2, 28, 15, 0), datetime.datetime(2016, 2, 28, 18, 0), datetime.datetime(2016, 2, 28, 21, 0), datetime.datetime(2016, 2, 29, 0, 0), datetime.datetime(2016, 2, 29, 3, 0), datetime.datetime(2016, 2, 29, 6, 0), datetime.datetime(2016, 2, 29, 9, 0), datetime.datetime(2016, 2, 29, 12, 0), datetime.datetime(2016, 2, 29, 15, 0), datetime.datetime(2016, 2, 29, 18, 0), datetime.datetime(2016, 3, 1, 0, 0), datetime.datetime(2016, 3, 1, 6, 0) ] assert fntimes == truth
def test_get_fntime(): row1 = ' DT /JAN 2 /JAN 3 /JAN 4 \n' row2 = ' HR 00 03 06 09 12 15 18 21 00 03 06 09 12 15 18 21 00 03 06 12 18 \n' fntimes = mp.get_fntime( row1, row2, { 'station': 'KSTS', 'model': 'GFS MOS GUIDANCE', 'runtime': datetime.datetime(2019, 1, 1, 18, 0, tzinfo=tzutc()) }) truth = [ datetime.datetime(2019, 1, 2, 0, 0), datetime.datetime(2019, 1, 2, 3, 0), datetime.datetime(2019, 1, 2, 6, 0), datetime.datetime(2019, 1, 2, 9, 0), datetime.datetime(2019, 1, 2, 12, 0), datetime.datetime(2019, 1, 2, 15, 0), datetime.datetime(2019, 1, 2, 18, 0), datetime.datetime(2019, 1, 2, 21, 0), datetime.datetime(2019, 1, 3, 0, 0), datetime.datetime(2019, 1, 3, 3, 0), datetime.datetime(2019, 1, 3, 6, 0), datetime.datetime(2019, 1, 3, 9, 0), datetime.datetime(2019, 1, 3, 12, 0), datetime.datetime(2019, 1, 3, 15, 0), datetime.datetime(2019, 1, 3, 18, 0), datetime.datetime(2019, 1, 3, 21, 0), datetime.datetime(2019, 1, 4, 0, 0), datetime.datetime(2019, 1, 4, 3, 0), datetime.datetime(2019, 1, 4, 6, 0), datetime.datetime(2019, 1, 4, 12, 0), datetime.datetime(2019, 1, 4, 18, 0) ] assert fntimes == truth
def test_get_fntimes_june(): row1 = ' DT /MAY 31 /JUNE01 /JUNE02' row2 = ' HR 00 12 00 12 00 12 ' truth = [ datetime.datetime(2000, 5, 31, 0, 0), datetime.datetime(2000, 5, 31, 12, 0), datetime.datetime(2000, 6, 1, 0, 0), datetime.datetime(2000, 6, 1, 12, 0), datetime.datetime(2000, 6, 2, 0, 0), datetime.datetime(2000, 6, 2, 12, 0) ] fntimes = mp.get_fntime( row1, row2, { 'station': 'K0V1', 'model': 'AVN MOS GUIDANCE', 'runtime': datetime.datetime(2000, 5, 30, 18, 0, tzinfo=tzutc()) }) assert truth == fntimes
def test_get_fntime_yearend(): row1 = ' DT /DEC 31/JAN 1 / \n' row2 = 'HR 06 12 18 00 06 12 18 00 \n' fntimes = mp.get_fntime( row1, row2, { 'station': 'KNYC', 'model': 'GFS MOS GUIDANCE', 'runtime': datetime.datetime(2000, 12, 31, 0, 0, tzinfo=tzutc()) }) truth = [ datetime.datetime(2000, 12, 31, 6, 0), datetime.datetime(2000, 12, 31, 12, 0), datetime.datetime(2000, 12, 31, 18, 0), datetime.datetime(2001, 1, 1, 0, 0), datetime.datetime(2001, 1, 1, 6, 0), datetime.datetime(2001, 1, 1, 12, 0), datetime.datetime(2001, 1, 1, 18, 0), datetime.datetime(2001, 1, 2, 0, 0) ] assert fntimes == truth