def _handlePrecip24hrRemark(self, d): """ Parse a 3-, 6- or 24-hour cumulative preciptation remark group. """ value = float(d["precip"]) / 100.0 if d["type"] == "6": if self.cycle in [3, 9, 15, 21]: self.precip_3hr = precipitation(value, "IN") else: self.precip_6hr = precipitation(value, "IN") else: self.precip_24hr = precipitation(value, "IN")
def _handlePrecip24hrRemark( self, d ): """ Parse a 3-, 6- or 24-hour cumulative preciptation remark group. """ value = float(d['precip'])/100.0 if d['type'] == "6": if self.cycle == 3 or self.cycle == 9 or self.cycle == 15 or self.cycle == 21: self.precip_3hr = precipitation(value,"IN") else: self.precip_6hr = precipitation(value,"IN") else: self.precip_24hr = precipitation(value,"IN")
def _handlePrecip24hrRemark(self, d): """ Parse a 3-, 6- or 24-hour cumulative preciptation remark group. """ value = float(d['precip']) / 100.0 if d['type'] == "6": if self.cycle == 3 or self.cycle == 9 or self.cycle == 15 or self.cycle == 21: self.precip_3hr = precipitation(value, "IN") else: self.precip_6hr = precipitation(value, "IN") else: self.precip_24hr = precipitation(value, "IN")
def _handleIceAccretionRemark(self, d): """ Parse the I/ group ice accretion report. """ myattr = "ice_accretion_%shr" % (d["ice_accretion_hours"], ) value = precipitation(float(d["ice_accretion_depth"]) / 100.0, "IN") setattr(self, myattr, value)
def _handleIceAccretionRemark(self, d): """ Parse the I/ group ice accretion report. """ myattr = "ice_accretion_%shr" % (d['ice_accretion_hours'], ) value = precipitation(float(d['ice_accretion_depth']) / 100., 'IN') setattr(self, myattr, value)
def _handlePrecip1hrRemark(self, d): """Parse an hourly precipitation remark group.""" value = float(d["precip"]) / 100.0 self.precip_1hr = precipitation(value, "IN")
def test_trace(self): """How do we handle trace reports""" self.assertEqual( precipitation("0000", "IN").string(), "Trace" ) self.assertTrue( precipitation("0000", "IN").istrace() ) self.assertFalse( precipitation("0010", "IN").istrace() )
def _handlePrecip1hrRemark( self, d ): """Parse an hourly precipitation remark group.""" value = float(d['precip'])/100.0 self.precip_1hr = precipitation(value,"IN")
def test_trace(): """How do we handle trace reports""" assert precipitation("0000", "IN").string() == "Trace" assert precipitation("0000", "IN").istrace() assert not precipitation("0010", "IN").istrace()