def test_z0_vs_dmax(self): self.ambient = pyplume.Ambient(self.z_max, self.salinity, self.temperature, pressure=self.pressure) self.assertEqual(self.ambient.get_sal_z(0), self.ambient.get_sal_d(self.z_max))
def test_density_from_depth(self): self.ambient = pyplume.Ambient(self.z_max, self.salinity, self.temperature, depth=self.depth) self.assertEqual( self.ambient.rho.tolist(), gsw.rho(self.salinity, self.temperature, self.pressure).tolist())
def test_profile_interpolation(self): self.ambient = pyplume.Ambient(self.z_max, self.salinity, self.temperature, pressure=self.pressure) mid_rho = (self.ambient.rho[0] + self.ambient.rho[1]) / 2. mid_sal = (self.salinity[0] + self.salinity[1]) / 2. mid_temp = (self.temperature[0] + self.temperature[1]) / 2. mid_pressure = (self.pressure[0] + self.pressure[1]) / 2. mid_depth = mid_pressure / (1027. * 9.81 * 1.e-4) self.assertEqual(mid_sal, self.ambient.get_sal_d(mid_depth))
# Ambient T/S profile # load a csv containing columns for # z (depth - metres) # SA (Absolute Salinity - Kg/m3) # CT (Conservative temperature - C) # This one was generated using the script in the ctdtools repo here: # https://github.com/alistaireverett/ctdtools/blob/master/examples/proc_cnv_short.py amb_df = pd.read_csv('ambient.csv', ';') # create an ambient profile object from the temp/sal data ambient = pyplume.Ambient(h_w, amb_df['SA'], amb_df['CT'], depth=amb_df['depth']) # Load discharges # These are from a surface mass balance model, see Halbach et al. (submitted). # Contains the following columns: # Year, Month, Day, Hour, Discharge (m3/s) disch_data = pd.read_csv('kronebreen_runoff.csv', ';') def to_dt(x): """ Function to convert Y/M/D/H columns to python datetime object