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

refactor(shapefile_utils): remove deprecated SpatialReference usages #1892

Merged
merged 1 commit into from
Aug 3, 2023
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
23 changes: 2 additions & 21 deletions flopy/export/shapefile_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
from ..utils import Util3d, flopy_io, import_optional_dependency
from ..utils.crs import get_crs

# web address of spatial reference dot org
srefhttp = "https://spatialreference.org"


def write_gridlines_shapefile(filename: Union[str, os.PathLike], mg):
"""
Expand All @@ -41,15 +38,7 @@ def write_gridlines_shapefile(filename: Union[str, os.PathLike], mg):
shapefile = import_optional_dependency("shapefile")
wr = shapefile.Writer(str(filename), shapeType=shapefile.POLYLINE)
wr.field("number", "N", 18, 0)
if mg.__class__.__name__ == "SpatialReference":
grid_lines = mg.get_grid_lines()
warnings.warn(
"SpatialReference has been deprecated. Use StructuredGrid"
" instead.",
category=DeprecationWarning,
)
else:
grid_lines = mg.grid_lines
grid_lines = mg.grid_lines
for i, line in enumerate(grid_lines):
wr.line([line])
wr.record(i)
Expand Down Expand Up @@ -112,15 +101,7 @@ def write_grid_shapefile(
w = shapefile.Writer(str(path), shapeType=shapefile.POLYGON)
w.autoBalance = 1

if mg.__class__.__name__ == "SpatialReference":
verts = copy.deepcopy(mg.vertices)
warnings.warn(
"SpatialReference has been deprecated. Use StructuredGrid"
" instead.",
category=DeprecationWarning,
)
mg.grid_type = "structured"
elif mg.grid_type == "structured":
if mg.grid_type == "structured":
verts = [
mg.get_cell_vertices(i, j)
for i in range(mg.nrow)
Expand Down