from openquake.hazard import tasks from openquake.hazard import classical_psha from openquake.hazard import opensha # pylint ignore, needed for register import openquake.hazard.job from tests.kvs_unittest import ONE_CURVE_MODEL LOG = logs.LOG MEAN_GROUND_INTENSITY='{"site":"+35.0000 +35.0000", "intensity": 1.9249e+00, \ "site":"+35.0500 +35.0000", "intensity": 1.9623e+00, \ "site":"+35.1000 +35.0000", "intensity": 2.0320e+00, \ "site":"+35.1500 +35.0000", "intensity": 2.0594e+00}' TASK_JOBID_SIMPLE = ["JOB1", "JOB2", "JOB3", "JOB4"] TEST_JOB_FILE = test.smoketest_file('simplecase/config.gem') TEST_SOURCE_MODEL = "" with open( test.smoketest_file('simplecase/expected_source_model.json'), 'r') as f: TEST_SOURCE_MODEL = f.read() TEST_GMPE_MODEL = "" with open( test.smoketest_file('simplecase/expected_gmpe_model.json'), 'r') as f: TEST_GMPE_MODEL = f.read() NRML_SCHEMA_PATH = os.path.join(test.SCHEMA_DIR, xml.NRML_SCHEMA_FILE) NRML_SCHEMA_PATH_OLD = os.path.join(test.SCHEMA_DIR, xml.NRML_SCHEMA_FILE_OLD) def generate_job():
from openquake import shapes from utils import test from openquake import job from openquake import flags from openquake.job import Job, EXPOSURE, INPUT_REGION, LOG from openquake.job.mixins import Mixin from openquake.risk.job import RiskJobMixin from openquake.risk.job.probabilistic import ProbabilisticEventMixin from openquake.risk.job.classical_psha import ClassicalPSHABasedMixin CONFIG_FILE = "config.gem" CONFIG_WITH_INCLUDES = "config_with_includes.gem" HAZARD_ONLY = "hazard-config.gem" TEST_JOB_FILE = test.smoketest_file('simplecase/config.gem') TEST_JOB_FILE_CLASSICAL = test.smoketest_file( 'classical_psha_simple/classical-psha-config.gem') SITE = shapes.Site(1.0, 1.0) EXPOSURE_TEST_FILE = "exposure-portfolio.xml" REGION_EXPOSURE_TEST_FILE = "ExposurePortfolioFile-test.region" BLOCK_SPLIT_TEST_FILE = "block_split.gem" REGION_TEST_FILE = "small.region" FLAGS = flags.FLAGS class JobTestCase(unittest.TestCase): def setUp(self): self.generated_files = []
import sys from openquake import shapes from utils import test from openquake import job from openquake import flags from openquake.job import Job, EXPOSURE, INPUT_REGION, LOG from openquake.job.mixins import Mixin from openquake.risk.job import RiskJobMixin from openquake.risk.job.probabilistic import ProbabilisticEventMixin CONFIG_FILE = "config.gem" CONFIG_WITH_INCLUDES = "config_with_includes.gem" HAZARD_ONLY = "hazard-config.gem" TEST_JOB_FILE = test.smoketest_file('simplecase/config.gem') SITE = shapes.Site(1.0, 1.0) EXPOSURE_TEST_FILE = "exposure-portfolio.xml" REGION_EXPOSURE_TEST_FILE = "ExposurePortfolioFile-test.region" BLOCK_SPLIT_TEST_FILE = "block_split.gem" REGION_TEST_FILE = "small.region" FLAGS = flags.FLAGS class JobTestCase(unittest.TestCase): def setUp(self): self.generated_files = [] self.job = Job.from_file(test.do_test_file(CONFIG_FILE)) self.job_with_includes = Job.from_file(test.do_test_file(CONFIG_WITH_INCLUDES))