Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoned_capacity_fix #377

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions baus/summaries/core_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def parcel_summary(run_name, parcels, buildings, households, jobs, year, initial
if year not in [initial_summary_year, final_year] + interim_summary_years:
return

df = parcels.to_frame(["geom_id", "x", "y", 'max_dua', 'built_dua', 'max_far', 'built_far'])
df = parcels.to_frame(["geom_id", "x", "y", 'max_dua', 'built_dua', 'max_far', 'built_far','parcel_softsite'])

# add building data for parcels
building_df = orca.merge_tables('buildings', [parcels, buildings], columns=['parcel_id', 'residential_units', 'deed_restricted_units',
Expand Down Expand Up @@ -55,7 +55,7 @@ def parcel_growth_summary(year, run_name, initial_summary_year, final_year):
index_col="parcel_id")

for col in df1.columns:
if col in ["geom_id", "x", "y"]:
if col in ["geom_id", "x", "y","parcel_softsite"]:
continue

# fill na with 0 otherwise it drops the parcel data during subtraction
Expand Down
36 changes: 25 additions & 11 deletions baus/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,13 @@ def ave_unit_sqft(buildings):

@orca.column('parcels_zoning_calculations', cache=True)
def zoned_du(parcels, parcels_zoning_calculations):
return parcels_zoning_calculations.effective_max_dua * parcels.parcel_acres
return parcels_zoning_calculations.max_dua * parcels.parcel_acres


@orca.column('parcels_zoning_calculations', cache=True)
def zoned_du_vacant(parcels, parcels_zoning_calculations):
return parcels_zoning_calculations.effective_max_dua * \
# zoned du capacity for vacant parcels only
return parcels_zoning_calculations.max_dua * \
parcels.parcel_acres * ~parcels.nodev * (parcels.total_sqft == 0)


Expand All @@ -952,16 +953,18 @@ def effective_max_dua(zoning_existing, parcels):

max_dua_from_height = max_far_from_height * 43560 / GROSS_AVE_UNIT_SIZE

s = pd.concat([zoning_existing.max_dua, max_dua_from_far, max_dua_from_height], axis=1).min(axis=1)
s = pd.concat([zoning_existing.max_dua,
max_dua_from_far,
max_dua_from_height], axis=1).min(axis=1)

# take the max dua IFF the upzone value is greater than the current value
# take the max dua IF the upzone value is greater than the current value
# i.e. don't let the upzoning operation accidentally downzone

strategy_max_dua = orca.get_table("zoning_strategy").dua_up

s = pd.concat([s, strategy_max_dua], axis=1).max(axis=1)

# take the min dua IFF the downzone value is less than the current value
# take the min dua IF the downzone value is less than the current value
# i.e. don't let the downzoning operation accidentally upzone

strategy_min_dua = orca.get_table("zoning_strategy").dua_down
Expand All @@ -979,15 +982,16 @@ def effective_max_dua(zoning_existing, parcels):
@orca.column('parcels_zoning_calculations')
def zoned_far(parcels, parcels_zoning_calculations):
# adding to help look at nonres capacity in model outputs
return parcels_zoning_calculations.effective_max_far * parcels.parcel_size
return parcels_zoning_calculations.max_far * parcels.parcel_size


@orca.column('parcels_zoning_calculations', cache=True)
def effective_max_far(zoning_existing, parcels):

max_far_from_height = (zoning_existing.max_height / HEIGHT_PER_STORY) * PARCEL_USE_EFFICIENCY

s = pd.concat([zoning_existing.max_far, max_far_from_height], axis=1).min(axis=1)
s = pd.concat([zoning_existing.max_far,
max_far_from_height], axis=1).min(axis=1)

# take the max far IFF the upzone value is greater than the current value
# i.e. don't let the upzoning operation accidentally downzone
Expand Down Expand Up @@ -1038,22 +1042,21 @@ def zoned_du_underbuild(parcels, parcels_zoning_calculations):
def zoned_du_build_ratio(parcels, parcels_zoning_calculations):
# ratio of existing res built space to zoned res built space
s = parcels.total_residential_units / \
(parcels_zoning_calculations.effective_max_dua * parcels.parcel_acres)
(parcels_zoning_calculations.zoned_du)
return s.replace(np.inf, 1).clip(0, 1)


@orca.column('parcels_zoning_calculations')
def zoned_far_underbuild(parcels, parcels_zoning_calculations):
# adding to help look at nonres capacity in model outputs
return parcels_zoning_calculations.zoned_far - parcels.total_non_residential_sqft
return (parcels_zoning_calculations.zoned_far - parcels.total_non_residential_sqft).clip(0)


@orca.column('parcels_zoning_calculations')
def zoned_far_build_ratio(parcels, parcels_zoning_calculations):
# ratio of existing nonres built space to zoned nonres built space
s = parcels.total_non_residential_sqft / \
(parcels_zoning_calculations.effective_max_far *
parcels.parcel_size)
parcels_zoning_calculations.zoned_far
return s.replace(np.inf, 1).clip(0, 1)


Expand All @@ -1063,3 +1066,14 @@ def zoned_build_ratio(parcels_zoning_calculations):
# build space
return parcels_zoning_calculations.zoned_du_build_ratio + \
parcels_zoning_calculations.zoned_far_build_ratio


@orca.column('parcels_zoning_calculations')
def parcel_softsite(parcels,parcels_zoning_calculations):

current_sqft = (parcels.total_non_residential_sqft.clip(0)
+ parcels.total_residential_units / GROSS_AVE_UNIT_SIZE )

# assume zoned far covers the envelope - including for residential
return (current_sqft / parcels_zoning_calculations.zoned_far).clip(0, 1)