From 5029554eb248f899ea9bea54b0ae87856ace8262 Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Wed, 8 May 2019 12:06:41 -1000 Subject: [PATCH] Silence some "invalid value" warnings. Letting the nans propagate, or cause the corresponding boolean to be False, is fine in these locations. --- utide/_reconstruct.py | 3 ++- utide/confidence.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/utide/_reconstruct.py b/utide/_reconstruct.py index 9b56ece..ebb7723 100644 --- a/utide/_reconstruct.py +++ b/utide/_reconstruct.py @@ -103,7 +103,8 @@ def _reconstruct(t, goodmask, coef, verbose, constit, min_SNR, min_PE): N = (coef['A_ci']/1.96)**2 SNR = E / N PE = 100 * E / E.sum() - ind = np.logical_and(SNR >= min_SNR, PE >= min_PE) + with np.errstate(invalid='ignore'): + ind = np.logical_and(SNR >= min_SNR, PE >= min_PE) # Complex coefficients. rpd = np.pi/180 diff --git a/utide/confidence.py b/utide/confidence.py index 6ec8b1d..c0b7c1e 100644 --- a/utide/confidence.py +++ b/utide/confidence.py @@ -238,7 +238,9 @@ def _confidence(coef, cnstit, opt, t, e, tin, elor, xraw, xmod, W, m, B, varYv = Pvv[c] * varYv / den varcov_mCc[c, :, :] = np.diag(np.array([varXu, varYu, varXv, varYv])) - sig1, sig2 = ut_linci(Xu[c] + 1j * Xv[c], Yu[c] + 1j * Yv[c], + with np.errstate(invalid='ignore'): + sig1, sig2 = ut_linci(Xu[c] + 1j * Xv[c], + Yu[c] + 1j * Yv[c], np.sqrt(varXu) + 1j * np.sqrt(varXv), np.sqrt(varYu) + 1j * np.sqrt(varYv)) coef['Lsmaj_ci'][c] = 1.96 * np.real(sig1)