class Test_VSec(object): def setup(self): p1 = [45.00, 8.] p2 = [50.00, 12.] p3 = [51.00, 15.] p4 = [48.00, 11.] data = mss_wms_settings.data["ecmwf_EUR_LL015"] data.setup() self.path = [p1, p2, p3, p4] self.bbox = [3, 500, 3, 10] self.init_time = datetime(2012, 10, 17, 12) self.valid_time = datetime(2012, 10, 17, 12) self.vsec = VerticalSectionDriver(data) def plot(self, plot_object, style="default"): self.vsec.set_plot_parameters(plot_object=plot_object, bbox=self.bbox, vsec_path=self.path, vsec_numpoints=101, vsec_path_connection='greatcircle', init_time=self.init_time, valid_time=self.valid_time, style=style, noframe=False, show=False) return self.vsec.plot() def test_repeated_locations(self): p1 = [45.00, 8.] p2 = [50.00, 12.] self.path = [p1, p1] img = self.plot( mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None self.path = [p1, p1, p2] img = self.plot( mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None self.path = [p1, p2, p2] img = self.plot( mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None def test_VS_TemperatureStyle_01(self): img = self.plot( mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None def test_VS_GenericStyle(self): img = self.plot( mpl_vsec_styles.VS_GenericStyle_PL_mole_fraction_of_ozone_in_air( driver=self.vsec)) assert img is not None img = self.plot( mpl_vsec_styles.VS_GenericStyle_TL_mole_fraction_of_ozone_in_air( driver=self.vsec)) assert img is not None def test_VS_CloudsStyle_01(self): img = self.plot(mpl_vsec_styles.VS_CloudsStyle_01(driver=self.vsec)) assert img is not None def test_VS_CloudsWindStyle_01(self): img = self.plot( mpl_vsec_styles.VS_CloudsWindStyle_01(driver=self.vsec)) assert img is not None def test_VS_RelativeHumdityStyle_01(self): img = self.plot( mpl_vsec_styles.VS_RelativeHumdityStyle_01(driver=self.vsec)) assert img is not None def test_VS_SpecificHumdityStyle_01(self): img = self.plot( mpl_vsec_styles.VS_SpecificHumdityStyle_01(driver=self.vsec)) assert img is not None def test_VS_VerticalVelocityStyle_01(self): img = self.plot( mpl_vsec_styles.VS_VerticalVelocityStyle_01(driver=self.vsec)) assert img is not None def test_VS_HorizontalVelocityStyle_01(self): img = self.plot( mpl_vsec_styles.VS_HorizontalVelocityStyle_01(driver=self.vsec)) assert img is not None def test_VS_PotentialVorticityStyle_01(self): img = self.plot( mpl_vsec_styles.VS_PotentialVorticityStyle_01(driver=self.vsec)) assert img is not None def test_VS_ProbabilityOfWCBStyle_01(self): img = self.plot( mpl_vsec_styles.VS_ProbabilityOfWCBStyle_01(driver=self.vsec)) assert img is not None def test_VS_LagrantoTrajStyle_PL_01(self): pytest.skip("data not available") img = self.plot( mpl_vsec_styles.VS_LagrantoTrajStyle_PL_01(driver=self.vsec)) assert img is not None def test_VS_EMACEyja_Style_01(self): img = self.plot(mpl_vsec_styles.VS_EMACEyja_Style_01(driver=self.vsec)) assert img is not None
class Test_VSec(object): def setup(self): p1 = [45.00, 8.] p2 = [50.00, 12.] p3 = [51.00, 15.] p4 = [48.00, 11.] data = mss_wms_settings.data["ecmwf_EUR_LL015"] data.setup() self.path = [p1, p2, p3, p4] self.bbox = [3, 500, 3, 10] self.init_time = datetime(2012, 10, 17, 12) self.valid_time = datetime(2012, 10, 17, 12) self.vsec = VerticalSectionDriver(data) def plot(self, plot_object, style="default", noframe=False, transparent=False, draw_verticals=False, return_format="image/png"): self.vsec.set_plot_parameters(plot_object=plot_object, bbox=self.bbox, vsec_path=self.path, vsec_numpoints=101, vsec_path_connection='greatcircle', init_time=self.init_time, valid_time=self.valid_time, style=style, noframe=noframe, draw_verticals=draw_verticals, transparent=transparent, return_format=return_format, show=False) return self.vsec.plot() def test_repeated_locations(self): p1 = [45.00, 8.] p2 = [50.00, 12.] self.path = [p1, p1] img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None self.path = [p1, p1, p2] img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None self.path = [p1, p2, p2] img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None def test_VS_verticals(self): img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec), draw_verticals=True) assert img is not None assert not is_image_transparent(img) def test_VS_transparent(self): img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec), transparent=True) assert img is not None assert is_image_transparent(img) def test_xml(self): img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec), return_format="text/xml") assert img is not None ElementTree.fromstring(img) def test_VS_TemperatureStyle_01(self): img = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_TemperatureStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_GenericStyle(self): img = self.plot(mpl_vsec_styles.VS_GenericStyle_PL_mole_fraction_of_ozone_in_air(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_GenericStyle_PL_mole_fraction_of_ozone_in_air(driver=self.vsec), noframe=True) assert noframe != img img = self.plot(mpl_vsec_styles.VS_GenericStyle_TL_mole_fraction_of_ozone_in_air(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_GenericStyle_TL_mole_fraction_of_ozone_in_air(driver=self.vsec), noframe=True) assert noframe != img def test_VS_CloudsStyle_01(self): img = self.plot(mpl_vsec_styles.VS_CloudsStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_CloudsStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_CloudsWindStyle_01(self): img = self.plot(mpl_vsec_styles.VS_CloudsWindStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_CloudsWindStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_RelativeHumdityStyle_01(self): img = self.plot(mpl_vsec_styles.VS_RelativeHumdityStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_RelativeHumdityStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_SpecificHumdityStyle_01(self): img = self.plot(mpl_vsec_styles.VS_SpecificHumdityStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_SpecificHumdityStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_VerticalVelocityStyle_01(self): img = self.plot(mpl_vsec_styles.VS_VerticalVelocityStyle_01(driver=self.vsec)) assert img is not None def test_VS_HorizontalVelocityStyle_01(self): img = self.plot(mpl_vsec_styles.VS_HorizontalVelocityStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_HorizontalVelocityStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_PotentialVorticityStyle_01(self): img = self.plot(mpl_vsec_styles.VS_PotentialVorticityStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_PotentialVorticityStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_ProbabilityOfWCBStyle_01(self): img = self.plot(mpl_vsec_styles.VS_ProbabilityOfWCBStyle_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_ProbabilityOfWCBStyle_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_LagrantoTrajStyle_PL_01(self): pytest.skip("data not available") img = self.plot(mpl_vsec_styles.VS_LagrantoTrajStyle_PL_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_LagrantoTrajStyle_PL_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_EMACEyja_Style_01(self): img = self.plot(mpl_vsec_styles.VS_EMACEyja_Style_01(driver=self.vsec)) assert img is not None noframe = self.plot(mpl_vsec_styles.VS_EMACEyja_Style_01(driver=self.vsec), noframe=True) assert noframe != img def test_VS_gallery_template(self): templates_location = os.path.join(mslib.mswms.gallery_builder.DOCS_LOCATION, "plot_examples") sys.path.append(templates_location) from VS_template import VS_Template img = self.plot(VS_Template(driver=self.vsec)) assert img is not None