From 708ce8bf92c22ee2995e3b535f024720a5abb6a2 Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Mon, 28 Oct 2024 15:05:42 -1000 Subject: [PATCH] Simplify ut_linci. This removes a numpy deprecation warning: "DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future." --- .gitignore | 3 +++ utide/confidence.py | 16 ++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 49f63e5..3ec6ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,6 @@ doc/_build/ .pydevproject .vscode/ utide/_version.py + +# Mac +.DS_Store diff --git a/utide/confidence.py b/utide/confidence.py index 0ddd815..8e91219 100644 --- a/utide/confidence.py +++ b/utide/confidence.py @@ -423,19 +423,15 @@ def ut_linci(X, Y, sigX, sigY): # UTide v1p0 9/2011 d.codiga@gso.uri.edu # (adapted from errell.m of t_tide, Pawlowicz et al 2002) - X = np.array([X]) - Y = np.array([Y]) - sigX = np.array([sigX]) - sigY = np.array([sigY]) - Xu = np.real(X[:]) + Xu = np.real(X) sigXu = np.real(sigX) - Yu = np.real(Y[:]) + Yu = np.real(Y) sigYu = np.real(sigY) - Xv = np.imag(X[:]) - sigXv = np.imag(sigX[:]) - Yv = np.imag(Y[:]) - sigYv = np.imag(sigY[:]) + Xv = np.imag(X) + sigXv = np.imag(sigX) + Yv = np.imag(Y) + sigYv = np.imag(sigY) rp = 0.5 * np.sqrt((Xu + Yv) ** 2 + (Xv - Yu) ** 2) rm = 0.5 * np.sqrt((Xu - Yv) ** 2 + (Xv + Yu) ** 2)