Skip to content

Commit

Permalink
Remove cells that are located around 3 walls to limit the risk of num…
Browse files Browse the repository at this point in the history
…erical issue
  • Loading branch information
j3r3m1 committed Dec 8, 2023
1 parent 7875e82 commit 0d0d353
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions functions/URock/InitWindField.py
Original file line number Diff line number Diff line change
Expand Up @@ -3242,6 +3242,20 @@ def identifyBuildPoints(cursor, gridPoint, stackedBlocksWithBaseHeight,
# Remove potential duplicated indexes
df_gridBuil = pd.DataFrame(index = df_gridBuil.index.drop_duplicates())

# Identify the cells located near buildings
df_wall_left = df_gridBuil.index.set_levels(df_gridBuil.index.levels[0] + 1, level=0)
df_wall_right = df_gridBuil.index.set_levels(df_gridBuil.index.levels[0] - 1, level=0)
df_wall_behind = df_gridBuil.index.set_levels(df_gridBuil.index.levels[1] + 1, level=1)
df_wall_face = df_gridBuil.index.set_levels(df_gridBuil.index.levels[1] - 1, level=1)

# Consider as buildings points which are surrounded by 3 vertical walls (leads to numerical issues... See issue #)
ind2remove = df_wall_left.intersection(df_wall_right).intersection(df_wall_behind)\
.union(df_wall_left.intersection(df_wall_right).intersection(df_wall_face))\
.union(df_wall_left.intersection(df_wall_behind).intersection(df_wall_face))\
.union(df_wall_right.intersection(df_wall_behind).intersection(df_wall_face))\
.difference(df_gridBuil.index)
df_gridBuil.index = df_gridBuil.index.append(ind2remove)

if not DEBUG:
# Remove intermediate tables
cursor.execute("""
Expand Down

0 comments on commit 0d0d353

Please sign in to comment.