In [1]:
from ahh import era

In [2]:
years = [1990, 2000, 2010]
months = [12, 1, 2]
days = [3, 4, 5]

era.time2dt(year=years, month=months, day=days, strf=None) # concatenate lists of years, months, days into a datetime array


Out[2]:
DatetimeIndex(['1990-12-03', '2000-01-04', '2010-02-05'], dtype='datetime64[ns]', freq=None)

In [3]:
years = [1990, 2000, 2010]
months = [12, 1, 2]
days = [3, 4, 5]
hours = [6, 7, 8]
minutes = [9, 10, 11]

era.time2dt(year=years, month=months, day=days, 
            hour=hours, minute=minutes, strf=None) # can also include hours and minutes


Out[3]:
DatetimeIndex(['1990-12-03 06:09:00', '2000-01-04 07:10:00',
               '2010-02-05 08:11:00'],
              dtype='datetime64[ns]', freq=None)

In [4]:
date_str_list = ['20170204', '20160103', '20151202']
era.time2dt(date_str_list) # can also convert list of date strings into datetime array


Out[4]:
DatetimeIndex(['2017-02-04', '2016-01-03', '2015-12-02'], dtype='datetime64[ns]', freq=None)

In [5]:
date_str_list = ['2017YR_02MTH_04DAY_7Z', '2016YR_01MTH_03DAY_6Z', '2015YR_12MTH_02DAY_5Z']
era.time2dt(date_str_list, strf='%YYR_%mMTH_%dDAY_%HZ') # can also convert unusually formatted date strings


Out[5]:
DatetimeIndex(['2017-02-04 07:00:00', '2016-01-03 06:00:00',
               '2015-12-02 05:00:00'],
              dtype='datetime64[ns]', freq=None)

In [ ]: