From d5548e462bbdb53deaf4f6a22deeba885a000ad2 Mon Sep 17 00:00:00 2001 From: Aurelien PONTE Date: Thu, 21 Jun 2018 13:43:25 +0000 Subject: [PATCH 1/4] fix issue with lat=0 --- utide/harmonics.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utide/harmonics.py b/utide/harmonics.py index 020d6d4..be75dbc 100644 --- a/utide/harmonics.py +++ b/utide/harmonics.py @@ -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: lat = np.sign(lat) * 5 slat = np.sin(np.deg2rad(lat)) From f00d0186979ed6c9bc18de35b10a7e0492db8f37 Mon Sep 17 00:00:00 2001 From: Aurelien PONTE Date: Thu, 21 Jun 2018 13:51:56 +0000 Subject: [PATCH 2/4] catches error in the computation of confidence intervals for null time series --- utide/confidence.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utide/confidence.py b/utide/confidence.py index 6ec8b1d..ac10801 100644 --- a/utide/confidence.py +++ b/utide/confidence.py @@ -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 + if np.trace(Duu) != 0. : + Duu = Duu / np.trace(Duu) varcov_mCc[c, :2, :2] = Duu if not opt.twodim: From fcabbff59a6133bcfbf1a21ec5331063439b891c Mon Sep 17 00:00:00 2001 From: Aurelien PONTE Date: Thu, 21 Jun 2018 14:09:09 +0000 Subject: [PATCH 3/4] minor updates to proposed fixes --- utide/confidence.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utide/confidence.py b/utide/confidence.py index ac10801..cc0227f 100644 --- a/utide/confidence.py +++ b/utide/confidence.py @@ -252,9 +252,10 @@ 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 - if np.trace(Duu) != 0. : - Duu = Duu / np.trace(Duu) + Duu = Puu[c] * Duu + trace = np.trace(Duu) + if trace != 0.: + Duu = Duu / trace varcov_mCc[c, :2, :2] = Duu if not opt.twodim: From 530edcf648dd883398bb2c0c78f3331b62b3d7a6 Mon Sep 17 00:00:00 2001 From: Aurelien PONTE Date: Thu, 21 Jun 2018 14:13:10 +0000 Subject: [PATCH 4/4] more compact division --- utide/confidence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utide/confidence.py b/utide/confidence.py index cc0227f..5cde5a5 100644 --- a/utide/confidence.py +++ b/utide/confidence.py @@ -255,7 +255,7 @@ def _confidence(coef, cnstit, opt, t, e, tin, elor, xraw, xmod, W, m, B, Duu = Puu[c] * Duu trace = np.trace(Duu) if trace != 0.: - Duu = Duu / trace + Duu /= trace varcov_mCc[c, :2, :2] = Duu if not opt.twodim: