def okubo(u,v,pm,pn): ''' Compute the Okubo-Weiss parameter ''' Mp,Lp=pm.shape L=Lp-1 M=Mp-1 Lm=L-1 Mm=M-1 uom = 2.*u/(pm[:,:L]+pm[:,1:Lp]) uon = 2.*u/(pn[:,:L]+pn[:,1:Lp]) von = 2.*v/(pn[0:M,:]+pn[1:Mp,:]) vom = 2.*v/(pm[0:M,:]+pm[1:Mp,:]) mn=pm*pn mn_p=(mn[:M,:L]+mn[:M,1:Lp]+mn[1:Mp,1:Lp]+mn[1:Mp,:L])/4. # relative vorticity: xi=mn*rt.psi2rho(von[:,1:Lp]-von[:,:L]-uom[1:Mp,:]+uom[:M,:]) # Sigma_T: ST=mn*rt.psi2rho(von[:,1:Lp]-von[:,:L]+uom[1:Mp,:]-uom[:M,:]) # Sigma_N: SN=np.ma.zeros((Mp,Lp),u.dtype) SN[1:-1,1:-1]=mn[1:-1,1:-1]*(uon[1:-1,1:] -uon[1:-1,:-1] -vom[1:,1:-1] +vom[:-1,1:-1]) return SN**2+ST**2-xi**2
def okubo(u, v, pm, pn): ''' Compute the Okubo-Weiss parameter ''' Mp, Lp = pm.shape L = Lp - 1 M = Mp - 1 Lm = L - 1 Mm = M - 1 uom = 2. * u / (pm[:, :L] + pm[:, 1:Lp]) uon = 2. * u / (pn[:, :L] + pn[:, 1:Lp]) von = 2. * v / (pn[0:M, :] + pn[1:Mp, :]) vom = 2. * v / (pm[0:M, :] + pm[1:Mp, :]) mn = pm * pn mn_p = (mn[:M, :L] + mn[:M, 1:Lp] + mn[1:Mp, 1:Lp] + mn[1:Mp, :L]) / 4. # relative vorticity: xi = mn * rt.psi2rho(von[:, 1:Lp] - von[:, :L] - uom[1:Mp, :] + uom[:M, :]) # Sigma_T: ST = mn * rt.psi2rho(von[:, 1:Lp] - von[:, :L] + uom[1:Mp, :] - uom[:M, :]) # Sigma_N: SN = np.ma.zeros((Mp, Lp), u.dtype) SN[1:-1, 1:-1] = mn[1:-1, 1:-1] * (uon[1:-1, 1:] - uon[1:-1, :-1] - vom[1:, 1:-1] + vom[:-1, 1:-1]) return SN**2 + ST**2 - xi**2
def vorticity(u, v, pm, pn): ''' Compute the relative vorticity ''' Mp, Lp = pm.shape L = Lp - 1 M = Mp - 1 Lm = L - 1 Mm = M - 1 uom = 2. * u / (pm[:, :L] + pm[:, 1:Lp]) uon = 2. * u / (pn[:, :L] + pn[:, 1:Lp]) von = 2. * v / (pn[0:M, :] + pn[1:Mp, :]) vom = 2. * v / (pm[0:M, :] + pm[1:Mp, :]) mn = pm * pn mn_p = (mn[:M, :L] + mn[:M, 1:Lp] + mn[1:Mp, 1:Lp] + mn[1:Mp, :L]) / 4. # relative vorticity: xi = mn * rt.psi2rho(von[:, 1:Lp] - von[:, :L] - uom[1:Mp, :] + uom[:M, :]) return xi
def vorticity(u,v,pm,pn): ''' Compute the relative vorticity ''' Mp,Lp=pm.shape L=Lp-1 M=Mp-1 Lm=L-1 Mm=M-1 uom = 2.*u/(pm[:,:L]+pm[:,1:Lp]) uon = 2.*u/(pn[:,:L]+pn[:,1:Lp]) von = 2.*v/(pn[0:M,:]+pn[1:Mp,:]) vom = 2.*v/(pm[0:M,:]+pm[1:Mp,:]) mn=pm*pn mn_p=(mn[:M,:L]+mn[:M,1:Lp]+mn[1:Mp,1:Lp]+mn[1:Mp,:L])/4. # relative vorticity: xi=mn*rt.psi2rho(von[:,1:Lp]-von[:,:L]-uom[1:Mp,:]+uom[:M,:]) return xi