From 44b1be7ec78821a20b07780244f3534c8db17468 Mon Sep 17 00:00:00 2001 From: Gunnar Voet Date: Tue, 12 Mar 2024 12:50:39 -0700 Subject: [PATCH] fix RuntimeWarning when casting float to int --- utide/harmonics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utide/harmonics.py b/utide/harmonics.py index 0a671a9..326b515 100644 --- a/utide/harmonics.py +++ b/utide/harmonics.py @@ -12,11 +12,11 @@ const = ut_constants.const shallow = ut_constants.shallow -nshallow = np.ma.masked_invalid(const.nshallow).astype(int) -ishallow = np.ma.masked_invalid(const.ishallow).astype(int) - 1 +nshallow = np.ma.masked_invalid(const.nshallow) +ishallow = np.ma.masked_invalid(const.ishallow) not_shallow = ishallow.mask # True where it was masked. -nshallow = nshallow.compressed() -ishallow = ishallow.compressed() +nshallow = nshallow.compressed().astype(int) +ishallow = ishallow.compressed().astype(int) - 1 kshallow = np.nonzero(~not_shallow)[0]