def test_hazard_curve(self): output = self.FakeOutput('hazard_curve') curves = [ self.FakeHazardCurve(output, self.ltr_mc, 'PGA', None, None, None), self.FakeHazardCurve(output, self.ltr_enum, 'SA', 0.025, None, None), self.FakeHazardCurve(output, None, 'SA', 0.025, 'mean', None), self.FakeHazardCurve(output, None, 'SA', 0.025, 'quantile', 0.85), ] expected_paths = [ '%s/calc_7/hazard_curve/PGA/' 'hazard_curve-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/hazard_curve/SA-0.025/' 'hazard_curve-smltp_B10_B9-gsimltp_B7_B8.xml', '%s/calc_7/hazard_curve/SA-0.025/' 'hazard_curve-mean.xml', '%s/calc_7/hazard_curve/SA-0.025/' 'hazard_curve-quantile_0.85.xml', ] expected_paths = [x % self.target_dir for x in expected_paths] for i, curve in enumerate(curves): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, curve))
def test_hazard_map(self): output = self.FakeOutput('hazard_map') maps = [ self.FakeHazardMap(output, self.ltr_mc, 'PGA', None, 0.1, None, None), self.FakeHazardMap(output, self.ltr_mc, 'SA', 0.025, 0.2, None, None), self.FakeHazardMap(output, None, 'SA', 0.025, 0.3, 'mean', None), self.FakeHazardMap(output, None, 'SA', 0.025, 0.4, 'quantile', 0.85), ] expected_paths = [ '%s/calc_7/hazard_map/PGA/' 'hazard_map-poe_0.1-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/hazard_map/SA-0.025/' 'hazard_map-poe_0.2-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/hazard_map/SA-0.025/' 'hazard_map-poe_0.3-mean.xml', '%s/calc_7/hazard_map/SA-0.025/' 'hazard_map-poe_0.4-quantile_0.85.xml', ] expected_paths = [x % self.target_dir for x in expected_paths] for i, hmap in enumerate(maps): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, hmap) )
def test_disagg(self): output = self.FakeOutput('disagg_matrix') matrices = [ self.FakeDisagg(output, self.ltr_mc, 'PGA', None, self.Location(33.333, -89.999001), 0.1), self.FakeDisagg(output, self.ltr_enum, 'SA', 0.025, self.Location(40.1, 10.1), 0.02), ] expected_paths = [ '%s/calc_7/disagg_matrix/PGA/' 'disagg_matrix(0.1)-lon_33.333-lat_-89.999001-smltp_B1_B3-' 'gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/disagg_matrix/SA-0.025/' 'disagg_matrix(0.02)-lon_40.1-lat_10.1-' 'smltp_B10_B9-gsimltp_B7_B8.xml' ] expected_paths = [x % self.target_dir for x in expected_paths] for i, matrix in enumerate(matrices): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, matrix) )
def test_gmf(self): output = self.FakeOutput("gmf") gmf = self.FakeGMF(output, self.ltr_enum) expected_path = "%s/calc_8/gmf/gmf-smltp_B10_B9-gsimltp_B7_B8.xml" % self.target_dir self.assertEqual(expected_path, hazard._get_result_export_dest(8, self.target_dir, gmf))
def test_hazard_map(self): output = self.FakeOutput('hazard_map') maps = [ self.FakeHazardMap(output, self.ltr_mc, 'PGA', None, 0.1, None, None), self.FakeHazardMap(output, self.ltr_mc, 'SA', 0.025, 0.2, None, None), self.FakeHazardMap(output, None, 'SA', 0.025, 0.3, 'mean', None), self.FakeHazardMap(output, None, 'SA', 0.025, 0.4, 'quantile', 0.85), ] expected_paths = [ '%s/calc_7/hazard_map/PGA/' 'hazard_map-poe_0.1-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/hazard_map/SA-0.025/' 'hazard_map-poe_0.2-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/hazard_map/SA-0.025/' 'hazard_map-poe_0.3-mean.xml', '%s/calc_7/hazard_map/SA-0.025/' 'hazard_map-poe_0.4-quantile_0.85.xml', ] expected_paths = [x % self.target_dir for x in expected_paths] for i, hmap in enumerate(maps): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, hmap))
def test_hazard_curve(self): output = self.FakeOutput('hazard_curve') curves = [ self.FakeHazardCurve(output, self.ltr_mc, 'PGA', None, None, None), self.FakeHazardCurve(output, self.ltr_enum, 'SA', 0.025, None, None), self.FakeHazardCurve(output, None, 'SA', 0.025, 'mean', None), self.FakeHazardCurve(output, None, 'SA', 0.025, 'quantile', 0.85), ] expected_paths = [ '%s/calc_7/hazard_curve/PGA/' 'hazard_curve-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/hazard_curve/SA-0.025/' 'hazard_curve-smltp_B10_B9-gsimltp_B7_B8.xml', '%s/calc_7/hazard_curve/SA-0.025/' 'hazard_curve-mean.xml', '%s/calc_7/hazard_curve/SA-0.025/' 'hazard_curve-quantile_0.85.xml', ] expected_paths = [x % self.target_dir for x in expected_paths] for i, curve in enumerate(curves): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, curve) )
def test_gmf(self): output = self.FakeOutput('gmf') gmf = self.FakeGMF(output, self.ltr_enum) expected_path = ('%s/calc_8/gmf/gmf-smltp_B10_B9-gsimltp_B7_B8.xml' % self.target_dir) self.assertEqual( expected_path, hazard._get_result_export_dest(8, self.target_dir, gmf))
def test_clt_ses(self): output = self.FakeOutput('complete_lt_ses') ses = self.FakeCLTSES(output) expected_path = '%s/calc_10/ses/complete_lt_ses.xml' expected_path %= self.target_dir self.assertEqual( expected_path, hazard._get_result_export_dest(10, self.target_dir, ses))
def test_clt_gmf(self): output = self.FakeOutput('complete_lt_gmf') gmf = self.FakeCLTGMF(output) expected_path = '%s/calc_9/gmf/complete_lt_gmf.xml' expected_path %= self.target_dir self.assertEqual( expected_path, hazard._get_result_export_dest(9, self.target_dir, gmf))
def test_ses(self): output = self.FakeOutput('ses') ses = self.FakeGMF(output, self.ltr_mc) expected_path = ( '%s/calc_8/ses/ses-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml' % self.target_dir) self.assertEqual( expected_path, hazard._get_result_export_dest(8, self.target_dir, ses))
def test_ses(self): output = self.FakeOutput('ses') ses = self.FakeSES(output, 1, self.ltr_mc.sm_lt_path) expected_path = ( '%s/calc_8/ses/ses-smltp_B1_B3.xml' % self.target_dir ) self.assertEqual( expected_path, hazard._get_result_export_dest(8, self.target_dir, ses) )
def test_clt_gmf(self): output = self.FakeOutput('complete_lt_gmf') gmf = self.FakeCLTGMF(output) expected_path = '%s/calc_9/gmf/complete_lt_gmf.xml' expected_path %= self.target_dir self.assertEqual( expected_path, hazard._get_result_export_dest(9, self.target_dir, gmf) )
def test_clt_ses(self): output = self.FakeOutput('complete_lt_ses') ses = self.FakeCLTSES(output) expected_path = '%s/calc_10/ses/complete_lt_ses.xml' expected_path %= self.target_dir self.assertEqual( expected_path, hazard._get_result_export_dest(10, self.target_dir, ses) )
def test_ses(self): output = self.FakeOutput('ses') ses = self.FakeGMF(output, self.ltr_mc) expected_path = ( '%s/calc_8/ses/ses-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml' % self.target_dir ) self.assertEqual( expected_path, hazard._get_result_export_dest(8, self.target_dir, ses) )
def test_uhs(self): output = self.FakeOutput("uh_spectra") uh_spectra = [ self.FakeUHS(output, self.ltr_mc, 0.1, None, None), self.FakeUHS(output, None, 0.2, "mean", None), self.FakeUHS(output, None, 0.3, "quantile", 0.85), ] expected_paths = [ "%s/calc_7/uh_spectra/" "uh_spectra-poe_0.1-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml", "%s/calc_7/uh_spectra/uh_spectra-poe_0.2-mean.xml", "%s/calc_7/uh_spectra/uh_spectra-poe_0.3-quantile_0.85.xml", ] expected_paths = [x % self.target_dir for x in expected_paths] for i, uhs in enumerate(uh_spectra): self.assertEqual(expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, uhs))
def test_hazard_map(self): output = self.FakeOutput("hazard_map") maps = [ self.FakeHazardMap(output, self.ltr_mc, "PGA", None, 0.1, None, None), self.FakeHazardMap(output, self.ltr_mc, "SA", 0.025, 0.2, None, None), self.FakeHazardMap(output, None, "SA", 0.025, 0.3, "mean", None), self.FakeHazardMap(output, None, "SA", 0.025, 0.4, "quantile", 0.85), ] expected_paths = [ "%s/calc_7/hazard_map/PGA/" "hazard_map-poe_0.1-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml", "%s/calc_7/hazard_map/SA-0.025/" "hazard_map-poe_0.2-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml", "%s/calc_7/hazard_map/SA-0.025/" "hazard_map-poe_0.3-mean.xml", "%s/calc_7/hazard_map/SA-0.025/" "hazard_map-poe_0.4-quantile_0.85.xml", ] expected_paths = [x % self.target_dir for x in expected_paths] for i, hmap in enumerate(maps): self.assertEqual(expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, hmap))
def test_hazard_curve_multi(self): output = self.FakeOutput("hazard_curve_multi") curves = [ self.FakeHazardCurve(output, self.ltr_mc, None, None, None, None), self.FakeHazardCurve(output, self.ltr_enum, None, None, None, None), self.FakeHazardCurve(output, None, None, None, "mean", None), self.FakeHazardCurve(output, None, None, None, "quantile", 0.85), ] expected_paths = [ "%s/calc_7/hazard_curve_multi/" "hazard_curve_multi-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml", "%s/calc_7/hazard_curve_multi/" "hazard_curve_multi-smltp_B10_B9-gsimltp_B7_B8.xml", "%s/calc_7/hazard_curve_multi/" "hazard_curve_multi-mean.xml", "%s/calc_7/hazard_curve_multi/" "hazard_curve_multi-quantile_0.85.xml", ] expected_paths = [x % self.target_dir for x in expected_paths] for i, curve in enumerate(curves): self.assertEqual(expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, curve))
def test_uhs(self): output = self.FakeOutput('uh_spectra') uh_spectra = [ self.FakeUHS(output, self.ltr_mc, 0.1, None, None), self.FakeUHS(output, None, 0.2, 'mean', None), self.FakeUHS(output, None, 0.3, 'quantile', 0.85), ] expected_paths = [ '%s/calc_7/uh_spectra/' 'uh_spectra-poe_0.1-smltp_B1_B3-gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/uh_spectra/uh_spectra-poe_0.2-mean.xml', '%s/calc_7/uh_spectra/uh_spectra-poe_0.3-quantile_0.85.xml', ] expected_paths = [x % self.target_dir for x in expected_paths] for i, uhs in enumerate(uh_spectra): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, uhs))
def test_disagg(self): output = self.FakeOutput('disagg_matrix') matrices = [ self.FakeDisagg(output, self.ltr_mc, 'PGA', None, self.Location(33.333, -89.999001), 0.1), self.FakeDisagg(output, self.ltr_enum, 'SA', 0.025, self.Location(40.1, 10.1), 0.02), ] expected_paths = [ '%s/calc_7/disagg_matrix/PGA/' 'disagg_matrix(0.1)-lon_33.333-lat_-89.999001-smltp_B1_B3-' 'gsimltp_B2_B4-ltr_3.xml', '%s/calc_7/disagg_matrix/SA-0.025/' 'disagg_matrix(0.02)-lon_40.1-lat_10.1-' 'smltp_B10_B9-gsimltp_B7_B8.xml' ] expected_paths = [x % self.target_dir for x in expected_paths] for i, matrix in enumerate(matrices): self.assertEqual( expected_paths[i], hazard._get_result_export_dest(7, self.target_dir, matrix))