def verify_mean_haz_curves_stored_to_nrml(the_job, calculator):
            """Tests that a mean hazard curve 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['COMPUTE_MEAN_HAZARD_CURVE'].lower() == 'true':
                nrml_path = psha.nrml_path(calculator.job_ctxt, "mean")

                LOG.debug("validating NRML file %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_curves_stored_to_nrml(the_job, calculator):
            """Tests that a mean hazard curve 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['COMPUTE_MEAN_HAZARD_CURVE'].lower() == 'true':
                nrml_path = psha.nrml_path(calculator.job_ctxt, "mean")

                LOG.debug("validating NRML file %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)
        def verify_quantile_haz_curves_stored_to_nrml(the_job, calculator):
            """Tests that quantile hazard curve NRML files have been written,
            and that these file validate against the NRML schema.
            Does NOT test if results in NRML files are correct.
            """

            for quantile in calculator.quantile_levels:

                nrml_path = psha.nrml_path(calculator.job_ctxt, "quantile",
                                           quantile)
                LOG.debug("validating NRML file for quantile hazard curve: "
                    "%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)
        def verify_realization_haz_curves_stored_to_nrml(the_job, calculator):
            """Tests that a NRML file has been written for each realization,
            and that this file validates against the NRML schema.
            Does NOT test if results in NRML file are correct.
            """
            realizations = int(
                the_job.params['NUMBER_OF_LOGIC_TREE_SAMPLES'])
            for realization in xrange(0, realizations):

                nrml_path = psha.nrml_path(calculator.job_ctxt, "curve",
                                           realization)

                LOG.debug("validating NRML file %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)
示例#5
0
        def verify_quantile_haz_curves_stored_to_nrml(the_job, calculator):
            """Tests that quantile hazard curve NRML files have been written,
            and that these file validate against the NRML schema.
            Does NOT test if results in NRML files are correct.
            """

            for quantile in calculator.quantile_levels:

                nrml_path = psha.nrml_path(calculator.job_ctxt, "quantile",
                                           quantile)
                LOG.debug("validating NRML file for quantile hazard curve: "
                          "%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)
示例#6
0
        def verify_realization_haz_curves_stored_to_nrml(the_job, calculator):
            """Tests that a NRML file has been written for each realization,
            and that this file validates against the NRML schema.
            Does NOT test if results in NRML file are correct.
            """
            realizations = int(the_job.params['NUMBER_OF_LOGIC_TREE_SAMPLES'])
            for realization in xrange(0, realizations):

                nrml_path = psha.nrml_path(calculator.job_ctxt, "curve",
                                           realization)

                LOG.debug("validating NRML file %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)