Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ttide/t_predic.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ def t_predic(t_time, names, freq, tidecon,
ju = np.zeros((len(freq),), dtype='int32')
# Check to make sure names and frequencies match expected values.
for k in range(0, (names.shape[0])):
ju[k] = np.argwhere(const['name'] == names[(k)])
matches = np.flatnonzero(const['name'] == names[(k)])
if matches.size == 0:
raise ValueError("Constituent name '%s' not found in constants" %
(names[(k)],))
ju[k] = matches[0]
# if any(freq~=const.freq(ju)),
# error('Frequencies do not match names in input');
# end;
Expand Down
10 changes: 5 additions & 5 deletions ttide/t_tide.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def t_tide(xin, dt=1, stime=None, lat=None,
series will remain and mean/trend are included).

lsq : string
'direct' - use A\ x fit
'normal' - use (A'A)\(A'x) (may be necessary for very large
'direct' - use A\\ x fit
'normal' - use (A'A)\\(A'x) (may be necessary for very large
input vectors since A'A is much smaller than A)
'best' - automatically choose based on length of series
(default).
Expand Down Expand Up @@ -427,14 +427,14 @@ def t_tide(xin, dt=1, stime=None, lat=None,
# would be to change the basis functions.
####################################################################
ii = np.flatnonzero(np.isfinite(jref))
if ii:
if ii.size > 0:
print(' Do inference corrections\\n')
snarg = nobsu * pi * dt * (fi[(ii - 1)] - fu[(jref[(ii - 1)] - 1)])
scarg = np.sin(snarg) / snarg
if infamprat.shape[1] == 1:
# For real time series
pearg = np.dot(2 * pi,ii
(vu[(mu + ii - 1)] -
pearg = np.dot(2 * pi, ii * (
vu[(mu + ii - 1)] -
vu[(jref[(ii - 1)] - 1)] +
infph[(ii - 1)])) / 360
pcfac = infamprat[(ii - 1)] * f[(mu + ii - 1)] / \
Expand Down
2 changes: 1 addition & 1 deletion ttide/tests/print_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ttide.t_tide import t_tide
import ttide.tests.base as bmod
from cStringIO import StringIO
from io import StringIO
import sys
import numpy as np

Expand Down