From 4953af7d80d4376fcf06a36a1eaa3708111fa6a2 Mon Sep 17 00:00:00 2001 From: DavidVadnais Date: Thu, 22 May 2025 00:32:00 +0000 Subject: [PATCH] Remove unnecessary semicolons at end of Python statements --- OceanLab/dyn.py | 2 +- OceanLab/eof.py | 7 ++++--- OceanLab/oa.py | 10 +++++----- OceanLab/utils.py | 3 +-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/OceanLab/dyn.py b/OceanLab/dyn.py index 9b9a469..761b994 100644 --- a/OceanLab/dyn.py +++ b/OceanLab/dyn.py @@ -396,7 +396,7 @@ def eqmodes(N2,z,nm,lat,pmodes=False): # F_j(z)=-g.he_j d/dzS_j # #### - if pmodes==True: + if pmodes: Fi=np.zeros(Si.shape) for i in np.arange(nm): Fi[1:-1,i] =\ diff --git a/OceanLab/eof.py b/OceanLab/eof.py index 3461cde..2f1e922 100644 --- a/OceanLab/eof.py +++ b/OceanLab/eof.py @@ -44,7 +44,7 @@ def eoft(trmat,nm=None): amp = np.dot(evecs_norm.T,trmat) #if was chosen a number of eigenvectors - if nm!=None: + if nm is not None: evecs_norm = evecs_norm[:,:nm] evals_perc = evals_perc[:nm] amp = amp[:nm,:] @@ -117,7 +117,7 @@ def my_eof_interp(M,nmodes,errmin=1e-15,repmax=None): print(err) if err < errmin: break - if repmax!=None: + if repmax is not None: if rep>=repmax: break rep += 1 @@ -188,7 +188,8 @@ def ceof(lon, lat, data, nkp = 10, parallel = True): print('3: Solving the eigenvalue problem') lamda, loadings = delayed(la.eig)(c).compute() # lamda: eigenvalue, loadings: eigenvectors - l = lamda.conjugate().T; k = np.argsort(l) + l = lamda.conjugate().T + k = np.argsort(l) lamda, loadings = np.flip(l[k]), np.fliplr(loadings[:,k]) loadings = loadings[:,:nkp] # In case there were nan values in the orginal data, we need to perform the approach below: diff --git a/OceanLab/oa.py b/OceanLab/oa.py index 9853dcf..2360eb6 100644 --- a/OceanLab/oa.py +++ b/OceanLab/oa.py @@ -94,12 +94,12 @@ def vectoa(Xg,Yg,X,Y,U,V,corrlenx,corrleny,err,b=0): tc = np.array(tc) tc.shape = ppc[0].shape d2=((np.tile(xc,(n,1)).T-np.tile(x,(nv,1)))**2+(np.tile(yc,(n,1)).T-np.tile(y,(nv,1)))**2) - R=np.exp(-lambd*d2)+bmo; + R=np.exp(-lambd*d2)+bmo P=np.zeros((nv,2*n)) # streamfunction-velocity covariance - P[:,0:n]=np.sin(tc)*np.sqrt(d2)*R; - P[:,n:2*n]=-np.cos(tc)*np.sqrt(d2)*R; + P[:,0:n]=np.sin(tc)*np.sqrt(d2)*R + P[:,n:2*n]=-np.cos(tc)*np.sqrt(d2)*R PSI=np.dot(P,np.linalg.solve(A,uv)) # solvi the linear system PSI=PSI.reshape(nv2,nv1).T @@ -163,7 +163,7 @@ def scaloa(xc, yc, x, y, t=[], corrlenx=None,corrleny=None, err=None, zc=None): # Gauss-Markov to get the weights that minimize the variance (OI). tp = None ep = 1 - np.sum(C.T * np.linalg.solve(A, C.T), axis=0) / (1 - err) - if any(t)==True: ##### was t!=None: + if any(t): ##### was t!=None: t = np.reshape(t, (n, 1)) tp = np.dot(C, np.linalg.solve(A, t)) #if 0: # NOTE: `scaloa2.m` @@ -174,7 +174,7 @@ def scaloa(xc, yc, x, y, t=[], corrlenx=None,corrleny=None, err=None, zc=None): # tp = tp + mD * np.ones(tp.shape) return tp, ep - if any(t)==False: ##### was t==None: + if not any(t): ##### was t==None: print("Computing just the interpolation errors.") #Normalized mean error. Taking the squared root you can get the #interpolation error in percentage. diff --git a/OceanLab/utils.py b/OceanLab/utils.py index 8e793a7..6b8c35b 100644 --- a/OceanLab/utils.py +++ b/OceanLab/utils.py @@ -2,8 +2,7 @@ import scipy.signal as sg import xarray as xr -import dask -from dask.distributed import Client, progress +from dask.distributed import Client ##### User functions #=============================================================================