def monthly_mean(df): '''Return DataFrame of monthly mean of the float data. These columns need to be in df: ['wmo', 'year', 'month'] ''' mdf = df.groupby(['wmo', 'year', 'month']).mean() mdf['o2sat'] = 100 * (mdf.DOXY_ADJUSTED / o2sat(mdf.PSAL_ADJUSTED, mdf.TEMP_ADJUSTED)) return mdf
def test_util_o2sat(self): # See http://www.engineeringtoolbox.com/oxygen-solubility-water-d_841.html self.assertAlmostEqual(utils.o2sat(35, 5), 308, places=0) self.assertAlmostEqual(utils.o2sat(35, 20), 225, places=0) self.assertAlmostEqual(utils.o2sat(35, 30), 190, places=0)