-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STOFS scripts: Added a script for clipping automatically generated ar…
…cs so that they don't intersect with existing manual arcs.
- Loading branch information
1 parent
8c7d761
commit 89d8195
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Grid/clip_autoarcs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
''' | ||
This script clips the auto arcs to the watershed boundary, | ||
which is the part of domain that is not ocean, levee, or manually refined coastal polygons. | ||
A 50-m buffer is applied to the levee and refined coastal polygons to ensure that the auto arcs | ||
does not directly intersect with the levee and refined coastal polygons. | ||
However, no buffer is applied to the interface between watershed and ocean (i.e., shoreline) | ||
, allowing intersections between the auto arcs and shoreline to provide channels where | ||
there is no manual refinement. | ||
''' | ||
|
||
import geopandas as gpd | ||
|
||
wdir = '/sciclone/schism10/Hgrid_projects/STOFS3D-v7/new19/auto_arc_process/' | ||
crs = 'esri:102008' | ||
|
||
coastal = gpd.read_file(f'{wdir}/coastal.shp', crs=crs) | ||
lbnd_coastal = gpd.read_file(f'{wdir}/lbnd_coast.shp', crs=crs) | ||
|
||
raw_watershed = lbnd_coastal.overlay(coastal, how='difference').dissolve() | ||
|
||
coastal_refined_buf = gpd.GeoDataFrame(geometry=gpd.read_file(f'{wdir}/coastal_refined.shp', crs=crs).buffer(50)) | ||
levee_buf = gpd.GeoDataFrame(geometry=gpd.read_file(f'{wdir}/levee.shp', crs=crs).buffer(50)) | ||
|
||
watershed = raw_watershed.overlay(coastal_refined_buf, how='difference').dissolve() | ||
watershed = watershed.overlay(levee_buf, how='difference').dissolve() | ||
|
||
watershed.to_file(f'{wdir}/watershed.shp', crs=crs) | ||
watershed = gpd.read_file(f'{wdir}/watershed.shp', crs=crs) | ||
|
||
total_arcs = gpd.read_file(f'{wdir}/total_arcs.shp').to_crs(crs) | ||
total_arcs_clipped = total_arcs.clip(watershed) | ||
total_arcs_clipped.to_file(f'{wdir}/total_arcs_clipped.shp', crs=crs) | ||
|
||
pass |