def __init__(self, cnn=None, NetworkCode=None, StationCode=None, t=None):
if t is None:
ppp_soln = PPP_soln(cnn, NetworkCode, StationCode)
t = ppp_soln.t
# wrap around the solutions
wt = np.sort(np.unique(t - np.fix(t)))
# analyze the gaps in the data
dt = np.diff(wt)
# max dt (internal)
dtmax = np.max(dt)
# dt wrapped around
dt_interyr = 1 - wt[-1] + wt[0]
if dt_interyr > dtmax:
dtmax = dt_interyr
# save the value of the max wrapped delta time
self.dt_max = dtmax
# if dtmax < 3 months (90 days = 0.1232), then we can fit the annual
# if dtmax < 1.5 months (45 days = 0.24657), then we can fit the semi-annual too
if dtmax <= 0.1232:
# all components (annual and semi-annual)
self.A = np.array([sin(2 * pi * t), cos(2 * pi * t), sin(4 * pi * t), cos(4 * pi * t)]).transpose()
self.frequencies = 2
elif dtmax <= 0.2465:
# only annual
self.A = np.array([sin(2 * pi * t), cos(2 * pi * t)]).transpose()
self.frequencies = 1
else:
# no periodic terms
self.A = np.array([])
self.frequencies = 0
# variables to store the periodic amplitudes
self.sin = np.array([])
self.cos = np.array([])
self.params = self.frequencies * 2
评论列表
文章目录