def make_model(g): e = flee.Ecosystem() locations = [] camp_loc = [] camp_name = [] for nr, n in enumerate(G2.nodes()): style = G2.nodes[n]['Location_type'] locations.append( e.addLocation(str(n), movechance=style, capacity=1, pop=1_000_000)) if style == 'conflict': e.add_conflict_zone(str(n)) if style == 'camp': camp_loc.append(nr) camp_name.append(str(n)) # Add edges and their corresponding length for node0, node1 in g.edges: e.linkUp(str(node0), str(node1), g.edges[(node0, node1)]['len']) return e, locations, camp_name, camp_loc
start_date,end_time = read_period.read_conflict_period("{}/conflict_period.csv".format(sys.argv[1])) if len(sys.argv)<4: print("Please run using: python3 run.py <your_csv_directory> <your_refugee_data_directory> <duration in days> <optional: simulation_settings.csv> > <output_directory>/<output_csv_filename>") input_csv_directory = sys.argv[1] validation_data_directory = sys.argv[2] if int(sys.argv[3]) > 0: end_time = int(sys.argv[3]) if len(sys.argv)==5: flee.SimulationSettings.ReadFromCSV(sys.argv[4]) flee.SimulationSettings.FlareConflictInputFile = "%s/conflicts.csv" % input_csv_directory e = flee.Ecosystem() ig = InputGeography.InputGeography() ig.ReadFlareConflictInputCSV(flee.SimulationSettings.FlareConflictInputFile) ig.ReadLocationsFromCSV("%s/locations.csv" % input_csv_directory) ig.ReadLinksFromCSV("%s/routes.csv" % input_csv_directory) ig.ReadClosuresFromCSV("%s/closures.csv" % input_csv_directory) e,lm = ig.StoreInputGeographyInEcosystem(e) d = handle_refugee_data.RefugeeTable(csvformat="generic", data_directory=validation_data_directory, start_date=start_date, data_layout="data_layout.csv")