Skip to content

Commit

Permalink
Modifies add_population, removing check when adding population to taz_df
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicacamacho committed Jun 21, 2019
1 parent 3f39760 commit dfe813a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions baus/summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def count_acres_with_mask(mask):
taz_df["resacre"] = scaled_resacre(
base_year_summary_taz.RESACRE_UNWEIGHTED, taz_df.resacre_unweighted)
rc = regional_controls.to_frame()
taz_df = add_population(taz_df, year, rc)
taz_df = add_population(taz_df, year, rc, check_close = False)
taz_df.totpop = taz_df.hhpop + taz_df.gqpop
taz_df = add_employment(taz_df, year, rc)
taz_df = add_age_categories(taz_df, year, rc)
Expand Down Expand Up @@ -1389,14 +1389,16 @@ def zone_forecast_inputs():
index_col="zone_id")


def add_population(df, year, regional_controls):
def add_population(df, year, regional_controls, check_close=True):
rc = regional_controls
target = rc.totpop.loc[year] - df.gqpop.sum()

zfi = zone_forecast_inputs()
s = df.tothh * zfi.meanhhsize

s = scale_by_target(s, target, .15)
if check_close == True:
s = scale_by_target(s, target, .15)
else:
s = scale_by_target(s, target)

df["hhpop"] = round_series_match_target(s, target, 0)
df["hhpop"] = df.hhpop.fillna(0)
Expand Down

0 comments on commit dfe813a

Please sign in to comment.