Пример #1
0
 def setup(self):
     self.basic_setup()
     self.known_siteid = 'Test Site'
     self.known_general_tex_table = 'TestSite-2013-02-24-1659-1-General'
     self.known_hydro_tex_table = 'TestSite-2013-02-24-1659-2-Hydro'
     self.known_wq_tex_table = 'TestSite-2013-02-24-1659-3-WQComposite'
     self.known_storm_figure = 'TestSite-2013-02-24-1659-Composite'
     self.test_name = 'CompositeNoStorm'
     self.known_yfactor = 0.25
     self.known_starttime = '2013-02-24 16:59'
     self.known_endtime = '2013-02-25 02:59'
     self.known_season = 'winter'
     self.known_sample_ts_len = 31
     self.known_samplefreq = pandas.tseries.offsets.Minute(20)
     self.known_samplefreq_type = pandas.tseries.offsets.Minute
     self.known_marker = 'x'
     self.known_label = 'Composite Sample'
     self.known_wqtable = pandas.DataFrame({
         'Effluent EMC': {
             0: '786 ug/L', 1: '0.160 ug/L', 2: '8.60 ug/L', 3: '140 mg/L',
             4: '1,350 ug/L', 5: '6.13 ug/L', 6: '2.20 ug/L', 7: '1.40 mg/L',
             8: '1.50 mg/L', 9: '0.0520 mg/L', 10: '1.20 mg/L', 11: '0.500 mg/L',
             12: '0.130 mg/L', 13: '110 mg/L', 14: '43.4 ug/L'
         },
         'Detection Limit': {
             0: '0.500 ug/L', 1: '0.0100 ug/L', 2: '0.200 ug/L', 3: '1.00 mg/L',
             4: '5.00 ug/L', 5: '0.0500 ug/L', 6: '0.200 ug/L', 7: '0.100 mg/L',
             8: '0.100 mg/L', 9: '0.00200 mg/L', 10: '0.100 mg/L', 11: '0.500 mg/L',
             12: '0.100 mg/L', 13: '3.00 mg/L', 14: '0.500 ug/L'
         },
         'Effluent Load': {
             0: '40.6 g', 1: '0.00827 g', 2: '0.445 g', 3: '7,240 g',
             4: '69.8 g', 5: '0.317 g', 6: '0.114 g', 7: '72.4 g',
             8: '77.6 g', 9: '2.69 g', 10: '62.0 g', 11: '0.0259 g',
             12: '6.72 g', 13: '5,690 g', 14: '2.24 g'},
         'WQ Guideline': {
             0: '10.0 ug/L', 1: '10.0 ug/L', 2: '10.0 ug/L', 3: '10.0 mg/L',
             4: '10.0 ug/L', 5: '10.0 ug/L', 6: '10.0 ug/L', 7: '10.0 mg/L',
             8: '10.0 mg/L', 9: '10.0 mg/L', 10: '10.0 mg/L', 11: '10.0 mg/L',
             12: '10.0 mg/L', 13: '10.0 mg/L', 14: '10.0 ug/L'
         },
         'Parameter': {
             0: 'Aluminum (Al)', 1: 'Cadmium (Cd)', 2: 'Copper (Cu)', 3: 'Dissolved Chloride (Cl)',
             4: 'Iron (Fe)', 5: 'Lead (Pb)', 6: 'Nickel (Ni)', 7: 'Nitrate (N)',
             8: 'Nitrate + Nitrite', 9: 'Orthophosphate (P)', 10: 'Total Kjeldahl Nitrogen (TKN)', 11: 'Total Oil & Grease',
             12: 'Total Phosphorus', 13: 'Total Suspended Solids', 14: 'Zinc (Zn)'
         }
     })
     data = pandas.DataFrame({
         'concentration': {
             0: 786.0, 1: 0.16, 2: 8.60, 3: 140.0,
             4: 9000.0, 5: 1350.0, 6: 6.13, 7: 2.20,
             8: 1.40, 9: 1.5, 10: 0.052, 11: 1.2,
             12: 0.5, 13: 0.13, 14: 110.0, 15: 43.4
         },
         'detectionlimit': {
             0: 0.5, 1: 0.01, 2: 0.20, 3: 1.0,
             4: np.nan, 5: 5.0, 6: 0.05, 7: 0.2,
             8: 0.1, 9: 0.1, 10: 0.002, 11: 0.1,
             12: 0.5, 13: 0.1, 14: 3.0, 15: 0.5
         },
         'load_outflow': {
             0: 40.642016399999555, 1: 0.0082731839999999109,
             2: 0.44468363999999516, 3: 7239.0359999999218,
             4: 4653665999.9999495, 5: 69.80498999999925,
             6: 0.31696636199999656, 7: 0.11375627999999877,
             8: 72.390359999999205, 9: 77.561099999999158,
             10: 2.6887847999999708, 11: 62.048879999999322,
             12: 0.025853699999999719, 13: 6.7219619999999276,
             14: 5687.8139999999385, 15: 2.2441011599999756
         },
         'load_units': {
             0: 'g', 1: 'g', 2: 'g', 3: 'g',
             4: 'CFU', 5: 'g', 6: 'g', 7: 'g',
             8: 'g', 9: 'g', 10: 'g', 11: 'g',
             12: 'g', 13: 'g', 14: 'g', 15: 'g'
         },
         'parameter': {
             0: 'Aluminum (Al)', 1: 'Cadmium (Cd)',
             2: 'Copper (Cu)', 3: 'Dissolved Chloride (Cl)',
             4: 'Escherichia coli', 5: 'Iron (Fe)',
             6: 'Lead (Pb)', 7: 'Nickel (Ni)',
             8: 'Nitrate (N)', 9: 'Nitrate + Nitrite',
             10: 'Orthophosphate (P)', 11: 'Total Kjeldahl Nitrogen (TKN)',
             12: 'Total Oil & Grease', 13: 'Total Phosphorus',
             14: 'Total Suspended Solids', 15: 'Zinc (Zn)'
         },
         'units': {
             0: 'ug/L', 1: 'ug/L', 2: 'ug/L', 3: 'mg/L',
             4: 'CFU/100mL', 5: 'ug/L', 6: 'ug/L', 7: 'ug/L',
             8: 'mg/L', 9: 'mg/L', 10: 'mg/L', 11: 'mg/L',
             12: 'mg/L', 13: 'mg/L', 14: 'mg/L', 15: 'ug/L'
         }
     })
     self.wqs = samples.CompositeSample(data, self.known_starttime,
                                        endtime=self.known_endtime,
                                        samplefreq=self.known_samplefreq,
                                        storm=None)
     self.wqs.siteid = self.known_siteid
     self.wqs.label = self.known_label
     self.wqs.wqstd = (
         info.wqstd_template()
             .assign(upper_limit=10)
             .query("season == 'summer'")
     )
Пример #2
0
def test_wqstd_template():
    std = info.wqstd_template()
    nt.assert_list_equal(std.columns.tolist(), ['parameter', 'units', 'season', 'influent median'])
    expected_shape = (16*4, 4) #(POCs x seasons, cols)
    nt.assert_tuple_equal(std.shape, expected_shape)