# Path: discretize/utils/code_utils.py
# def is_scalar(f):
#     """Determine if the input argument is a scalar.
# 
#     The function **is_scalar** returns *True* if the input is an integer,
#     float or complex number. The function returns *False* otherwise.
# 
#     Parameters
#     ----------
#     f :
#         Any input quantity
# 
#     Returns
#     -------
#     bool :
# 
#         - *True* if the input argument is an integer, float or complex number
#         - *False* otherwise
# 
# 
#     """
# 
#     if isinstance(f, SCALARTYPES):
#         return True
#     elif isinstance(f, np.ndarray) and f.size == 1 and isinstance(f[0], SCALARTYPES):
#         return True
#     return False
# 
# Path: discretize/utils/code_utils.py
# def deprecate_function(new_function, old_name, removal_version=None, future_warn=False):
#     if future_warn:
#         Warning = FutureWarning
#     else:
#         Warning = DeprecationWarning
#     new_name = new_function.__name__
#     if removal_version is not None:
#         tag = f" It will be removed in version {removal_version} of discretize."
#     else:
#         tag = " It will be removed in a future version of discretize."
# 
#     def dep_function(*args, **kwargs):
#         warnings.warn(
#             f"{old_name} has been deprecated, please use {new_name}." + tag,
#             Warning,
#         )
#         return new_function(*args, **kwargs)
# 
#     doc = f"""
#     `{old_name}` has been deprecated. See `{new_name}` for documentation
# 
#     See Also
#     --------
#     {new_name}
#     """
#     dep_function.__doc__ = doc
#     return dep_function


import numpy as np
import scipy.ndimage as ndi
import scipy.sparse as sp
import discretize
import warnings
from discretize.utils.code_utils import is_scalar
from scipy.spatial import cKDTree, Delaunay
from scipy import interpolate
from discretize.utils.code_utils import deprecate_function
                )
            elif mesh.dim == 2:
                locations = np.vstack(
                    [
                        gridN[:-1, 1:].reshape((-1, mesh.dim), order="F"),
                        gridN[1:, 1:].reshape((-1, mesh.dim), order="F"),
                    ]
                )

    # Interpolate z values on CC or N
    z_xyz = z_interpolate(locations[:, :-1]).squeeze()

    # Apply nearest neighbour if in extrapolation
    ind_nan = np.isnan(z_xyz)
    if any(ind_nan):
        tree = cKDTree(xyz)
        _, ind = tree.query(locations[ind_nan, :])
        z_xyz[ind_nan] = xyz[ind, dim]

    # Create an active bool of all True
    active = np.all(
        (locations[:, dim] < z_xyz).reshape((mesh.nC, -1), order="F"), axis=1
    )

    return active.ravel()




meshTensor = deprecate_function(unpack_widths, "meshTensor", removal_version="1.0.0", future_warn=False)

# Path: discretize/utils/code_utils.py
# def is_scalar(f):
#     """Determine if the input argument is a scalar.
# 
#     The function **is_scalar** returns *True* if the input is an integer,
#     float or complex number. The function returns *False* otherwise.
# 
#     Parameters
#     ----------
#     f :
#         Any input quantity
# 
#     Returns
#     -------
#     bool :
# 
#         - *True* if the input argument is an integer, float or complex number
#         - *False* otherwise
# 
# 
#     """
# 
#     if isinstance(f, SCALARTYPES):
#         return True
#     elif isinstance(f, np.ndarray) and f.size == 1 and isinstance(f[0], SCALARTYPES):
#         return True
#     return False
# 
# Path: discretize/utils/code_utils.py
# def deprecate_function(new_function, old_name, removal_version=None, future_warn=False):
#     if future_warn:
#         Warning = FutureWarning
#     else:
#         Warning = DeprecationWarning
#     new_name = new_function.__name__
#     if removal_version is not None:
#         tag = f" It will be removed in version {removal_version} of discretize."
#     else:
#         tag = " It will be removed in a future version of discretize."
# 
#     def dep_function(*args, **kwargs):
#         warnings.warn(
#             f"{old_name} has been deprecated, please use {new_name}." + tag,
#             Warning,
#         )
#         return new_function(*args, **kwargs)
# 
#     doc = f"""
#     `{old_name}` has been deprecated. See `{new_name}` for documentation
# 
#     See Also
#     --------
#     {new_name}
#     """
#     dep_function.__doc__ = doc
#     return dep_function


# Path: discretize/utils/mesh_utils.py
import numpy as np
import scipy.ndimage as ndi
import scipy.sparse as sp
import discretize
import warnings
from discretize.utils.code_utils import is_scalar
from scipy.spatial import cKDTree, Delaunay
from scipy import interpolate
from discretize.utils.code_utils import deprecate_function

                )
            elif mesh.dim == 2:
                locations = np.vstack(
                    [
                        gridN[:-1, 1:].reshape((-1, mesh.dim), order="F"),
                        gridN[1:, 1:].reshape((-1, mesh.dim), order="F"),
                    ]
                )

    # Interpolate z values on CC or N
    z_xyz = z_interpolate(locations[:, :-1]).squeeze()

    # Apply nearest neighbour if in extrapolation
    ind_nan = np.isnan(z_xyz)
    if any(ind_nan):
        tree = cKDTree(xyz)
        _, ind = tree.query(locations[ind_nan, :])
        z_xyz[ind_nan] = xyz[ind, dim]

    # Create an active bool of all True
    active = np.all(
        (locations[:, dim] < z_xyz).reshape((mesh.nC, -1), order="F"), axis=1
    )

    return active.ravel()




meshTensor = deprecate_function(unpack_widths, "meshTensor", removal_version="1.0.0", future_warn=False)

closestPoints = deprecate_function(