Esempio n. 1
0
    def test_logic_tree_metadata_validation(self):
        # logic tree parameters must be both specified.
        self.assertRaises(ValueError, writers.validate_hazard_metadata, source_model_tree_path="b1|b2")

        self.assertRaises(ValueError, writers.validate_hazard_metadata, gsim_tree_path="b1|b2")

        writers.validate_hazard_metadata(source_model_tree_path="b1_b2_b3", gsim_tree_path="b1_b2")
Esempio n. 2
0
    def test_logic_tree_metadata_validation(self):
        # logic tree parameters must be both specified.
        self.assertRaises(
            ValueError, writers.validate_hazard_metadata,
            source_model_tree_path="b1|b2")

        self.assertRaises(
            ValueError, writers.validate_hazard_metadata,
            gsim_tree_path="b1|b2")

        writers.validate_hazard_metadata(source_model_tree_path="b1_b2_b3",
                                         gsim_tree_path="b1_b2")
Esempio n. 3
0
    def test_quantile_metadata_validation(self):
        # `statistics` must be "quantile" or "mean".
        self.assertRaises(ValueError, writers.validate_hazard_metadata, statistics="UNKNOWN")

        # when "quantile" is used, `quantile_value` must be
        # specified as well.
        self.assertRaises(ValueError, writers.validate_hazard_metadata, statistics="quantile")

        # when "mean" is used, `quantile_value` shouldn't
        # be specified.
        self.assertRaises(ValueError, writers.validate_hazard_metadata, statistics="mean", quantile_value=0.50)

        writers.validate_hazard_metadata(quantile_value=0.50, statistics="quantile")

        writers.validate_hazard_metadata(statistics="mean")
Esempio n. 4
0
    def test_quantile_metadata_validation(self):
        # `statistics` must be "quantile" or "mean".
        self.assertRaises(
            ValueError, writers.validate_hazard_metadata,
            statistics="UNKNOWN")

        # when "quantile" is used, `quantile_value` must be
        # specified as well.
        self.assertRaises(
            ValueError, writers.validate_hazard_metadata,
            statistics="quantile")

        # when "mean" is used, `quantile_value` shouldn't
        # be specified.
        self.assertRaises(
            ValueError, writers.validate_hazard_metadata,
            statistics="mean", quantile_value=0.50)

        writers.validate_hazard_metadata(quantile_value=0.50,
                                         statistics="quantile")

        writers.validate_hazard_metadata(statistics="mean")