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

Setbacks optimization #85

Merged
merged 3 commits into from
Jan 29, 2021
Merged
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
2 changes: 1 addition & 1 deletion reVX/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
reVX version number
"""

__version__ = "0.3.17"
__version__ = "0.3.18"
15 changes: 8 additions & 7 deletions reVX/wind_setbacks/wind_setbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ def _compute_local_setbacks(cls, features_fpath, crs, wind_regs,
if setback is not None:
logger.debug('- Computing setbacks for county FIPS {}'
.format(cnty.iloc[0]['FIPS']))
tmp = gpd.sjoin(features, cnty,
how='inner', op='intersects')
idx = features.sindex.intersection(cnty.total_bounds)
tmp = features.iloc[list(idx)]
mask = tmp.centroid.within(cnty['geometry'].values[0])
tmp = tmp.loc[mask]
tmp['geometry'] = tmp.buffer(setback)

setbacks.extend((geom, 1) for geom in tmp['geometry'])
Expand Down Expand Up @@ -786,7 +788,7 @@ def _parse_features(structure_fpath, crs):
Geometries for structures in geojson, in exclusion coordinate
system
"""
structures = gpd.read_file(structure_fpath, crs=crs)
structures = gpd.read_file(structure_fpath)

return structures.to_crs(crs=crs)

Expand Down Expand Up @@ -921,8 +923,7 @@ def _parse_features(roads_fpath, crs):
system
"""
lyr = fiona.listlayers(roads_fpath)[0]
roads = gpd.read_file(roads_fpath, driver='FileGDB', layer=lyr,
crs=crs)
roads = gpd.read_file(roads_fpath, driver='FileGDB', layer=lyr)

return roads.to_crs(crs=crs)

Expand Down Expand Up @@ -1082,7 +1083,7 @@ def _parse_features(transmission_fpath, crs):
Geometries for transmission features, in exclusion coordinate
system
"""
trans = gpd.read_file(transmission_fpath, crs=crs)
trans = gpd.read_file(transmission_fpath)

return trans.to_crs(crs=crs)

Expand Down Expand Up @@ -1313,6 +1314,6 @@ def _parse_features(rail_fpath, crs):
Geometries for rail features, in exclusion coordinate
system
"""
rail = gpd.read_file(rail_fpath, crs=crs)
rail = gpd.read_file(rail_fpath)

return rail.to_crs(crs=crs)
Binary file modified tests/data/setbacks/ri_setbacks.h5
Binary file not shown.