Skip to content

Commit

Permalink
Fix(features_to_shapefile): fix missing bracket around linestring for…
Browse files Browse the repository at this point in the history
… shapefile (#1410)

* Fix(features_to_shapefile): fix missing bracket around linestring for shapefile

* remove debugging code

* update line representation for consistency with __geo_interface__ and flopy geometery LineString input geometry documentation

* update(gridgen examples): update linestring type examples to be consistent with flopy geometry objects and standard spatial __geo_reference__ formats

* Close #1405
  • Loading branch information
jlarsen-usgs authored May 6, 2022
1 parent 45a9e57 commit cadd216
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 98 deletions.
2 changes: 1 addition & 1 deletion autotest/t061_test_gridgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_gridgen():
assert n == 308, msg

# test the gridgen line intersection
line = [[[(Lx, Ly), (Lx, 0.0)]]]
line = [[(Lx, Ly), (Lx, 0.0)]]
cells = g.intersect(line, "line", 0)
nlist = [n for n in cells["nodenumber"]]
nlist2 = [
Expand Down
74 changes: 33 additions & 41 deletions examples/Notebooks/flopy3_gridgen.ipynb

Large diffs are not rendered by default.

96 changes: 42 additions & 54 deletions examples/Notebooks/flopy3_modpath7_unstructured_example.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/common/setup_pmv_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def run():
gwf, recharge=0.005, auxiliary=[("iface",)], aux={0: [6]}
)
# riv
riverline = [[[(Lx - 1.0, Ly), (Lx - 1.0, 0.0)]]]
riverline = [[(Lx - 1.0, Ly), (Lx - 1.0, 0.0)]]
rivcells = g.intersect(riverline, "line", 0)
rivspd = [
[(0, icpl), 320.0, 100000.0, 318] for icpl in rivcells["nodenumber"]
Expand Down
2 changes: 1 addition & 1 deletion flopy/utils/gridgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def features_to_shapefile(features, featuretype, filename):
wr = shapefile.Writer(filename, shapeType=shapefile.POLYLINE)
wr.field("SHAPEID", "N", 20, 0)
for i, line in enumerate(features):
wr.line(line.__geo_interface__["coordinates"])
wr.line([line.__geo_interface__["coordinates"]])
wr.record(i)

elif featuretype.lower() == "point":
Expand Down

0 comments on commit cadd216

Please sign in to comment.