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(deprecated): remove additional deprecated classes and functions #1204

Merged
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
1 change: 0 additions & 1 deletion autotest/t042_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
get_transmissivities,
get_water_table,
get_gradients,
get_saturated_thickness,
)

mf = flopy.modflow
Expand Down
8 changes: 0 additions & 8 deletions flopy/discretization/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,19 +745,11 @@ def attribs_from_namfile_header(self, namefile):
elif "xul" in item.lower():
try:
xul = float(item.split(":")[1])
warnings.warn(
"xul/yul have been deprecated. Use xll/yll instead.",
DeprecationWarning,
)
except:
pass
elif "yul" in item.lower():
try:
yul = float(item.split(":")[1])
warnings.warn(
"xul/yul have been deprecated. Use xll/yll instead.",
DeprecationWarning,
)
except:
pass
elif "rotation" in item.lower():
Expand Down
5 changes: 0 additions & 5 deletions flopy/mbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,6 @@ def __init__(
yll = kwargs.pop("yll", None)
self._xul = kwargs.pop("xul", None)
self._yul = kwargs.pop("yul", None)
if self._xul is not None or self._yul is not None:
warnings.warn(
"xul/yul have been deprecated. Use xll/yll instead.",
DeprecationWarning,
)

self._rotation = kwargs.pop("rotation", 0.0)
self._proj4_str = kwargs.pop("proj4_str", None)
Expand Down
10 changes: 0 additions & 10 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,7 @@ def __init__(
xll = kwargs.pop("xll", None)
yll = kwargs.pop("yll", None)
self._xul = kwargs.pop("xul", None)
if self._xul is not None:
warnings.warn(
"xul/yul have been deprecated. Use xll/yll instead.",
DeprecationWarning,
)
self._yul = kwargs.pop("yul", None)
if self._yul is not None:
warnings.warn(
"xul/yul have been deprecated. Use xll/yll instead.",
DeprecationWarning,
)
rotation = kwargs.pop("rotation", 0.0)
proj4 = kwargs.pop("proj4_str", None)
# build model grid object
Expand Down
4 changes: 0 additions & 4 deletions flopy/plot/plotutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2529,10 +2529,6 @@ def _set_coord_info(mg, xul, yul, xll, yll, rotation):
import warnings

if xul is not None and yul is not None:
warnings.warn(
"xul/yul have been deprecated. Use xll/yll instead.",
DeprecationWarning,
)
if rotation is not None:
mg._angrot = rotation

Expand Down
1 change: 0 additions & 1 deletion flopy/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@
from .optionblock import OptionBlock
from .rasters import Raster
from .gridintersect import GridIntersect, ModflowGridIndices
from .binarygrid_util import MfGrdFile
42 changes: 0 additions & 42 deletions flopy/utils/binarygrid_util.py

This file was deleted.

36 changes: 0 additions & 36 deletions flopy/utils/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,42 +701,6 @@ def transform(
return xrot, yrot


def shape(pyshp_shpobj):
"""
Convert a pyshp geometry object to a flopy geometry object.

Parameters
----------
pyshp_shpobj : shapefile._Shape instance

Returns
-------
shape : flopy.utils.geometry Polygon, Linestring, or Point

Notes
-----
Currently only regular Polygons, LineStrings and Points (pyshp types 5, 3, 1) supported.

Examples
--------
>>> import shapefile as sf
>>> from flopy.utils.geometry import shape
>>> sfobj = sf.Reader('shapefile.shp')
>>> flopy_geom = shape(list(sfobj.iterShapes())[0])

"""
import warnings

warnings.warn(
"Method will be Deprecated, calling GeoSpatialUtil",
DeprecationWarning,
)

from .geospatial_utils import GeoSpatialUtil

return GeoSpatialUtil(pyshp_shpobj).flopy_geometry


def get_polygon_area(geom):
"""
Calculate the area of a closed polygon
Expand Down
17 changes: 0 additions & 17 deletions flopy/utils/gridgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,13 +1379,6 @@ def get_cellxy(self, ncells):
cellxy[n, 1] = y
return cellxy

def get_gridprops(self):
msg = (
"Use: "
"get_gridprops_disu5, get_gridprops_disu6, get_gridprops_disv"
)
raise DeprecationWarning(msg)

@staticmethod
def gridarray_to_flopyusg_gridarray(nodelay, a):
nlay = nodelay.shape[0]
Expand Down Expand Up @@ -1680,16 +1673,6 @@ def get_gridprops_unstructuredgrid(self):

return gridprops

def to_disu6(self, fname, writevertices=True):
raise DeprecationWarning(
"Use: flopy.mf6.ModflowGwfdisu(gwf, **g.get_gridprops_disu6())"
)

def to_disv6(self, fname, verbose=False):
raise DeprecationWarning(
"Use: flopy.mf6.ModflowGwfdisv(gwf, **g.get_gridprops_disv())"
)

def intersect(self, features, featuretype, layer):
"""
Parameters
Expand Down
68 changes: 0 additions & 68 deletions flopy/utils/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,74 +167,6 @@ def get_water_table(heads, nodata, per_idx=None):
return np.squeeze(wt)


def get_saturated_thickness(heads, m, nodata, per_idx=None):
"""
Calculates the saturated thickness for each cell from the heads
array for each stress period.

Parameters
----------
heads : 3 or 4-D np.ndarray
Heads array.
m : flopy.modflow.Modflow object
Must have a flopy.modflow.ModflowDis object attached.
nodata : float, list
HDRY value indicating dry cells and/or HNOFLO values.
per_idx : int or sequence of ints
stress periods to return. If None,
returns all stress periods (default).

Returns
-------
sat_thickness : 3 or 4-D np.ndarray
Array of saturated thickness
"""
warnings.warn(
"postprocessing.get_saturated_thickness will be deprecated and "
"removed in version 3.3.5. Use grid.saturated_thick(heads).",
PendingDeprecationWarning,
)

if not isinstance(nodata, list):
nodata = [nodata]
heads = np.array(heads, ndmin=4)
for mv in nodata:
heads[heads == mv] = np.nan

top = m.dis.top.array
botm = m.dis.botm.array
top.shape = (1,) + botm.shape[1:]
top = np.concatenate((top, botm[0:-1]), axis=0)
thickness = m.modelgrid.thick
nper, nlay, nrow, ncol = heads.shape
if per_idx is None:
per_idx = list(range(nper))
elif np.isscalar(per_idx):
per_idx = [per_idx]

# get confined or unconfined/convertible info
laytyp = m.laytyp
if len(laytyp.shape) == 1:
laytyp.shape = (m.nlay, 1, 1)
is_conf = np.logical_and(
(laytyp == 0), np.full(m.modelgrid.shape, True)
)
else:
is_conf = laytyp == 0

# calculate saturated thickness
sat_thickness = []
for per in per_idx:
hds = heads[per]
hds = np.where(hds < botm, botm, hds) # for NWT when hds < botm
unconf_thickness = np.where(hds > top, top - botm, hds - botm)
perthickness = np.where(is_conf, thickness, unconf_thickness)
sat_thickness.append(perthickness)
sat_thickness = np.squeeze(sat_thickness)

return sat_thickness


def get_gradients(heads, m, nodata, per_idx=None):
"""
Calculates the hydraulic gradients from the heads
Expand Down
96 changes: 0 additions & 96 deletions flopy/utils/util_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,38 +659,6 @@ def export(self, f, **kwargs):

return export.utils.array3d_export(f, self, **kwargs)

def to_shapefile(self, filename):
"""
Export 3-D model data to shapefile (polygons). Adds an
attribute for each Util2d in self.u2ds

Parameters
----------
filename : str
Shapefile name to write

Returns
----------
None

See Also
--------

Notes
-----

Examples
--------
>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.lpf.hk.to_shapefile('test_hk.shp')
"""
warn(
"Deprecation warning: to_shapefile() is deprecated. use .export()",
DeprecationWarning,
)
self.export(filename)

def plot(
self,
filename_base=None,
Expand Down Expand Up @@ -1494,38 +1462,6 @@ def get_zero_2d(self, kper):
array_free_format=self.array_free_format,
)

def to_shapefile(self, filename):
"""
Export transient 2D data to a shapefile (as polygons). Adds an
attribute for each unique Util2d instance in self.data

Parameters
----------
filename : str
Shapefile name to write

Returns
----------
None

See Also
--------

Notes
-----

Examples
--------
>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.rch.rech.as_shapefile('test_rech.shp')
"""
warn(
"Deprecation warning: to_shapefile() is deprecated. use .export()",
DeprecationWarning,
)
self.export(filename)

def plot(
self,
filename_base=None,
Expand Down Expand Up @@ -2076,38 +2012,6 @@ def export(self, f, **kwargs):

return export.utils.array2d_export(f, self, **kwargs)

def to_shapefile(self, filename):
"""
Export 2-D model data to a shapefile (as polygons) of self.array

Parameters
----------
filename : str
Shapefile name to write

Returns
----------
None

See Also
--------

Notes
-----

Examples
--------
>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.dis.top.as_shapefile('test_top.shp')
"""

warn(
"Deprecation warning: to_shapefile() is deprecated. use .export()",
DeprecationWarning,
)
self.export(filename)

def set_fmtin(self, fmtin):
self._format = ArrayFormat(
self,
Expand Down