def barrier_layer_thickness(SA, CT): """ Compute the thickness of water separating the mixed surface layer from the thermocline. A more precise definition would be the difference between mixed layer depth (MLD) calculated from temperature minus the mixed layer depth calculated using density. """ sigma_theta = gsw.sigma0_CT_exact(SA, CT) mask = mixed_layer_depth(CT) mld = np.where(mask)[0][-1] sig_surface = sigma_theta[0] sig_bottom_mld = gsw.sigma0_CT_exact(SA[0], CT[mld]) d_sig_t = sig_surface - sig_bottom_mld d_sig = sigma_theta - sig_bottom_mld mask = d_sig < d_sig_t # Barrier layer. return Series(mask, index=SA.index, name='BLT')
def barrier_layer_thickness(SA, CT): """ Compute the thickness of water separating the mixed surface layer from the thermocline. A more precise definition would be the difference between mixed layer depth (MLD) calculated from temperature minus the mixed layer depth calculated using density. """ sigma_theta = gsw.sigma0_CT_exact(SA, CT) mask = mixed_layer_depth(CT) mld = np.where(mask)[0][-1] sig_surface = sigma_theta[0] sig_bottom_mld = gsw.sigma0_CT_exact(SA[0], CT[mld]) d_sig_t = sig_surface - sig_bottom_mld d_sig = sigma_theta - sig_bottom_mld mask = d_sig < d_sig_t # Barrier layer. return Series(mask, index=SA.index, name="BLT")
def derive_cnv(self): """Compute SP, SA, CT, z, and GP from a cnv pre-processed cast.""" cast = self.copy() # FIXME: Use MetaDataFrame to propagate lon, lat. p = cast.index.values.astype(float) cast["SP"] = gsw.SP_from_C(cast["c0S/m"] * 10.0, cast["t090C"], p) cast["SA"] = gsw.SA_from_SP(cast["SP"], p, self.lon, self.lat) cast["SR"] = gsw.SR_from_SP(cast["SP"]) cast["CT"] = gsw.CT_from_t(cast["SA"], cast["t090C"], p) cast["z"] = -gsw.z_from_p(p, self.lat) cast["sigma0_CT"] = gsw.sigma0_CT_exact(cast["SA"], cast["CT"]) return cast
def derive_cnv(self): """Compute SP, SA, CT, z, and GP from a cnv pre-processed cast.""" cast = self.copy() # FIXME: Use MetaDataFrame to propagate lon, lat. p = cast.index.values.astype(float) cast['SP'] = gsw.SP_from_C(cast['c0S/m'].values * 10., cast['t090C'].values, p) cast['SA'] = gsw.SA_from_SP(cast['SP'].values, p, self.lon, self.lat) cast['SR'] = gsw.SR_from_SP(cast['SP'].values) cast['CT'] = gsw.CT_from_t(cast['SA'].values, cast['t090C'].values, p) cast['z'] = -gsw.z_from_p(p, self.lat) cast['sigma0_CT'] = gsw.sigma0_CT_exact(cast['SA'].values, cast['CT'].values) return cast
def derive_ts(cast, sCol='sal00', pCol='Pressure [dbar]', tCol='t090C'): """ Function to add SA, CT, and sigma0 to a cast Parameters ---------- """ cast['SA'] = gsw.SA_from_SP(cast[sCol].values, cast[pCol].values, cast.longitude, cast.latitude) cast['CT'] = gsw.CT_from_t(cast[sCol].values, cast[tCol].values, cast[pCol].values) cast['sigma0_CT'] = gsw.sigma0_CT_exact(cast['SA'].values, cast['CT'].values) return cast