Removed the pandas dependency
This commit is contained in:
parent
988ff7521b
commit
8a69023089
@ -1,5 +1,4 @@
|
||||
import datetime
|
||||
from pandas import to_datetime
|
||||
|
||||
from operator import attrgetter
|
||||
try:
|
||||
@ -44,17 +43,27 @@ def _make_datetime(dates_record):
|
||||
day = dates_record[0].get_int(0)
|
||||
month = dates_record[1].get_str(0)
|
||||
year = dates_record[2].get_int(0)
|
||||
|
||||
|
||||
date_dt = datetime.datetime(year, ecl_month[month], day)
|
||||
if len(dates_record) < 4:
|
||||
return date_dt
|
||||
else:
|
||||
time_str = dates_record[3].get_str(0)
|
||||
dt = to_datetime('1900-01-01 '+time_str)
|
||||
if dt.time():
|
||||
return datetime.datetime(year, ecl_month[month], day, dt.hour, dt.minute, dt.second, dt.microsecond)
|
||||
else:
|
||||
return date_dt
|
||||
time_list = time_str.split(':')
|
||||
hour = minute = second = microsecond = 0
|
||||
hour = int(time_list[0])
|
||||
if len(time_list)>1:
|
||||
minute = int(time_list[1])
|
||||
if len(time_list)>2:
|
||||
sec_list = time_list[2].split('.')
|
||||
second = int(sec_list[0])
|
||||
if len(sec_list)>1:
|
||||
ms_str = sec_list[1].strip()
|
||||
npad = 6-len(ms_str)
|
||||
ms_str += "".join(["0" for i in range(npad)])
|
||||
microsecond = int(ms_str)
|
||||
|
||||
return datetime.datetime(year, ecl_month[month], day, hour, minute, second, microsecond)
|
||||
|
||||
|
||||
class TimeStep(object):
|
||||
|
Loading…
Reference in New Issue
Block a user