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

Get mean of actual values (do not imply missing == 0) in Streetscape #675

Merged
merged 1 commit into from
Nov 28, 2024
Merged
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
24 changes: 12 additions & 12 deletions momepy/streetscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,13 @@ def _compute_sigthlines_indicators(self, street_row, optimize_on=True):
left_sl_count = 0
left_sl_distance_total = 0
left_sl_building_count = 0
left_sl_building_sb_total = 0
left_sl_building_sb_height_total = 0
left_sl_building_sb = []
left_sl_building_sb_heights = []
right_sl_count = 0
right_sl_distance_total = 0
right_sl_building_count = 0
right_sl_building_sb_total = 0
right_sl_building_sb_height_total = 0
right_sl_building_sb = []
right_sl_building_sb_heights = []

left_sl_cr_total = 0
right_sl_cr_total = 0
Expand Down Expand Up @@ -674,8 +674,8 @@ def _compute_sigthlines_indicators(self, street_row, optimize_on=True):
left_sl_cr_total += sl_cr_total
if match_sl_building_id:
left_sl_building_count += 1
left_sl_building_sb_total += match_sl_distance
left_sl_building_sb_height_total += match_sl_building_height
left_sl_building_sb.append(match_sl_distance)
left_sl_building_sb_heights.append(match_sl_building_height)
# PREVALENCE: Emit each time a new setback or INTER-setback is
# found (campact storage structure)
current_street_left_seq_sb_ids.append(match_sl_building_id)
Expand All @@ -693,8 +693,8 @@ def _compute_sigthlines_indicators(self, street_row, optimize_on=True):
right_sl_cr_total += sl_cr_total
if match_sl_building_id:
right_sl_building_count += 1
right_sl_building_sb_total += match_sl_distance
right_sl_building_sb_height_total += match_sl_building_height
right_sl_building_sb.append(match_sl_distance)
right_sl_building_sb_heights.append(match_sl_building_height)
# PREVALENCE: Emit each time a new setback or INTER-setback is
# found (campact storage structure)
current_street_right_seq_sb_ids.append(match_sl_building_id)
Expand All @@ -721,8 +721,8 @@ def _compute_sigthlines_indicators(self, street_row, optimize_on=True):
left_h = np.nan
left_hw = np.nan
if left_sb_count != 0:
left_sb = left_sl_building_sb_total / left_sb_count
left_h = left_sl_building_sb_height_total / left_sb_count
left_sb = np.nanmean(left_sl_building_sb)
left_h = np.nanmean(left_sl_building_sb_heights)
# HACk if sb = 0 --> 10cm
left_hw = left_h / max(left_sb, 0.1)
left_cr = left_sl_cr_total / left_os_count
Expand All @@ -734,8 +734,8 @@ def _compute_sigthlines_indicators(self, street_row, optimize_on=True):
right_h = np.nan
right_hw = np.nan
if right_sb_count != 0:
right_sb = right_sl_building_sb_total / right_sb_count
right_h = right_sl_building_sb_height_total / right_sb_count
right_sb = np.nanmean(right_sl_building_sb)
right_h = np.nanmean(right_sl_building_sb_heights)
# HACk if sb = 0 --> 10cm
right_hw = right_h / max(right_sb, 0.1)
right_cr = right_sl_cr_total / right_os_count
Expand Down