Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for 'lat=0' and 0 time series issues #62

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion utide/confidence.py
Expand Up @@ -252,7 +252,9 @@ def _confidence(coef, cnstit, opt, t, e, tin, elor, xraw, xmod, W, m, B,
varcov_mCw[c, :2, :2] = Duu

if not opt.white:
Duu = Puu[c] * Duu / np.trace(Duu)
Duu = Puu[c] * Duu
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a trailing space after Duu.

if np.trace(Duu) != 0. :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a whitespace before :.

Duu = Duu / np.trace(Duu)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't compute np.trace twice and we can do the Duu division in place:

trace = np.trace(Duu)
if trace != 0. :
    Duu /= trace

varcov_mCc[c, :2, :2] = Duu

if not opt.twodim:
Expand Down
4 changes: 3 additions & 1 deletion utide/harmonics.py
Expand Up @@ -122,7 +122,9 @@ def FUV(t, tref, lind, lat, ngflgs):

astro, ader = ut_astron(tt)

if abs(lat) < 5:
if lat == 0:
lat = 5
elif abs(lat) < 5:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lat = np.sign(lat) * 5

slat = np.sin(np.deg2rad(lat))
Expand Down