• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.get_output_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.utils.helpers.get_output_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_output_path函数的具体用法?Python get_output_path怎么用?Python get_output_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_output_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_writes_the_config_only_once

    def test_writes_the_config_only_once(self):
        data = [(shapes.Site(-122.5000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_1",
                "IMLValues": [5.0, 6.0, 7.0],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [0.1, 0.2, 0.3]}),
                (shapes.Site(-122.4000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_2",
                "IMLValues": [5.0, 6.0, 7.0],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [0.4, 0.5, 0.6]})]

        path = helpers.get_output_path(TEST_FILE_CONFIG_ONCE)
        self._initialize_writer(path)

        self.writer.serialize(data)
        self.assertTrue(xml.validates_against_xml_schema(path))
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:25,代码来源:hazard_nrml_test.py


示例2: _test_hazard_map_relative_scaling

        def _test_hazard_map_relative_scaling(region, hm_data):
            path = helpers.get_output_path(
                'TEST_HAZARD_MAP_relative_scaling.tiff')

            # expected colors for each pixel in the map:
            exp_red_vals = numpy.array([
                [49, 186, 255, 138, 186, 24],
                [0, 208, 67, 0, 255, 24],
                [143, 255, 123, 186, 143, 0],
                [186, 0, 255, 186, 238, 143],
                [255, 186, 0, 186, 12, 205],
                [255, 143, 208, 238, 97, 0]])
            exp_green_vals = numpy.array([
                [190, 197, 255, 236, 197, 175],
                [39, 216, 202, 39, 255, 175],
                [161, 255, 235, 197, 161, 39],
                [197, 39, 255, 197, 79, 161],
                [255, 197, 39, 197, 129, 255],
                [255, 161, 216, 79, 122, 39]])
            exp_blue_vals = numpy.array([
                [255, 247, 255, 174, 247, 255],
                [224, 251, 255, 224, 255, 255],
                [241, 255, 200, 247, 241, 224],
                [247, 224, 255, 247, 77, 241],
                [255, 247, 224, 247, 248, 162],
                [255, 241, 251, 77, 236, 224]])

            hm_writer = geotiff.HazardMapGeoTiffFile(
                path, small_region.grid, html_wrapper=True)

            hm_writer.serialize(hm_data)

            self._assert_image_rgb_is_correct(
                path, exp_red_vals, exp_green_vals, exp_blue_vals)
开发者ID:danciul,项目名称:openquake,代码行数:34,代码来源:output_unittest.py


示例3: test_loss_serialization_with_inconsistent_site_fails

 def test_loss_serialization_with_inconsistent_site_fails(self):
     """Assert that serialization of illegal loss curve data
     raises error."""
     xml_writer = risk_output.LossCurveXMLWriter(
         helpers.get_output_path(LOSS_XML_FAIL_OUTPUT_FILE))
     self.assertRaises(ValueError, xml_writer.serialize,
         self.loss_curves_fail)
开发者ID:favalex,项目名称:openquake,代码行数:7,代码来源:loss_output_unittest.py


示例4: test_writes_a_single_result

    def test_writes_a_single_result(self):
        data = [(shapes.Site(-122.5000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_1",
                "IMLValues": [5.0000e-03, 7.0000e-03, 1.3700e-02,
                1.9200e-02, 2.6900e-02, 3.7600e-02, 5.2700e-02,
                7.3800e-02, 9.8000e-02, 1.0300e-01, 1.4500e-01,
                2.0300e-01, 2.8400e-01, 3.9700e-01, 5.5600e-01,
                7.7800e-01, 1.0900e+00, 1.5200e+00, 2.1300e+00],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [9.8728e-01, 9.8266e-01, 9.4957e-01,
                9.0326e-01, 8.1956e-01, 6.9192e-01, 5.2866e-01,
                3.6143e-01, 2.4231e-01, 2.2452e-01, 1.2831e-01,
                7.0352e-02, 3.6060e-02, 1.6579e-02, 6.4213e-03,
                2.0244e-03, 4.8605e-04, 8.1752e-05, 7.3425e-06]})]

        path = helpers.get_output_path(TEST_FILE_SINGLE_RESULT)

        self._initialize_writer(path)
        self.writer.serialize(data)

        self.assertTrue(xml.validates_against_xml_schema(path))
        self.assertTrue(XML_METADATA in self._result_as_string(path))

        self.read_curves = self._read_curves(
                (-123.0, 38.0), (-122.0, 35.0),
                TEST_FILE_SINGLE_RESULT)

        self._assert_number_of_curves_is(1)
        self._assert_curves_are(data)
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:33,代码来源:hazard_nrml_test.py


示例5: _read_curves

    def _read_curves(self, upper_left_cor, lower_right_cor, test_file):
        constraint = shapes.RegionConstraint.from_simple(
                upper_left_cor, lower_right_cor)

        reader = hazard_parser.NrmlFile(
                helpers.get_output_path(test_file))

        return reader.filter(constraint)
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:8,代码来源:hazard_nrml_test.py


示例6: test_geotiff_generation_and_metadata_validation

    def test_geotiff_generation_and_metadata_validation(self):
        """Create a GeoTIFF, and check if it has the correct metadata."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_WITHOUT_NUMBER)
        smallregion = shapes.Region.from_coordinates(TEST_REGION_SMALL)
        gwriter = geotiff.LossMapGeoTiffFile(
            path, smallregion.grid, normalize=False)
        gwriter.close()

        self._assert_geotiff_metadata_is_correct(path, smallregion)
开发者ID:kpanic,项目名称:openquake,代码行数:9,代码来源:output_unittest.py


示例7: setUp

    def setUp(self):
        self.loss_curve_path = helpers.get_output_path(LOSS_XML_OUTPUT_FILE)
        self.loss_ratio_curve_path = helpers.get_output_path(
            LOSS_RATIO_XML_OUTPUT_FILE)

        self.single_loss_curve_path = helpers.get_output_path(
            SINGLE_LOSS_XML_OUTPUT_FILE)
        self.single_loss_ratio_curve_path = helpers.get_output_path(
            SINGLE_LOSS_RATIO_XML_OUTPUT_FILE)

        self.schema_path = NRML_SCHEMA_PATH

        # Build up some sample loss/loss ratio curves here
        first_site = shapes.Site(-117.0, 38.0)
        second_site = shapes.Site(-118.0, 39.0)

        first_asset_a = {"assetID": "a1711", "endBranchLabel": "A"}
        first_asset_b = {"assetID": "a1711", "endBranchLabel": "B"}
        second_asset_a = {"assetID": "a1712", "endBranchLabel": "A"}
        second_asset_b = {"assetID": "a1712", "endBranchLabel": "B"}

        self.loss_curves = [
            (first_site, (TEST_LOSS_CURVE, first_asset_a)),
            (first_site, (TEST_LOSS_CURVE, first_asset_b)),
            (second_site, (TEST_LOSS_CURVE, second_asset_a)),
            (second_site, (TEST_LOSS_CURVE, second_asset_b))]

        self.loss_ratio_curves = [
            (first_site, (TEST_LOSS_RATIO_CURVE, first_asset_a)),
            (first_site, (TEST_LOSS_RATIO_CURVE, first_asset_b)),
            (second_site, (TEST_LOSS_RATIO_CURVE, second_asset_a)),
            (second_site, (TEST_LOSS_RATIO_CURVE, second_asset_b))]

        self.single_loss_curve = [
            (first_site, (TEST_LOSS_CURVE, first_asset_a))]

        self.single_loss_ratio_curve = [
            (first_site, (TEST_LOSS_RATIO_CURVE, first_asset_a))]

        # loss curve that fails with inconsistent sites for an asset
        self.loss_curves_fail = [
            (first_site, (TEST_LOSS_CURVE, first_asset_a)),
            (second_site, (TEST_LOSS_CURVE, first_asset_a))]
开发者ID:favalex,项目名称:openquake,代码行数:43,代码来源:loss_output_unittest.py


示例8: test_lossmap_geotiff_generation_with_number_in_filename

    def test_lossmap_geotiff_generation_with_number_in_filename(self):
        """Create a GeoTIFF with a number in its filename. This
        test has been written because it has been reported that numbers in the
        filename do not work."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_WITH_NUMBER)
        smallregion = shapes.Region.from_coordinates(TEST_REGION_SMALL)
        gwriter = geotiff.LossMapGeoTiffFile(
            path, smallregion.grid, normalize=False)
        gwriter.close()

        self._assert_geotiff_metadata_is_correct(path, smallregion)
开发者ID:danciul,项目名称:openquake,代码行数:11,代码来源:output_unittest.py


示例9: test_serializes_gmf

    def test_serializes_gmf(self):
        path = helpers.get_output_path(GMF_NORUPTURE_TEST_FILE)
        writer = hazard_output.GMFXMLWriter(path)
        writer.serialize(GMF_NORUPTURE_TEST_DATA)

        check_data = {}
        reader = hazard_parser.GMFReader(path)
        for curr_site, curr_attribute in reader:
            check_data[curr_site] = curr_attribute

        self.assertEqual(check_data, GMF_NORUPTURE_TEST_DATA)
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:11,代码来源:hazard_nrml_test.py


示例10: test_writes_multiple_results_with_statistics

    def test_writes_multiple_results_with_statistics(self):
        data = [(shapes.Site(-122.5000, 37.5000),
                {"nrml_id": "nrml_instance_1",
                "hazres_id": "hazard_result_0001",
                "hcfield_id": "hazard_field_one",
                "hcnode_id": "the_hazard_node_1000",
                "IDmodel": "foo",
                "investigationTimeSpan": 50.0,
                "statistics": "quantile",
                "quantileValue": "0.5",
                "IMLValues": [5.0000e-03, 7.0000e-03, 1.3700e-02,
                1.9200e-02, 2.6900e-02, 3.7600e-02, 5.2700e-02,
                7.3800e-02, 9.8000e-02, 1.0300e-01, 1.4500e-01,
                2.0300e-01, 2.8400e-01, 3.9700e-01, 5.5600e-01,
                7.7800e-01, 1.0900e+00, 1.5200e+00, 2.1300e+00],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [9.8728e-01, 9.8266e-01, 9.4957e-01,
                9.0326e-01, 8.1956e-01, 6.9192e-01, 5.2866e-01,
                3.6143e-01, 2.4231e-01, 2.2452e-01, 1.2831e-01,
                7.0352e-02, 3.6060e-02, 1.6579e-02, 6.4213e-03,
                2.0244e-03, 4.8605e-04, 8.1752e-05, 7.3425e-06]}),
                (shapes.Site(-122.4000, 37.5000),
                {"IDmodel": "foo",
                "investigationTimeSpan": 50.0,
                "statistics": "quantile",
                "quantileValue": "0.5",
                "IMLValues": [5.0000e-03, 7.0000e-03, 1.3700e-02,
                1.9200e-02, 2.6900e-02, 3.7600e-02, 5.2700e-02,
                7.3800e-02, 9.8000e-02, 1.0300e-01, 1.4500e-01,
                2.0300e-01, 2.8400e-01, 3.9700e-01, 5.5600e-01,
                7.7800e-01, 1.0900e+00, 1.5200e+00, 2.1300e+00],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [9.8784e-01, 9.8405e-01, 9.5719e-01,
                9.1955e-01, 8.5019e-01, 7.4038e-01, 5.9153e-01,
                4.2626e-01, 2.9755e-01, 2.7731e-01, 1.6218e-01,
                8.8035e-02, 4.3499e-02, 1.9065e-02, 7.0442e-03,
                2.1300e-03, 4.9498e-04, 8.1768e-05, 7.3425e-06]})]

        path = helpers.get_output_path(TEST_FILE_STATISTICS)
        self._initialize_writer(path)

        self.writer.serialize(data)
        self._is_xml_valid(path)

        self.readed_curves = self._read_curves(
                (-123.0, 38.0), (-120.0, 35.0),
                TEST_FILE_STATISTICS)

        self._assert_number_of_curves_is(2)
        self._assert_curves_are(data)
开发者ID:danciul,项目名称:openquake,代码行数:54,代码来源:hazard_nrml_unittest.py


示例11: test_geotiff_generation_colorscale

    def test_geotiff_generation_colorscale(self):
        """Check RGB geotiff generation with colorscale for GMF."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_COLORSCALE)
        asymmetric_region = shapes.Region.from_coordinates(
            TEST_REGION_LARGE_ASYMMETRIC)
        gwriter = geotiff.GMFGeoTiffFile(path, asymmetric_region.grid,
            discrete=False)

        reference_raster = numpy.zeros((asymmetric_region.grid.rows,
                                        asymmetric_region.grid.columns),
                                        dtype=numpy.float)
        self._fill_rasters(asymmetric_region, gwriter, reference_raster,
            self._colorscale_fill)
        gwriter.close()
开发者ID:danciul,项目名称:openquake,代码行数:14,代码来源:output_unittest.py


示例12: setUp

    def setUp(self):
        self.loss_curve_path = helpers.get_output_path(LOSS_XML_OUTPUT_FILE)
        self.loss_ratio_curve_path = helpers.get_output_path(
            LOSS_RATIO_XML_OUTPUT_FILE)

        self.single_loss_curve_path = helpers.get_output_path(
            SINGLE_LOSS_XML_OUTPUT_FILE)
        self.single_loss_ratio_curve_path = helpers.get_output_path(
            SINGLE_LOSS_RATIO_XML_OUTPUT_FILE)

        self.schema_path = NRML_SCHEMA_PATH

        # Build up some sample loss/loss ratio curves here
        first_site = shapes.Site(-117.0, 38.0)
        second_site = shapes.Site(-118.0, 39.0)

        first_asset = models.ExposureData(asset_ref='a1711')
        second_asset = models.ExposureData(asset_ref='a1712')

        self.loss_curves = [
            (first_site, (TEST_LOSS_CURVE, first_asset)),
            (second_site, (TEST_LOSS_CURVE, second_asset))]

        self.loss_ratio_curves = [
            (first_site, (TEST_LOSS_RATIO_CURVE, first_asset)),
            (second_site, (TEST_LOSS_RATIO_CURVE, second_asset))]

        self.single_loss_curve = [
            (first_site, (TEST_LOSS_CURVE, first_asset))]

        self.single_loss_ratio_curve = [
            (first_site, (TEST_LOSS_RATIO_CURVE, first_asset))]

        # loss curve that fails with inconsistent sites for an asset
        self.loss_curves_fail = [
            (first_site, (TEST_LOSS_CURVE, first_asset)),
            (second_site, (TEST_LOSS_CURVE, first_asset))]
开发者ID:leoalvar,项目名称:oq-engine,代码行数:37,代码来源:loss_output_unittest.py


示例13: test_writes_multiple_results_with_one_branch_level

    def test_writes_multiple_results_with_one_branch_level(self):
        data = [(shapes.Site(-122.5000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_1",
                "IMLValues": [5.0000e-03, 7.0000e-03, 1.3700e-02,
                1.9200e-02, 2.6900e-02, 3.7600e-02, 5.2700e-02,
                7.3800e-02, 9.8000e-02, 1.0300e-01, 1.4500e-01,
                2.0300e-01, 2.8400e-01, 3.9700e-01, 5.5600e-01,
                7.7800e-01, 1.0900e+00, 1.5200e+00, 2.1300e+00],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [9.8728e-01, 9.8266e-01, 9.4957e-01,
                9.0326e-01, 8.1956e-01, 6.9192e-01, 5.2866e-01,
                3.6143e-01, 2.4231e-01, 2.2452e-01, 1.2831e-01,
                7.0352e-02, 3.6060e-02, 1.6579e-02, 6.4213e-03,
                2.0244e-03, 4.8605e-04, 8.1752e-05, 7.3425e-06]}),
                (shapes.Site(-122.4000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_1",
                "IMLValues": [5.0000e-03, 7.0000e-03, 1.3700e-02,
                1.9200e-02, 2.6900e-02, 3.7600e-02, 5.2700e-02,
                7.3800e-02, 9.8000e-02, 1.0300e-01, 1.4500e-01,
                2.0300e-01, 2.8400e-01, 3.9700e-01, 5.5600e-01,
                7.7800e-01, 1.0900e+00, 1.5200e+00, 2.1300e+00],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [9.8784e-01, 9.8405e-01, 9.5719e-01,
                9.1955e-01, 8.5019e-01, 7.4038e-01, 5.9153e-01,
                4.2626e-01, 2.9755e-01, 2.7731e-01, 1.6218e-01,
                8.8035e-02, 4.3499e-02, 1.9065e-02, 7.0442e-03,
                2.1300e-03, 4.9498e-04, 8.1768e-05, 7.3425e-06]})]

        path = helpers.get_output_path(TEST_FILE_MULTIPLE_ONE_BRANCH)
        self._initialize_writer(path)
        self.writer.serialize(data)

        self.assertTrue(xml.validates_against_xml_schema(path))

        self.read_curves = self._read_curves(
                (-123.0, 38.0), (-120.0, 35.0),
                TEST_FILE_MULTIPLE_ONE_BRANCH)

        self._assert_number_of_curves_is(2)
        self._assert_curves_are(data)
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:48,代码来源:hazard_nrml_test.py


示例14: test_geotiff_generation_discrete_colorscale

    def test_geotiff_generation_discrete_colorscale(self):
        """Check RGB geotiff generation with colorscale for GMF. Use
        discrete colorscale based on IML values, with default IML."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_DISCRETE_COLORSCALE)
        asymmetric_region = shapes.Region.from_coordinates(
            TEST_REGION_LARGE_ASYMMETRIC)

        gwriter = geotiff.GMFGeoTiffFile(path, asymmetric_region.grid,
            iml_list=None, discrete=True, colormap=geotiff.COLORMAPS['gmt-seis'])

        reference_raster = numpy.zeros((asymmetric_region.grid.rows,
                                        asymmetric_region.grid.columns),
                                       dtype=numpy.float)
        self._fill_rasters(asymmetric_region, gwriter, reference_raster,
            self._colorscale_cuts_fill)
        gwriter.close()
开发者ID:danciul,项目名称:openquake,代码行数:16,代码来源:output_unittest.py


示例15: test_geotiff_generation_nondefault_colorscale

    def test_geotiff_generation_nondefault_colorscale(self):
        """Check RGB geotiff generation with colorscale for GMF. Use
        alternative colorscale."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_NONDEFAULT_COLORSCALE)
        asymmetric_region = shapes.Region.from_coordinates(
            TEST_REGION_LARGE_ASYMMETRIC)

        gwriter = geotiff.GMFGeoTiffFile(path, asymmetric_region.grid,
            iml_list=None, discrete=False, colormap=geotiff.COLORMAPS['gmt-green-red'])

        reference_raster = numpy.zeros((asymmetric_region.grid.rows,
                                        asymmetric_region.grid.columns),
                                       dtype=numpy.float)
        self._fill_rasters(asymmetric_region, gwriter, reference_raster,
            self._colorscale_cuts_fill)
        gwriter.close()
开发者ID:danciul,项目名称:openquake,代码行数:16,代码来源:output_unittest.py


示例16: test_geotiff_generation_and_simple_raster_validation

    def test_geotiff_generation_and_simple_raster_validation(self):
        """Create a GeoTIFF and assign values to the raster nodes according
        to a simple function. Then check if the raster values have been set
        correctly."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_SQUARE_REGION)
        squareregion = shapes.Region.from_coordinates(TEST_REGION_SQUARE)
        gwriter = geotiff.LossMapGeoTiffFile(
            path, squareregion.grid, normalize=False)

        reference_raster = numpy.zeros((squareregion.grid.rows,
                                        squareregion.grid.columns),
                                        dtype=numpy.float)
        self._fill_rasters(squareregion, gwriter, reference_raster,
            self._trivial_fill)
        gwriter.close()

        self._assert_geotiff_metadata_and_raster_is_correct(path,
            squareregion, GEOTIFF_USED_CHANNEL_IDX, reference_raster)
开发者ID:danciul,项目名称:openquake,代码行数:18,代码来源:output_unittest.py


示例17: test_geotiff_loss_ratio_map_colorscale

    def test_geotiff_loss_ratio_map_colorscale(self):
        path = helpers.get_output_path(GEOTIFF_LOSS_RATIO_MAP_COLORSCALE)
        asymmetric_region = shapes.Region.from_coordinates(
            TEST_REGION_LARGE_ASYMMETRIC)

        gwriter = geotiff.LossMapGeoTiffFile(
            path, asymmetric_region.grid, pixel_type=gdal.GDT_Byte)
        reference_raster = numpy.zeros((asymmetric_region.grid.rows,
                                        asymmetric_region.grid.columns),
                                        dtype=numpy.float)

        color_fill = lambda x, y:  (x * y) / 50
        self._fill_rasters(asymmetric_region, gwriter, reference_raster,
            color_fill)
        gwriter.close()

        self._assert_geotiff_metadata_is_correct(path, asymmetric_region)
        self._assert_geotiff_band_min_max_values(path,
            GEOTIFF_USED_CHANNEL_IDX, 0, 240)
开发者ID:danciul,项目名称:openquake,代码行数:19,代码来源:output_unittest.py


示例18: test_writes_multiple_results_with_different_branch_levels

    def test_writes_multiple_results_with_different_branch_levels(self):
        data = [(shapes.Site(-122.5000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_1",
                "IMLValues": [5.0, 6.0, 7.0],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [0.1, 0.2, 0.3]}),
                (shapes.Site(-122.5000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_2",
                "IMLValues": [5.0, 6.0, 7.0],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [0.1, 0.2, 0.3]}),
                (shapes.Site(-122.4000, 37.5000),
                {"IDmodel": "MMI_3_1",
                "investigationTimeSpan": 50.0,
                "endBranchLabel": "3_2",
                "IMLValues": [8.0, 9.0, 10.0],
                "saPeriod": 0.1,
                "saDamping": 1.0,
                "IMT": "PGA",
                "PoEValues": [0.1, 0.2, 0.3]})]

        path = helpers.get_output_path(
                TEST_FILE_MULTIPLE_DIFFERENT_BRANCHES)

        self._initialize_writer(path)
        self.writer.serialize(data)

        self.assertTrue(xml.validates_against_xml_schema(path))

        self.read_curves = self._read_curves(
                (-123.0, 38.0), (-120.0, 35.0),
                TEST_FILE_MULTIPLE_DIFFERENT_BRANCHES)

        self._assert_number_of_curves_is(3)
        self._assert_curves_are(data)
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:43,代码来源:hazard_nrml_test.py


示例19: test_lossmap_geotiff_generation_initialize_raster

    def test_lossmap_geotiff_generation_initialize_raster(self):
        """Create a GeoTIFF and initialize the raster to a given value. Then
        check through metadata if it has been done correctly. We check the
        minumum and maximum values of the band, which are expected to have
        the value of the raster nodes."""
        path = helpers.get_output_path(GEOTIFF_FILENAME_WITH_NUMBER)
        smallregion = shapes.Region.from_coordinates(TEST_REGION_SMALL)
        gwriter = geotiff.LossMapGeoTiffFile(
            path, smallregion.grid, init_value=GEOTIFF_TEST_PIXEL_VALUE,
            pixel_type=gdal.GDT_Byte, normalize=False)
        gwriter.close()

        self._assert_geotiff_metadata_is_correct(path, smallregion)

        # assert that all raster pixels have the desired value
        self._assert_geotiff_band_min_max_values(path,
            GEOTIFF_USED_CHANNEL_IDX,
            GEOTIFF_TEST_PIXEL_VALUE,
            GEOTIFF_TEST_PIXEL_VALUE)
开发者ID:danciul,项目名称:openquake,代码行数:19,代码来源:output_unittest.py


示例20: test_loss_curve_plot_generation_multiple_sites_render_multi

    def test_loss_curve_plot_generation_multiple_sites_render_multi(self):
        """Create SVG plots for loss curves read from an NRML file. The
        file contains data for several sites.
        For each site, a separate SVG file is created."""

        path = helpers.get_output_path(LOSS_CURVE_PLOT_FILENAME)
        loss_curve_path = helpers.get_data_path(LOSS_CURVE_PLOT_INPUTFILE)

        plotter = curve.RiskCurvePlotter(path, loss_curve_path, mode='loss',
            curve_title="This is a test loss curve", render_multi=True)

        # delete expected output files, if existing
        for svg_file in plotter.filenames():
            if os.path.isfile(svg_file):
                os.remove(svg_file)

        plotter.plot(autoscale_y=True)

        for svg_file in plotter.filenames():
            self.assertTrue(os.path.getsize(svg_file) > 0)
开发者ID:PseudononymousEpistle,项目名称:oq-engine,代码行数:20,代码来源:output_test.py



注:本文中的tests.utils.helpers.get_output_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python twistedsupport.succeeded函数代码示例发布时间:2022-05-27
下一篇:
Python helpers.demo_file函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap