def test_prepare_scenario_job_over_sites(self): ''' Same as test_prepare_scenario_job, but with geometry specified as a list of sites. ''' params = self.BASE_SCENARIO_PARAMS.copy() params['SITES'] = '34.07, -118.25, 34.07, -118.22, 34.04, -118.22' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['SITES'], _to_coord_list(jp.sites)) self.assertFieldsEqual( {'calc_mode': 'scenario', 'min_magnitude': None, 'investigation_time': None, 'component': 'gmroti50', 'imt': 'pga', 'period': None, 'truncation_type': 'onesided', 'truncation_level': 3.0, 'reference_vs30_value': 759.0, 'imls': None, 'poes': None, 'realizations': None, 'histories': None, 'gm_correlated': True, }, jp)
def test_prepare_event_based_job_over_sites(self): ''' Same as test_prepare_event_based_job, but with geometry specified as a list of sites. ''' params = self.BASE_EVENT_BASED_PARAMS.copy() params['SITES'] = '33.88, -118.3, 33.88, -118.06, 33.76, -118.06' params['LOSS_HISTOGRAM_BINS'] = '25' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['SITES'], _to_coord_list(jp.sites)) self.assertFieldsEqual( {'calc_mode': 'event_based', 'min_magnitude': 5.0, 'investigation_time': 50.0, 'component': 'average', 'imt': 'sa', 'period': 1.0, 'truncation_type': 'none', 'truncation_level': 3.0, 'reference_vs30_value': 760.0, 'imls': [0.005, 0.007, 0.0098, 0.0137, 0.0192], 'poes': None, 'realizations': 5, 'histories': 1, 'gm_correlated': False, }, jp)
def test_prepare_scenario_job(self): abs_path = partial(datapath, "scenario") params = self.BASE_SCENARIO_PARAMS.copy() params['REGION_VERTEX'] = \ '34.07, -118.25, 34.07, -118.22, 34.04, -118.22' params['REGION_GRID_SPACING'] = '0.02' params['SINGLE_RUPTURE_MODEL'] = abs_path("simple-fault-rupture.xml") params['EXPOSURE'] = abs_path("LA_small_portfolio.xml") params['VULNERABILITY'] = abs_path("vulnerability.xml") jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['REGION_VERTEX'], _to_coord_list(jp.region)) self.assertFieldsEqual( {'calc_mode': 'scenario', 'region_grid_spacing': 0.02, 'min_magnitude': None, 'investigation_time': None, 'component': 'gmroti50', 'imt': 'pga', 'period': None, 'truncation_type': 'onesided', 'truncation_level': 3.0, 'reference_vs30_value': 759.0, 'imls': None, 'poes': None, 'realizations': None, 'histories': None, 'gm_correlated': True, 'damping': None, 'gmf_calculation_number': 5, 'rupture_surface_discretization': 0.1, }, jp)
def test_prepare_classical_job_over_sites(self): ''' Same as test_prepare_classical_job, but with geometry specified as a list of sites. ''' params = self.BASE_CLASSICAL_PARAMS.copy() params['SITES'] = '37.9, -121.9, 37.9, -121.6, 37.5, -121.6' params['LREM_STEPS_PER_INTERVAL'] = '5' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['SITES'], _to_coord_list(jp.sites)) self.assertFieldsEqual( {'calc_mode': 'classical', 'min_magnitude': 5.0, 'investigation_time': 50.0, 'component': 'gmroti50', 'imt': 'pga', 'period': None, 'truncation_type': 'twosided', 'truncation_level': 3.0, 'reference_vs30_value': 760.0, 'imls': [0.005, 0.007, 0.0098, 0.0137, 0.0192], 'poes': [0.01, 0.1], 'realizations': 2, 'histories': None, 'gm_correlated': None, }, jp)
def test_prepare_classical_job_over_sites(self): """ Same as test_prepare_classical_job, but with geometry specified as a list of sites. """ params = self.BASE_CLASSICAL_PARAMS.copy() params["SITES"] = "37.9, -121.9, 37.9, -121.6, 37.5, -121.6" params["LREM_STEPS_PER_INTERVAL"] = "5" self.job = _prepare_job(params, ["HAZARD", "RISK"]) self.calculation.oq_job_profile = self.job self.calculation.save() self.job = self._reload_params() self.assertEquals(params["SITES"], _to_coord_list(self.job.sites)) self.assertFieldsEqual( { "calc_mode": "classical", "min_magnitude": 5.0, "investigation_time": 50.0, "component": "gmroti50", "imt": "pga", "period": None, "truncation_type": "twosided", "truncation_level": 3.0, "reference_vs30_value": 760.0, "imls": [0.005, 0.007, 0.0098, 0.0137, 0.0192], "poes": [0.01, 0.1], "realizations": 2, "histories": None, "gm_correlated": None, }, self.job, )
def test_prepare_event_based_job_over_sites(self): """ Same as test_prepare_event_based_job, but with geometry specified as a list of sites. """ params = self.BASE_EVENT_BASED_PARAMS.copy() params["SITES"] = "33.88, -118.3, 33.88, -118.06, 33.76, -118.06" params["LOSS_HISTOGRAM_BINS"] = "25" self.job = _prepare_job(params, ["HAZARD", "RISK"]) self.job.oq_job_profile = self._reload_params() self.assertEquals(params["SITES"], _to_coord_list(self.job.oq_job_profile.sites)) self.assertFieldsEqual( { "calc_mode": "event_based", "min_magnitude": 5.0, "investigation_time": 50.0, "component": "average", "imt": "sa", "period": 1.0, "truncation_type": "none", "truncation_level": 3.0, "reference_vs30_value": 760.0, "imls": [0.005, 0.007, 0.0098, 0.0137, 0.0192], "poes": None, "realizations": 5, "histories": 1, "gm_correlated": False, }, self.job.oq_job_profile, )
def test_prepare_scenario_job_over_sites(self): """ Same as test_prepare_scenario_job, but with geometry specified as a list of sites. """ params = self.BASE_SCENARIO_PARAMS.copy() params["SITES"] = "34.07, -118.25, 34.07, -118.22, 34.04, -118.22" self.job = _prepare_job(params, ["HAZARD", "RISK"]) self.calculation.oq_job_profile = self.job self.calculation.save() self.job = self._reload_params() self.assertEquals(params["SITES"], _to_coord_list(self.job.sites)) self.assertFieldsEqual( { "calc_mode": "scenario", "min_magnitude": None, "investigation_time": None, "component": "gmroti50", "imt": "pga", "period": None, "truncation_type": "onesided", "truncation_level": 3.0, "reference_vs30_value": 759.0, "imls": None, "poes": None, "realizations": None, "histories": None, "gm_correlated": True, }, self.job, )
def test_prepare_classical_job(self): abs_path = partial(datapath, "classical_psha_simple") params = self.BASE_CLASSICAL_PARAMS.copy() params["REGION_VERTEX"] = "37.9, -121.9, 37.9, -121.6, 37.5, -121.6" params["REGION_GRID_SPACING"] = "0.1" params["SOURCE_MODEL_LOGIC_TREE_FILE"] = abs_path("source_model_logic_tree.xml") params["GMPE_LOGIC_TREE_FILE"] = abs_path("gmpe_logic_tree.xml") params["EXPOSURE"] = abs_path("small_exposure.xml") params["VULNERABILITY"] = abs_path("vulnerability.xml") params["SOURCE_MODEL_LT_RANDOM_SEED"] = "23" params["GMPE_LT_RANDOM_SEED"] = "5" params["LREM_STEPS_PER_INTERVAL"] = "5" self.job = _prepare_job(params, ["HAZARD", "RISK"]) self.calculation.oq_job_profile = self.job self.calculation.save() self.job = self._reload_params() self.assertEquals(params["REGION_VERTEX"], _to_coord_list(self.job.region)) self.assertFieldsEqual( { "calc_mode": "classical", "region_grid_spacing": 0.1, "min_magnitude": 5.0, "investigation_time": 50.0, "component": "gmroti50", "imt": "pga", "period": None, "truncation_type": "twosided", "truncation_level": 3.0, "reference_vs30_value": 760.0, "imls": [0.005, 0.007, 0.0098, 0.0137, 0.0192], "poes": [0.01, 0.1], "realizations": 2, "histories": None, "gm_correlated": None, "damping": None, "gmf_calculation_number": None, "rupture_surface_discretization": None, "subduction_rupture_floating_type": "downdip", }, self.job, ) self.assertEqual( [ {"path": abs_path("small_exposure.xml"), "type": "exposure"}, {"path": abs_path("gmpe_logic_tree.xml"), "type": "lt_gmpe"}, {"path": abs_path("source_model_logic_tree.xml"), "type": "lt_source"}, {"path": abs_path("source_model1.xml"), "type": "source"}, {"path": abs_path("source_model2.xml"), "type": "source"}, {"path": abs_path("vulnerability.xml"), "type": "vulnerability"}, ], self._get_inputs(self.job), )
def test_prepare_event_based_job(self): abs_path = partial(datapath, "simplecase") params = self.BASE_EVENT_BASED_PARAMS.copy() params["REGION_VERTEX"] = "33.88, -118.3, 33.88, -118.06, 33.76, -118.06" params["REGION_GRID_SPACING"] = "0.02" params["SOURCE_MODEL_LOGIC_TREE_FILE"] = abs_path("source_model_logic_tree.xml") params["GMPE_LOGIC_TREE_FILE"] = abs_path("gmpe_logic_tree.xml") params["EXPOSURE"] = abs_path("small_exposure.xml") params["VULNERABILITY"] = abs_path("vulnerability.xml") params["GMF_RANDOM_SEED"] = "1" params["LOSS_HISTOGRAM_BINS"] = "25" self.job = _prepare_job(params, ["HAZARD", "RISK"]) self.job.oq_job_profile = self._reload_params() self.assertEquals(params["REGION_VERTEX"], _to_coord_list(self.job.oq_job_profile.region)) self.assertFieldsEqual( { "calc_mode": "event_based", "region_grid_spacing": 0.02, "min_magnitude": 5.0, "investigation_time": 50.0, "component": "average", "imt": "sa", "period": 1.0, "truncation_type": "none", "truncation_level": 3.0, "reference_vs30_value": 760.0, "imls": [0.005, 0.007, 0.0098, 0.0137, 0.0192], "poes": None, "realizations": 5, "histories": 1, "gm_correlated": False, "damping": 5.0, "gmf_calculation_number": None, "rupture_surface_discretization": None, }, self.job.oq_job_profile, ) self.assertEqual( [ {"path": abs_path("small_exposure.xml"), "type": "exposure"}, {"path": abs_path("gmpe_logic_tree.xml"), "type": "lt_gmpe"}, {"path": abs_path("source_model_logic_tree.xml"), "type": "lt_source"}, {"path": abs_path("source_model1.xml"), "type": "source"}, {"path": abs_path("source_model2.xml"), "type": "source"}, {"path": abs_path("vulnerability.xml"), "type": "vulnerability"}, ], self._get_inputs(self.job), )
def test_prepare_scenario_job(self): abs_path = partial(datapath, "scenario") params = self.BASE_SCENARIO_PARAMS.copy() params["REGION_VERTEX"] = "34.07, -118.25, 34.07, -118.22, 34.04, -118.22" params["REGION_GRID_SPACING"] = "0.02" params["SINGLE_RUPTURE_MODEL"] = abs_path("simple-fault-rupture.xml") params["EXPOSURE"] = abs_path("LA_small_portfolio.xml") params["VULNERABILITY"] = abs_path("vulnerability.xml") self.job = _prepare_job(params, ["HAZARD", "RISK"]) self.calculation.oq_job_profile = self.job self.calculation.save() self.job = self._reload_params() self.assertEquals(params["REGION_VERTEX"], _to_coord_list(self.job.region)) self.assertFieldsEqual( { "calc_mode": "scenario", "region_grid_spacing": 0.02, "min_magnitude": None, "investigation_time": None, "component": "gmroti50", "imt": "pga", "period": None, "truncation_type": "onesided", "truncation_level": 3.0, "reference_vs30_value": 759.0, "imls": None, "poes": None, "realizations": None, "histories": None, "gm_correlated": True, "damping": None, "gmf_calculation_number": 5, "rupture_surface_discretization": 0.1, }, self.job, ) self.assertEqual( [ {"path": abs_path("LA_small_portfolio.xml"), "type": "exposure"}, {"path": abs_path("simple-fault-rupture.xml"), "type": "rupture"}, {"path": abs_path("vulnerability.xml"), "type": "vulnerability"}, ], self._get_inputs(self.job), )
def test_prepare_classical_job(self): abs_path = partial(datapath, "classical_psha_simple") params = self.BASE_CLASSICAL_PARAMS.copy() params['REGION_VERTEX'] = '37.9, -121.9, 37.9, -121.6, 37.5, -121.6' params['REGION_GRID_SPACING'] = '0.1' params['BASE_PATH'] = abs_path('') params['SOURCE_MODEL_LOGIC_TREE_FILE'] = "source_model_logic_tree.xml" params['GMPE_LOGIC_TREE_FILE'] = "gmpe_logic_tree.xml" params['EXPOSURE'] = abs_path("small_exposure.xml") params['VULNERABILITY'] = abs_path("vulnerability.xml") params['SOURCE_MODEL_LT_RANDOM_SEED'] = '23' params['GMPE_LT_RANDOM_SEED'] = '5' params['LREM_STEPS_PER_INTERVAL'] = '5' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['REGION_VERTEX'], _to_coord_list(jp.region)) self.assertFieldsEqual( {'calc_mode': 'classical', 'region_grid_spacing': 0.1, 'min_magnitude': 5.0, 'investigation_time': 50.0, 'component': 'gmroti50', 'imt': 'pga', 'period': None, 'truncation_type': 'twosided', 'truncation_level': 3.0, 'reference_vs30_value': 760.0, 'imls': [0.005, 0.007, 0.0098, 0.0137, 0.0192], 'poes': [0.01, 0.1], 'realizations': 2, 'histories': None, 'gm_correlated': None, 'damping': None, 'gmf_calculation_number': None, 'rupture_surface_discretization': None, 'subduction_rupture_floating_type': 'downdip', }, jp)
def test_prepare_classical_job(self): abs_path = partial(datapath, "classical_psha_simple") params = self.BASE_CLASSICAL_PARAMS.copy() params['REGION_VERTEX'] = '37.9, -121.9, 37.9, -121.6, 37.5, -121.6' params['REGION_GRID_SPACING'] = '0.1' params['SOURCE_MODEL_LOGIC_TREE_FILE'] = abs_path( "source_model_logic_tree.xml") params['GMPE_LOGIC_TREE_FILE'] = abs_path("gmpe_logic_tree.xml") params['EXPOSURE'] = abs_path("small_exposure.xml") params['VULNERABILITY'] = abs_path("vulnerability.xml") params['SOURCE_MODEL_LT_RANDOM_SEED'] = '23' params['GMPE_LT_RANDOM_SEED'] = '5' params['LREM_STEPS_PER_INTERVAL'] = '5' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['REGION_VERTEX'], _to_coord_list(jp.region)) self.assertFieldsEqual( {'calc_mode': 'classical', 'region_grid_spacing': 0.1, 'min_magnitude': 5.0, 'investigation_time': 50.0, 'component': 'gmroti50', 'imt': 'pga', 'period': None, 'truncation_type': 'twosided', 'truncation_level': 3.0, 'reference_vs30_value': 760.0, 'imls': [0.005, 0.007, 0.0098, 0.0137, 0.0192], 'poes': [0.01, 0.1], 'realizations': 2, 'histories': None, 'gm_correlated': None, 'damping': None, 'gmf_calculation_number': None, 'rupture_surface_discretization': None, 'subduction_rupture_floating_type': 'downdip', }, jp)
def test_prepare_event_based_job(self): abs_path = partial(datapath, "simplecase") params = self.BASE_EVENT_BASED_PARAMS.copy() params['REGION_VERTEX'] = \ '33.88, -118.3, 33.88, -118.06, 33.76, -118.06' params['REGION_GRID_SPACING'] = '0.02' params['BASE_PATH'] = abs_path('') params['SOURCE_MODEL_LOGIC_TREE_FILE'] = "source_model_logic_tree.xml" params['GMPE_LOGIC_TREE_FILE'] = "gmpe_logic_tree.xml" params['EXPOSURE'] = abs_path("small_exposure.xml") params['VULNERABILITY'] = abs_path("vulnerability.xml") params['GMF_RANDOM_SEED'] = '1' params['LOSS_HISTOGRAM_BINS'] = '25' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['REGION_VERTEX'], _to_coord_list(jp.region)) self.assertFieldsEqual( {'calc_mode': 'event_based', 'region_grid_spacing': 0.02, 'min_magnitude': 5.0, 'investigation_time': 50.0, 'component': 'average', 'imt': 'sa', 'period': 1.0, 'truncation_type': 'none', 'truncation_level': 3.0, 'reference_vs30_value': 760.0, 'imls': [0.005, 0.007, 0.0098, 0.0137, 0.0192], 'poes': None, 'realizations': 5, 'histories': 1, 'gm_correlated': False, 'damping': 5.0, 'gmf_calculation_number': None, 'rupture_surface_discretization': None, }, jp)
def test_prepare_event_based_job(self): abs_path = partial(datapath, "simplecase") params = self.BASE_EVENT_BASED_PARAMS.copy() params['REGION_VERTEX'] = \ '33.88, -118.3, 33.88, -118.06, 33.76, -118.06' params['REGION_GRID_SPACING'] = '0.02' params['SOURCE_MODEL_LOGIC_TREE_FILE'] = abs_path( "source_model_logic_tree.xml") params['GMPE_LOGIC_TREE_FILE'] = abs_path("gmpe_logic_tree.xml") params['EXPOSURE'] = abs_path("small_exposure.xml") params['VULNERABILITY'] = abs_path("vulnerability.xml") params['GMF_RANDOM_SEED'] = '1' params['LOSS_HISTOGRAM_BINS'] = '25' jp = _prepare_job(params, ['HAZARD', 'RISK'], 'openquake', self.job, False) self.assertEqual(params['REGION_VERTEX'], _to_coord_list(jp.region)) self.assertFieldsEqual( {'calc_mode': 'event_based', 'region_grid_spacing': 0.02, 'min_magnitude': 5.0, 'investigation_time': 50.0, 'component': 'average', 'imt': 'sa', 'period': 1.0, 'truncation_type': 'none', 'truncation_level': 3.0, 'reference_vs30_value': 760.0, 'imls': [0.005, 0.007, 0.0098, 0.0137, 0.0192], 'poes': None, 'realizations': 5, 'histories': 1, 'gm_correlated': False, 'damping': 5.0, 'gmf_calculation_number': None, 'rupture_surface_discretization': None, }, jp)