Commit d325647c authored by Grace Orowo Kagho's avatar Grace Orowo Kagho
Browse files

fix bug few new facilities added for detailed activity scenario

parent 6711b639
......@@ -7,6 +7,7 @@ import numpy as np
def configure(context):
context.stage("synthesis.population.destinations")
context.stage("synthesis.population.destinations_detailed")
context.stage("synthesis.population.enriched")
context.stage("synthesis.population.spatial.home.locations")
context.config("use_detailed_activities")
......@@ -59,32 +60,9 @@ def execute(context):
# First, write actual facilities (from STATENT)
df_statent = context.stage("synthesis.population.destinations")
if det_activities == "true":
if det_activities:
df_statent = context.stage("synthesis.population.destinations_detailed")
df_statent = df_statent[FIELDS_DETAILED]
M = np.max(df_statent["destination_id"].values.tolist()) + 1
df_home = context.stage("synthesis.population.spatial.home.locations").copy()[["household_id", "geometry"]].rename({"household_id": "destination_id"}, axis = 1)
df_home.loc[:, "destination_id"] = np.array(range(M, M + len(df_home), 1))
df_home.loc[:, "offers_visits"] = True
df_home.loc[:, "offers_work"] = False
df_home.loc[:, "offers_education"] = False
df_home.loc[:, "offers_leisure"] = False
df_home.loc[:, "offers_grocery"] = False
df_home.loc[:, "offers_other(S)"] = False
df_home.loc[:, "offers_culture"] = False
df_home.loc[:, "education_type"] = False
df_home.loc[:, "offers_religion"] = False
df_home.loc[:, "offers_gastronomy"] = False
df_home.loc[:, "offers_sport"] = False
df_home.loc[:, "offers_other(L)"] = False
df_home.loc[:, "offers_other"] = False
df_home.loc[:, "offers_volunteer"] = False
df_home.loc[:, "offers_outdoor"] = False
df_home.loc[:, "destination_x"] = df_home["geometry"].apply(lambda x: x.x).values
df_home.loc[:, "destination_y"] = df_home["geometry"].apply(lambda x: x.y).values
df_home = pd.DataFrame(df_home)
print(df_home["destination_id"])
df_statent = pd.concat([df_statent, df_home])
else:
df_statent = df_statent[FIELDS_NOT_DETAILED]
......@@ -96,7 +74,7 @@ def execute(context):
for item in context.progress(df_statent.itertuples(), total=len(df_statent)):
writer.start_facility(item[1], item[2], item[3])
if det_activities == "true":
if det_activities:
if item[4]: writer.add_activity("work")
if item[5]: writer.add_activity("education")
if item[6]: writer.add_activity("leisure")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment