def sigma_t(s, t, p): r""" :math:`\\sigma_{t}` is the remainder of subtracting 1000 kg m :sup:`-3` from the density of a sea water sample at atmospheric pressure. Parameters ---------- s(p) : array_like salinity [psu (PSS-78)] t(p) : array_like temperature [:math:`^\\circ` C (ITS-90)] p : array_like pressure [db]. The shape can be "broadcasted" Returns ------- sgmt : array_like density [kg m :sup:`3`] See Also -------- dens, sigmatheta Notes ----- Density of Sea Water using UNESCO 1983 (EOS 80) polynomial. Examples -------- Data from Unesco Tech. Paper in Marine Sci. No. 44, p22 >>> import seawater.csiro as sw >>> import seawater.extras.sw_extras as swe >>> s = [0, 0, 0, 0, 35, 35, 35, 35] >>> t = sw.T90conv([0, 0, 30, 30, 0, 0, 30, 30]) >>> p = [0, 10000, 0, 10000, 0, 10000, 0, 10000] >>> swe.sigma_t(s, t, p) array([ -0.157406 , 45.33710972, -4.34886626, 36.03148891, 28.10633141, 70.95838408, 21.72863949, 60.55058771]) References ---------- .. [1] Fofonoff, P. and Millard, R.C. Jr UNESCO 1983. Algorithms for computation of fundamental properties of seawater. UNESCO Tech. Pap. in Mar. Sci., No. 44, 53 pp. Eqn.(31) p.39. http://www.scor-int.org/Publications.htm .. [2] Millero, F.J., Chen, C.T., Bradshaw, A., and Schleicher, K. A new high pressure equation of state for seawater. Deap-Sea Research., 1980, Vol27A, pp255-264. doi:10.1016/0198-0149(80)90016-3 Modifications: Filipe Fernandes, 2010 10-01-26. Filipe Fernandes, first version. """ # Convert input to numpy arrays s, t, p = np.asarray(s), np.asarray(t), np.asarray(p) sgmt = sw.dens(s, t, p) - 1000.0 return sgmt
def visc(s, t, p): r""" Calculates kinematic viscosity of sea-water. Parameters ---------- s(p) : array_like salinity [psu (PSS-78)] t(p) : array_like temperature [:math:`^\\circ` C (ITS-90)] p : array_like pressure [db]. The shape can be "broadcasted" Returns ------- visw : array_like [m :sup: `2` s :sup: `-1`] See Also -------- visc_air from airsea toolbox Notes ----- From matlab airsea Examples -------- >>> import seawater.extras.sw_extras as swe >>> swe.visc(40, 40, 1000) 8.2001924966338036e-07 References ---------- .. [1] Dan Kelley's fit to Knauss's TABLE II-8. Modifications: Original 1998/01/19 - Ayal Anis 1998 2010/11/25. Filipe Fernandes, python translation. """ # Convert input to numpy arrays s, t, p = np.asarray(s), np.asarray(t), np.asarray(p) viscw = 1e-4 * (17.91 - 0.5381 * t + 0.00694 * t**2 + 0.02305*s ) / sw.dens(s, t, p); return viscw
max_abs_pressure = m m_ind = [i for i, j in enumerate(data['pressure']) if j ==m] # this line finds the index of the max depth #this loop here will take the readings only when the fish is going down for j in names: vars()[j] = [] for i in np.arange(1,float(m_ind[0])): if data['pressure'][i]-data['pressure'][i-1] >0: vars()[j].append(data[str(j)][i]) depth = sw.depth(pressure, xyzt['lat_DD.dd']) c3515 = 42.9140 condr = [x/c3515 for x in cond] salinity = sw.salt(condr, temp, pressure) density = sw.dens(salinity, temp,pressure) griddeddata=[] for k in names2: griddeddata = np.interp(grid_depth,depth,vars()[k],right=np.NaN) griddeddata = griddeddata[0:] vars()['grid_'+k][:,file[0]] = vars()['griddeddata'] f.close() except: failedloadfiles.append(str(file)) print ("Could not process " + file[1]) for k in names2: vars()['grid_'+k][:,file[0]] = np.NaN
return Bu ################################################################################ filename = "/home/rsoutelino/phd/fm/BC-NBUC_FM.mat" fm = FeatureModel(filename) depth = np.arange(0, 1520, 20) # getting the rho profile in the core of the jets at 19 S lon0, lat0 = -37.411, -19.015 # as result from a ginput line, col = near2d(fm.lon, fm.lat, lon0, lat0) temp = fm.temp[:, line, col] salt = fm.salt[:, line, col] rho = sw.dens(salt, temp, depth) N2 = brunt_vaissala(rho, depth) H = depth.max() f = sw.cor(lat0) R = 100000 # abrolhos bank: ~100km Bu = burger(N2, H, f, R) #plt.figure() #plt.plot(Bu, -depth) #plt.grid() #plt.title("Burger Number Profile") #plt.show() fBC = near(depth, 200)[0][0] BuBC = Bu[:fBC].mean() BuNBUC = Bu[fBC:].mean()