コード例 #1
0
    parser.add_argument("--weather_coupling",
                        action="store",
                        type=str,
                        default="False",
                        help="boolean flag to enable/disable weather coupling")

    args, unknown = parser.parse_known_args()

    print("args: {}".format(args), file=sys.stderr)

    data_dir = os.path.join(work_dir, args.data_dir)

    coupled_locations = read_coupled_locations(
        os.path.join(data_dir, "coupled_locations.csv"))

    start_date, end_time = read_period.read_conflict_period(
        os.path.join(data_dir, "conflict_period.csv"))

    submodel = args.submodel.lower()
    coupling_type = args.coupling_type
    instance_index = int(args.instance_index)
    num_instances = int(args.num_instances)

    if args.weather_coupling.lower() == "true":
        weather_coupling = True
    else:
        weather_coupling = False

    if args.end_time is not None:
        end_time = int(args.end_time)
    last_physical_day = end_time
コード例 #2
0
from flee import InputGeography
import numpy as np
import flee.postprocessing.analysis as a
import sys

def AddInitialRefugees(e, d, loc):
  """ Add the initial refugees to a location, using the location name"""
  num_refugees = int(d.get_field(loc.name, 0, FullInterpolation=True))
  for i in range(0, num_refugees):
    e.addAgent(location=loc)

insert_day0_refugees_in_camps = True

if __name__ == "__main__":

  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()
コード例 #3
0
                        action="store", type=str, default='True',
                        help="boolean flag to enable/disable logging exchanged \
                        data between macro and micro models")

    parser.add_argument('--weather_coupling',
                        action="store", type=str, default='False',
                        help="boolean flag to enable/disable weather coupling")

    args, unknown = parser.parse_known_args()

    print("args: {}".format(args), file=sys.stderr)

    data_dir = os.path.join(work_dir, args.data_dir)
    coupled_locations = read_coupled_locations(
        os.path.join(data_dir, "coupled_locations.csv"))
    start_date, end_time = read_period.read_conflict_period(
        os.path.join(data_dir, "conflict_period.csv"))

    submodel = args.submodel
    coupling_type = args.coupling_type
    worker_index = int(args.worker_index)
    num_workers = int(args.num_workers)
    if args.weather_coupling.lower() == 'true':
        weather_coupling = True
    else:
        weather_coupling = False
    if args.end_time is not None:
        end_time = int(args.end_time)
    last_physical_day = end_time
    if args.log_exchange_data.lower() == 'true':
        log_exchange_data = True
    else: