3 Created on Tue Apr 28 14:56:51 2020
10 from pandas
import DatetimeIndex
12 from datetime
import timedelta
27 if set(cls.__abstractmethods__) <= attrs:
40 def __init__(self, name, simBgn, simEnd, timeUnit='h', nHrs=1):
51 self.
nHrsnHrs = int(nHrs)
58 np.arange(np.datetime64(self.
simBgnsimBgn),
59 np.datetime64(self.
simEndsimEnd)+np.timedelta64(self.
nHrsnHrs,
'h'),
60 np.timedelta64(self.
nHrsnHrs,
'h'), dtype=
'datetime64[h]').astype(
'datetime64[h]'))
69 return self.
_step_step
92 vDate = np.full((len(self.dateTime), 4), np.nan)
94 for i, curDt
in enumerate(self.dateTime):
95 vDate[i, :] = [curDt.year, curDt.month, curDt.day, curDt.hour]
99 return self.
dateTimedateTime.astype(np.int64)
103 def __init__(self, name, Tcont, fcstFreq=24, fcstHoriz=360, tFcst=None, fcstDate=None):
119 tDeltaFcst = np.timedelta64(self.
fcstFreqfcstFreq,
'h')
127 np.arange(np.datetime64(self.
TcontTcont.simBgn),
128 np.datetime64(self.
TcontTcont.simEnd) + (tDeltaFcst-1),
129 tDeltaFcst, dtype=
'datetime64[h]').astype(
'datetime64[h]'))
135 tFcst = np.empty(self.
nFcstsnFcsts, dtype=TimeCont)
137 for i
in range(0, self.
nFcstsnFcsts):
140 idxTcontBgn = max(0, np.where(Tcont.dateTime==self.
fcstDatefcstDate[i])[0][0] - 1)
141 tBgn = Tcont.dateTime[idxTcontBgn]
142 tEnd = np.datetime64(tBgn+np.timedelta64(fcstHoriz,
'h'))
145 tFcst[i] =
TimeCont(
'timeFcst'+str(i), tBgn, tEnd, Tcont.timeUnit)
151 return self.
_step_step
164 chkCurRow = np.where(self.
fcstDatefcstDate<=dateTime)[0][-1]
176 return np.where(self.
_tFcstCur_tFcstCur.dateTime==self.
TcontTcont.curDT)[0][0]
def __subclasshook__(cls, C)
def bind_to(self, callback)
def get_datetime_offset(self, tsOffset)
def get_period(self, dateTimeBgn, dateTimeEnd)
def __init__(self, name, simBgn, simEnd, timeUnit='h', nHrs=1)
def update_current_tFcst(self, step, dateTime)
def get_datetime_offset(self, tsOffset)
def __init__(self, name, Tcont, fcstFreq=24, fcstHoriz=360, tFcst=None, fcstDate=None)