def test_get_current_conditions(): gas_field = basic_gas_field() gas_field.met_data_path = 'TMY-DataExample.csv' time = sc.Time(delta_t=1, end_time=10, current_time=0) gas_field.met_data_maker() rep = Dm.repair.Repair(repair_delay=0) prob_points, detect_probs = ex_prob_detect_arrays() tech = Dm.comp_survey.CompSurvey( time, survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean', 'wind speed': 'mean'}, detection_probability_points=prob_points, detection_probabilities=detect_probs, site_queue=[] ) # pd.DataFrame initializes a new DataFrame to avoid chained indexing warnings emissions = pd.DataFrame(gas_field.emissions.get_current_emissions(time)) n_em = 100 emissions.loc[:, 'flux'] = np.linspace(0.1, 10, n_em) em_indexes = np.linspace(0, n_em - 1, n_em, dtype=int) ret = tech.get_current_conditions(time, gas_field, emissions, em_indexes) if np.any(ret[:, 0] != emissions.flux): raise ValueError("get_current_conditions not returning the correct values") if np.any(ret[:, 1] != np.mean(gas_field.met['wind speed'][8:17])): raise ValueError("get_current_conditions not returning the correct values")
def test_choose_sites(): gas_field = basic_gas_field() gas_field.met_data_path = 'TMY-DataExample.csv' time = sc.Time(delta_t=1, end_time=10, current_time=0) gas_field.met_data_maker() rep = Dm.repair.Repair(repair_delay=0) # wind_dirs_mins = np.zeros(gas_field.n_sites) # wind_dirs_maxs = np.ones(gas_field.n_sites) * 90 tech = Dm.comp_survey.CompSurvey( time, survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, op_envelope={ # 'wind speed': {'class': 1, 'min': 1, 'max': 10}, # 'wind direction': {'class': 2, 'min': wind_dirs_mins, 'max': wind_dirs_maxs} }, site_queue=[], detection_probability_points=[1, 2], detection_probabilities=[0, 1] ) tech.site_queue = list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int)) siteinds = tech.choose_sites(gas_field, time, 10) if not (siteinds == np.linspace(0, 9, 10, dtype=int)).all(): raise ValueError("choose_sites() is not selecting the correcting sites") tech.site_queue = [] siteinds = tech.choose_sites(gas_field, time, 10) if siteinds: raise ValueError("choose_sites() fails for empty site_queue queue")
def test_site_survey(): gas_field = basic_gas_field() time = sc.Time(delta_t=1, end_time=10, current_time=0) points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.474)) / (1.36 * np.sqrt(2))) for f in points]) rep = Dm.repair.Repair(repair_delay=0) comp_temp = Dm.comp_survey.CompSurvey( time, site_queue=[], survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) tech = Dm.site_survey.SiteSurvey( time, survey_interval=50, sites_per_day=100, ophrs={'begin': 8, 'end': 17}, site_cost=100, dispatch_object=comp_temp, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) emissions = gas_field.emissions.get_current_emissions(time) np.random.seed(0) # test detect_prob_curve detect = tech.detect_prob_curve(time, gas_field, [0, 1, 2], emissions) if detect != np.array([0]): raise ValueError("SiteSurvey.detect_prob_curve not returning expected sites.") # test sites_surveyed with empty queue sites_surveyed = tech.sites_surveyed(gas_field, time) if sites_surveyed: raise ValueError("sites_surveyed returning sites when it should not") # test detect np.random.seed(0) tech.site_queue = [0, 1, 2] tech.detect(time, gas_field, emissions) if tech.deployment_count.get_sum_val(0, 1) != 3: raise ValueError("SiteSurvey is not counting deployments correctly") if tech.detection_count.get_sum_val(0, 1) != 1: raise ValueError("SiteSurvey is not counting detections correctly.") if tech.deployment_cost.get_sum_val(0, 1) != 300: raise ValueError("SiteSurvey is not calculating survey costs correctly") if tech.dispatch_object.site_queue != [0]: raise ValueError("site_detect.detect not updating dispatch object sites to survey correctly") # test action and sites_surveyed with tech.action(list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int))) if tech.site_queue != list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int)): raise ValueError("action is not updating site_queue as expected") # test sites_surveyed with full queue sites_surveyed = tech.sites_surveyed(gas_field, time) if (sites_surveyed != np.linspace(0, 99, 100, dtype=int)).any(): raise ValueError("sites_surveyed not identifying the correct sites")
def test_site_monitor(): gas_field = basic_gas_field() gas_field.met_data_path = 'TMY-DataExample.csv' time = sc.Time(delta_t=1, end_time=10, current_time=0) gas_field.met_data_maker() rep = Dm.repair.Repair(repair_delay=0) ogi = Dm.comp_survey.CompSurvey( time, survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, op_envelope={ # 'wind speed': {'class': 1, 'min': 1, 'max': 10}, # 'wind direction': {'class': 2, 'min': wind_dirs_mins, 'max': wind_dirs_maxs} }, site_queue=[], detection_probability_points=[1, 2], detection_probabilities=[0, 1] ) cm = Dm.site_monitor.SiteMonitor( time, time_to_detect_points=np.array([0.99, 1.0, 1.01]), time_to_detect_days=[np.infty, 1, 0], detection_variables={'flux': 'mean'}, dispatch_object=ogi, capital=1000, ophrs={'begin': 0, 'end': 24}, site_queue=list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int)) ) site_inds = list(range(0, 10)) emissions = copy.copy(gas_field.emissions.get_current_emissions(time)) detect = cm.detect_prob_curve(time, gas_field, site_inds, emissions) must_detect = [0, 9] must_not_detect = [2, 7, 8] for md in must_detect: if md not in detect: raise ValueError("site_monitor.detect_prob_curve not flagging the correct sites") for mnd in must_not_detect: if mnd in detect: raise ValueError("site_monitor.detect_prob_curve flagging sites that it should not") ttd_list = [] ttd = 0 time.delta_t = 0.1 for ind in range(1000): ttd += time.delta_t detect = cm.detect_prob_curve(time, gas_field, site_inds, emissions) if 1 in detect: ttd_list.append(ttd) ttd = 0 if np.abs(np.mean(ttd_list) - 1) > 0.5: raise ValueError("Mean time to detection deviates from expected value by >5 sigma in site_monitor test") if cm.deployment_cost.get_sum_val(0, 1) != 1000: raise ValueError("SiteMonitor deployment cost is not calculated correctly.") cm.detect(time, gas_field, emissions)
def test_results_analysis(): gf = basic_gas_field() timeobj = feast.EmissionSimModules.simulation_classes.Time(delta_t=1, end_time=2) rep = Dm.repair.Repair(repair_delay=0) points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([ np.math.erf((np.log(f) - np.log(0.02)) / (0.8 * np.sqrt(2))) for f in points ]) for ind in range(3): ogi = Dm.comp_survey.CompSurvey(timeobj, survey_interval=50, survey_speed=150, ophrs={ 'begin': 8, 'end': 17 }, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs, site_queue=[]) ogi_survey = Dm.ldar_program.LDARProgram(copy.deepcopy(gf), {'ogi': ogi}) sc = Esm.simulation_classes.Scenario( time=timeobj, gas_field=gf, ldar_program_dict={'ogi': ogi_survey}) # todo: test 'json' save method # sc2 = copy.deepcopy(sc) sc.run(display_status=False, dir_out='ResultsTemp', save_method='pickle') null_npv, emissions, techs = raf.results_analysis('ResultsTemp', 0.08, 2e-4) if len(null_npv.keys()) != 4: raise ValueError( "results analysis function returning the wrong number of keys") if null_npv['Finding'].shape != (1, 3): raise ValueError( "results analysis function returning the wrong number of realizations or LDAR programs in " + "null npv") if emissions.shape != (2, 2, 3): raise ValueError( "results analysis function returning the wrong number of realizations or " + "LDAR programs in emissions") for f in os.listdir('ResultsTemp'): os.remove(os.path.join('ResultsTemp', f)) os.rmdir('ResultsTemp')
def test_gasfield_leak_maker(): gf = basic_gas_field() new_leaks = lcf.Emission() time = sc.Time() time.current_time = 10 np.random.seed(0) gf.emission_maker(100, new_leaks, 'Fugitive', 0, time, gf.sites['basic pad']['parameters']) for f in new_leaks.emissions.flux: if f not in gf.comp_dict['Fugitive'].emission_params.leak_sizes['All']: raise ValueError("unexpected flux value") if np.abs( np.mean(new_leaks.emissions.end_time) - 1 / gf.comp_dict['Fugitive'].null_repair_rate) > 100: # Note: this is a probabilistic test, but in 1e7 iterations the test never failed randomly. raise ValueError("unexpected endtime distribution") return None
def test_check_op_envelope(): gas_field = basic_gas_field() gas_field.met_data_path = 'TMY-DataExample.csv' time = sc.Time(delta_t=1, end_time=10, current_time=0) gas_field.met_data_maker() rep = Dm.repair.Repair(repair_delay=0) wind_dirs_mins = np.zeros(gas_field.n_sites) wind_dirs_maxs = np.ones(gas_field.n_sites) * 90 points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.02)) / (0.8 * np.sqrt(2))) for f in points]) tech = Dm.comp_survey.CompSurvey( time, survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, op_envelope={ 'wind speed': {'class': 1, 'min': 1, 'max': 10}, 'wind direction': {'class': 2, 'min': wind_dirs_mins, 'max': wind_dirs_maxs} }, site_queue=[], detection_probability_points=points, detection_probabilities=probs ) op_env = tech.check_op_envelope(gas_field, time, 0) if op_env != 'site fail': raise ValueError("check_op_envelope is not returning 'site fail' as expected") if len(tech.op_env_site_fails.get_vals(0, 1)) != 1 or tech.op_env_site_fails.get_vals(0, 1)[0] != 1: raise ValueError("DetectionMethod.op_env_site_fails is not updated correctly") wind_dirs_mins = np.zeros([gas_field.n_sites, 2]) wind_dirs_mins[:, 1] = 145 wind_dirs_maxs = np.ones([gas_field.n_sites, 2]) * 90 wind_dirs_maxs[:, 1] += 145 tech.op_envelope['wind direction'] = {'class': 2, 'min': wind_dirs_mins, 'max': wind_dirs_maxs} op_env = tech.check_op_envelope(gas_field, time, 0) if op_env != 'site pass': raise ValueError("check_op_envelope is not passing as expected") tech.op_envelope['wind speed']['max'] = [2] op_env = tech.check_op_envelope(gas_field, time, 0) if op_env != 'field fail': raise ValueError("check_op_envelope is not retruning 'field fail' as expected") if tech.op_env_field_fails.get_sum_val(0, 1) != 1: raise ValueError("DetectionMethod.op_env_field_fails is not updated correctly")
def test_sitedetect_sites_surveyed(): gas_field = basic_gas_field() gas_field.met_data_path = 'TMY-DataExample.csv' time = sc.Time(delta_t=1, end_time=10, current_time=0) gas_field.met_data_maker() wind_dirs_mins = np.zeros(gas_field.n_sites) wind_dirs_maxs = np.ones(gas_field.n_sites) * 90 wind_dirs_maxs[50] = 270 points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.474)) / (1.36 * np.sqrt(2))) for f in points]) comp_survey = Dm.comp_survey.CompSurvey( time, dispatch_object=None, survey_interval=None, survey_speed=100, labor=100, site_queue=[], detection_probability_points=[1, 2], detection_probabilities=[0, 1], ophrs={'begin': 8, 'end': 17} ) tech = Dm.site_survey.SiteSurvey( time, survey_interval=50, sites_per_day=100, ophrs={'begin': 8, 'end': 17}, site_cost=100, dispatch_object=comp_survey, op_envelope={ 'wind speed': {'class': 1, 'min': 1, 'max': 10}, 'wind direction': {'class': 2, 'min': wind_dirs_mins, 'max': wind_dirs_maxs} }, detection_probability_points=points, detection_probabilities=probs ) tech.site_queue = list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int)) np.random.seed(0) sites_surveyed = tech.sites_surveyed(gas_field, time) if sites_surveyed != [50]: raise ValueError("sites_surveyed is not returning sites correctly")
def test_comp_survey(): gas_field = basic_gas_field() time = sc.Time(delta_t=1, end_time=10, current_time=0) rep = Dm.repair.Repair(repair_delay=0) points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.02)) / (0.8 * np.sqrt(2))) for f in points]) tech = Dm.comp_survey.CompSurvey( time, site_queue=list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int)), survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) emissions = gas_field.emissions.get_current_emissions(time) tech.action(list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int))) tech.detect(time, gas_field, emissions) if tech.deployment_count.get_sum_val(0, 1) != 14: raise ValueError("deployment count is not updated correctly in comp_survey") if np.abs(tech.deployment_cost.get_sum_val(0, 1) - 9 * 100) > 1e-5: raise ValueError("CompSurvey is not calculating deployment costs correctly") if np.max(emissions.site_index[emissions.index.isin(rep.to_repair)]) != 13: raise ValueError("tech.detect repairing emissions at incorrect sites") expected_detected_ids = [54, 55, 75, 66, 87, 62, 58, 84, 5, 25, 43, 71, 13, 79, 97] for ind in range(len(rep.to_repair)): if expected_detected_ids[ind] != rep.to_repair[ind]: raise ValueError("tech.detect not detecting the correct emissions") if len(expected_detected_ids) != len(rep.to_repair): raise ValueError("tech.detect not detecting the correct emissoins") rep.repair(time, gas_field.emissions) expected_repaired = gas_field.emissions.emissions.index.isin(expected_detected_ids) if np.max(gas_field.emissions.emissions.end_time[expected_repaired]) != 0: raise ValueError("rep.repair not adjusting the end times correctly")
def test_comp_survey_emitters_surveyed(): gas_field = basic_gas_field() gas_field.met_data_path = 'TMY-DataExample.csv' time = sc.Time(delta_t=1, end_time=10, current_time=0) gas_field.met_data_maker() rep = Dm.repair.Repair(repair_delay=0) wind_dirs_mins = np.zeros(gas_field.n_sites) wind_dirs_maxs = np.ones(gas_field.n_sites) * 90 points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.02)) / (0.8 * np.sqrt(2))) for f in points]) tech = Dm.comp_survey.CompSurvey( time, survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, op_envelope={ 'wind speed': {'class': 1, 'min': 1, 'max': 10}, 'wind direction': {'class': 2, 'min': wind_dirs_mins, 'max': wind_dirs_maxs} }, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs, site_queue=[] ) tech.action(list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int))) emissions = gas_field.emissions.get_current_emissions(time) emitter_inds = tech.emitters_surveyed(time, gas_field, emissions) if emitter_inds: # emitter_inds is expected to be [] raise ValueError("CompSurvey.emitters_surveyed is not returning expected emitter indexes") wind_dirs_maxs[11] = 200 emitter_inds = tech.emitters_surveyed(time, gas_field, emissions) if emitter_inds != [71]: # The wind direction op envelope was updated to pass at site 11 only. Site 11 has one emission at index 71. raise ValueError("CompSurvey.emitters_surveyed is not returning expected indexes")
def test_gas_field(): gf = basic_gas_field() if gf.n_sites != 100: raise ValueError( "gas_field.__init__() is defining gf.n_sites incorrectly.") if gf.n_comps != 10000: raise ValueError( "gas_field.__init__() is not defining gf.n_comps correctly") if gf.sites['basic pad']['parameters'].site_inds != [0, 100]: raise ValueError( "gas_field.__init__() is not defining gf.site_inds correctly") comp = gf.sites['basic pad']['parameters'].comp_dict['Fugitive'][ 'parameters'] new_emissions = gf.emissions.emissions[ gf.emissions.emissions.start_time > 0] if len(new_emissions.flux) > comp.emission_production_rate * 2 * gf.n_comps * 5 or \ len(new_emissions.flux) == 0: raise ValueError( "gas_field.__init__() is not generating new leaks as expected") timeobj = feast.EmissionSimModules.simulation_classes.Time(delta_t=1, end_time=2) if gf.met['solar intensity'][10] != 226: raise ValueError( "gas_field.met_data_maker is not loading TMY data correctly.") timeobj.current_time = 10 / 24 timeobj.delta_t = 1 / 24 met_dat = gf.get_met(timeobj, ['wind speed', 'solar intensity']) if met_dat['wind speed'] != 2.6 or met_dat['solar intensity'] != 226: raise ValueError("gas_field.get_met not returning the right values") timeobj.current_time = 365 timeobj.delta_t = 1 met_dat = gf.get_met(timeobj, ['wind speed', 'solar Intensity'], interp_modes=['max', 'min'], ophrs={ 'begin': 9, 'end': 17 }) if met_dat['solar intensity'] != 0: raise ValueError( "gas_field.get_met not returning the correct values when interp mode is min" ) if met_dat['wind speed'] != 4.1: raise ValueError( "gas_field.get_met not returning the correct values when max is specified" ) wd = gf.get_met(timeobj, ['wind direction'], interp_modes=['mean'], ophrs={ 'begin': 10, 'end': 11 }) gf.met_data_maker(100) wd2 = gf.get_met(timeobj, ['wind direction'], interp_modes=['mean'], ophrs={ 'begin': 10, 'end': 11 }) if wd2 == wd: raise ValueError( "gas_field.met_data_maker is not changing the start hour correctly" )
def test_scenario_run(): gas_field = basic_gas_field() timeobj = feast.EmissionSimModules.simulation_classes.Time(delta_t=1, end_time=2) rep = Dm.repair.Repair(repair_delay=0) points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.02)) / (0.8 * np.sqrt(2))) for f in points]) ogi = Dm.comp_survey.CompSurvey( timeobj, survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs, site_queue=[] ) ogi_no_survey = Dm.comp_survey.CompSurvey( timeobj, survey_interval=None, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs, site_queue=[] ) points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.474)) / (1.36 * np.sqrt(2))) for f in points]) plane_survey = Dm.site_survey.SiteSurvey( timeobj, survey_interval=50, sites_per_day=200, site_cost=100, dispatch_object=ogi_no_survey, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) ogi_survey = Dm.ldar_program.LDARProgram( copy.deepcopy(gas_field), {'ogi': ogi} ) tech_dict = { 'plane': plane_survey, 'ogi': ogi_no_survey } tiered_survey = Dm.ldar_program.LDARProgram( gas_field, tech_dict ) scenario = sc.Scenario(time=timeobj, gas_field=gas_field, ldar_program_dict={'tiered': tiered_survey, 'ogi': ogi_survey}) scenario.run(dir_out='ResultsTemp', display_status=False, save_method='pickle') with open('ResultsTemp/realization0.p', 'rb') as f: res = pickle.load(f) if res.ldar_program_dict['tiered'].emissions_timeseries[-1] >= \ res.ldar_program_dict['ogi'].emissions_timeseries[-1]: raise ValueError("Scenario.run is not returning emission reductions as expected") if res.ldar_program_dict['ogi'].emissions_timeseries[-1] >= res.ldar_program_dict['Null'].emissions_timeseries[-1]: raise ValueError("Scenario.run is not returning emission reductions as expected") for f in os.listdir('ResultsTemp'): os.remove(os.path.join('ResultsTemp', f)) os.rmdir('ResultsTemp')
def test_ldar_program(): gas_field = basic_gas_field() time = sc.Time(delta_t=1, end_time=10, current_time=0) rep = Dm.repair.Repair(repair_delay=0) points = np.logspace(-3, 1, 100) probs = 0.5 + 0.5 * np.array([np.math.erf((np.log(f) - np.log(0.02)) / (0.8 * np.sqrt(2))) for f in points]) probs[0] = 0 ogi = Dm.comp_survey.CompSurvey( time, site_queue=list(np.linspace(0, gas_field.n_sites - 1, gas_field.n_sites, dtype=int)), survey_interval=50, survey_speed=150, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) ogi_no_survey = Dm.comp_survey.CompSurvey( time, site_queue=[], survey_interval=None, survey_speed=100, ophrs={'begin': 8, 'end': 17}, labor=100, dispatch_object=rep, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) points = [0.5, 0.6] probs = [0, 1] probs[0] = 0 plane_survey = Dm.site_survey.SiteSurvey( time, survey_interval=50, sites_per_day=200, site_cost=100, dispatch_object=ogi_no_survey, detection_variables={'flux': 'mean'}, detection_probability_points=points, detection_probabilities=probs ) # test __init__ ogi_survey = Dm.ldar_program.LDARProgram( copy.deepcopy(gas_field), {'ogi': ogi} ) em = ogi_survey.emissions.get_current_emissions(time) if np.sum(em.flux) != 100: raise ValueError("Unexpected emission rate in LDAR program initialization") # test end_emissions ogi_survey.emissions.emissions.loc[0, 'end_time'] = 0 # test action ogi_survey.action(time, gas_field) em = ogi_survey.emissions.get_current_emissions(time) if np.sum(em.flux) != 84: raise ValueError("Unexpected emission rate after LDAR program action") # test combined program tech_dict = { 'plane': plane_survey, 'ogi': ogi_no_survey } tiered_survey = Dm.ldar_program.LDARProgram( gas_field, tech_dict ) # test action np.random.seed(0) tiered_survey.action(time, gas_field) em = tiered_survey.emissions.get_current_emissions(time) if np.sum(em.flux) != 86: raise ValueError("Unexpected emission rate after LDAR program action with tiered survey") time.current_time = 1 tiered_survey.calc_rep_costs(time) if tiered_survey.repair_cost.time_value[0][0] != 0 or len(tiered_survey.repair_cost.time_value) != 14 or \ tiered_survey.repair_cost.time_value[-1][-1] != 2: raise ValueError("tiered_survey.calc_rep_costs is not calculating the correct repair costs")