コード例 #1
0
        def verify_mean_haz_maps_stored_to_nrml(the_job):
            """Tests that a mean hazard map NRML file has been written,
            and that this file validates against the NRML schema.
            Does NOT test if results in NRML file are correct.
            """
            if (the_job.params[hazard_general.POES_PARAM_NAME] != '' and
                the_job.params['COMPUTE_MEAN_HAZARD_CURVE'].lower() ==
                'true'):

                for poe in calculator.poes_hazard_maps:
                    _, nrml_path, _ = psha.hms_meta(
                        calculator.job_ctxt, "mean", (poe,))

                    LOG.debug("validating NRML file for mean hazard map %s"
                        % nrml_path)

                    self.assertTrue(xml.validates_against_xml_schema(
                        nrml_path, NRML_SCHEMA_PATH),
                        "NRML instance file %s does not validate against "
                        "schema" % nrml_path)
コード例 #2
0
        def verify_mean_haz_maps_stored_to_nrml(the_job):
            """Tests that a mean hazard map NRML file has been written,
            and that this file validates against the NRML schema.
            Does NOT test if results in NRML file are correct.
            """
            if (the_job.params[hazard_general.POES_PARAM_NAME] != ''
                    and the_job.params['COMPUTE_MEAN_HAZARD_CURVE'].lower()
                    == 'true'):

                for poe in calculator.poes_hazard_maps:
                    _, nrml_path, _ = psha.hms_meta(calculator.job_ctxt,
                                                    "mean", (poe, ))

                    LOG.debug("validating NRML file for mean hazard map %s" %
                              nrml_path)

                    self.assertTrue(
                        xml.validates_against_xml_schema(
                            nrml_path, NRML_SCHEMA_PATH),
                        "NRML instance file %s does not validate against "
                        "schema" % nrml_path)
コード例 #3
0
        def verify_quantile_haz_maps_stored_to_nrml(the_job, calculator):
            """Tests that quantile hazard map NRML files have been written,
            and that these file validate against the NRML schema.
            Does NOT test if results in NRML files are correct.
            """

            quantiles = calculator.quantile_levels

            if (the_job.params[hazard_general.POES_PARAM_NAME] != '' and
                len(quantiles) > 0):

                for poe in calculator.poes_hazard_maps:
                    for quantile in quantiles:
                        _, nrml_path, _ = psha.hms_meta(
                            calculator.job_ctxt, "quantile", (poe, quantile))

                        LOG.debug("validating NRML file for quantile hazard "
                            "map: %s" % nrml_path)

                        self.assertTrue(xml.validates_against_xml_schema(
                            nrml_path, NRML_SCHEMA_PATH),
                            "NRML instance file %s does not validate against "
                            "schema" % nrml_path)
コード例 #4
0
        def verify_quantile_haz_maps_stored_to_nrml(the_job, calculator):
            """Tests that quantile hazard map NRML files have been written,
            and that these file validate against the NRML schema.
            Does NOT test if results in NRML files are correct.
            """

            quantiles = calculator.quantile_levels

            if (the_job.params[hazard_general.POES_PARAM_NAME] != ''
                    and len(quantiles) > 0):

                for poe in calculator.poes_hazard_maps:
                    for quantile in quantiles:
                        _, nrml_path, _ = psha.hms_meta(
                            calculator.job_ctxt, "quantile", (poe, quantile))

                        LOG.debug("validating NRML file for quantile hazard "
                                  "map: %s" % nrml_path)

                        self.assertTrue(
                            xml.validates_against_xml_schema(
                                nrml_path, NRML_SCHEMA_PATH),
                            "NRML instance file %s does not validate against "
                            "schema" % nrml_path)