# Path: data_cube_utilities/vegetation.py
# def EVI(ds, G=2.5, C1=6, C2=7.5, L=1, normalize=True):
#     """
#     Computes the 3-band Enhanced Vegetation Index for an `xarray.Dataset`.
#     The formula is G * (NIR - RED) / (NIR + C1*RED - C2*BLUE + L).
#     Usually, G = 2.5, C1 = 6, C2 = 7.5, and L = 1.
#     For Landsat data, returned values should be in the range [-1,1] if `normalize == True`.
#     If `normalize == False`, returned values should be in the range [-1,2.5].
# 
#     EVI is superior to NDVI in accuracy because it is less dependent on the solar
#     incidence angle, atmospheric conditions (e.g. particles and clouds), shadows, and
#     soil appearance.
# 
#     Parameters
#     ----------
#     ds: xarray.Dataset
#         An `xarray.Dataset` that must contain 'nir', 'red', and 'blue' `DataArrays`.
#     G, C1, C2, L: float
#         G is the gain factor - a constant scaling factor.
#         C1 and C2 pertain to aerosols in clouds.
#         L adjusts for canopy background and soil appearance. It particularly pertains to
#         the nir and red bands, which are transmitted non-linearly through a canopy.
#     normalize: boolean
#         Whether to normalize to the range [-1,1] - the range of most common spectral indices.
# 
#     Returns
#     -------
#     evi: xarray.DataArray
#         An `xarray.DataArray` with the same shape as `ds` - the same coordinates in
#         the same order.
#     """
#     evi = G * (ds.nir - ds.red) / (ds.nir + C1 * ds.red - C2 * ds.blue + L)
#     # Clamp values to the range [-1,2.5].
#     evi.values[evi.values < -1] = -1
#     evi.values[2.5 < evi.values] = 2.5
#     if normalize:
#         # Scale values in the  range [0,2.5] to the range [0,1].
#         pos_vals_mask = 0 < evi.values
#         evi.values[pos_vals_mask] = np.interp(evi.values[pos_vals_mask], (0, 2.5), (0, 1))
#     return evi
# 
# def EVI2(ds, G=2.5, C=2.4, L=1, normalize=True):
#     """
#     Computes the 2-band Enhanced Vegetation Index for an `xarray.Dataset`.
#     The formula is G*((NIR-RED)/(NIR+C*Red+L)).
#     Usually, G = 2.5, C = 2.4, and L = 1.
#     For Landsat data, returned values should be in the range [-1,1] if `normalize == True`.
#     If `normalize == False`, returned values should be in the range [-1,2.5].
# 
#     EVI2 does not require a blue band like EVI, which means less data is required to use it.
#     Additionally, the blue band used in EVI can have a low signal-to-noise ratio
#     in earth observation imagery. When atmospheric effects are insignificant (e.g. on clear days),
#     EVI2 should closely match EVI.
# 
#     Parameters
#     ----------
#     ds: xarray.Dataset
#         An `xarray.Dataset` that must contain 'nir', and 'red' `DataArrays`.
#     G, C, L: float
#         G is the gain factor - a constant scaling factor.
#         C pertains to aerosols in clouds.
#         L adjusts for canopy background and soil appearance. It particularly pertains to
#         the nir and red bands, which are transmitted non-linearly through a canopy.
#     normalize: boolean
#         Whether to normalize to the range [-1,1] - the range of most common spectral indices.
# 
#     Returns
#     -------
#     evi: xarray.DataArray
#         An `xarray.DataArray` with the same shape as `ds` - the same coordinates in
#         the same order.
#     """
#     evi = G * (ds.nir - ds.red) / (ds.nir + C * ds.red + L)
#     # Clamp values to the range [-1,2.5].
#     evi.values[evi.values < -1] = -1
#     evi.values[2.5 < evi.values] = 2.5
#     if normalize:
#         # Scale values in the  range [0,2.5] to the range [0,1].
#         pos_vals_mask = 0 < evi.values
#         evi.values[pos_vals_mask] = np.interp(evi.values[pos_vals_mask], (0, 2.5), (0, 1))
#     return evi
# 
# def NDVI(ds):
#     """
#     Computes the Normalized Difference Vegetation Index for an `xarray.Dataset`.
#     The formula is (NIR - RED) / (NIR + RED).
#     Values should be in the range [-1,1] for valid LANDSAT data (nir and red are positive).
# 
#     Parameters
#     ----------
#     ds: xarray.Dataset
#         An `xarray.Dataset` that must contain 'nir' and 'red' `DataArrays`.
# 
#     Returns
#     -------
#     ndvi: xarray.DataArray
#         An `xarray.DataArray` with the same shape as `ds` - the same coordinates in
#         the same order.
#     """
#     return (ds.nir - ds.red) / (ds.nir + ds.red)


import xarray as xr
import numpy as np
from .vegetation import EVI as _EVI_orig, EVI2 as _EVI2_orig, NDVI as _NDVI_orig
    from .dc_water_classifier import wofs_classify
# This import is only for


def EVI(*args, **kwargs):
    """
    Instead of this function, please use the EVI() function in vegetation.py.
    """
    return _EVI_orig(*args, **kwargs)


def EVI2(*args, **kwargs):
    """
    Instead of this function, please use the EVI2() function in vegetation.py.
    """
    return _EVI2_orig(*args, **kwargs)


def NDVI(*args, **kwargs):
    """
    Instead of this function, please use the NDVI() function in vegetation.py.
    """

# Path: data_cube_utilities/vegetation.py
# def EVI(ds, G=2.5, C1=6, C2=7.5, L=1, normalize=True):
#     """
#     Computes the 3-band Enhanced Vegetation Index for an `xarray.Dataset`.
#     The formula is G * (NIR - RED) / (NIR + C1*RED - C2*BLUE + L).
#     Usually, G = 2.5, C1 = 6, C2 = 7.5, and L = 1.
#     For Landsat data, returned values should be in the range [-1,1] if `normalize == True`.
#     If `normalize == False`, returned values should be in the range [-1,2.5].
# 
#     EVI is superior to NDVI in accuracy because it is less dependent on the solar
#     incidence angle, atmospheric conditions (e.g. particles and clouds), shadows, and
#     soil appearance.
# 
#     Parameters
#     ----------
#     ds: xarray.Dataset
#         An `xarray.Dataset` that must contain 'nir', 'red', and 'blue' `DataArrays`.
#     G, C1, C2, L: float
#         G is the gain factor - a constant scaling factor.
#         C1 and C2 pertain to aerosols in clouds.
#         L adjusts for canopy background and soil appearance. It particularly pertains to
#         the nir and red bands, which are transmitted non-linearly through a canopy.
#     normalize: boolean
#         Whether to normalize to the range [-1,1] - the range of most common spectral indices.
# 
#     Returns
#     -------
#     evi: xarray.DataArray
#         An `xarray.DataArray` with the same shape as `ds` - the same coordinates in
#         the same order.
#     """
#     evi = G * (ds.nir - ds.red) / (ds.nir + C1 * ds.red - C2 * ds.blue + L)
#     # Clamp values to the range [-1,2.5].
#     evi.values[evi.values < -1] = -1
#     evi.values[2.5 < evi.values] = 2.5
#     if normalize:
#         # Scale values in the  range [0,2.5] to the range [0,1].
#         pos_vals_mask = 0 < evi.values
#         evi.values[pos_vals_mask] = np.interp(evi.values[pos_vals_mask], (0, 2.5), (0, 1))
#     return evi
# 
# def EVI2(ds, G=2.5, C=2.4, L=1, normalize=True):
#     """
#     Computes the 2-band Enhanced Vegetation Index for an `xarray.Dataset`.
#     The formula is G*((NIR-RED)/(NIR+C*Red+L)).
#     Usually, G = 2.5, C = 2.4, and L = 1.
#     For Landsat data, returned values should be in the range [-1,1] if `normalize == True`.
#     If `normalize == False`, returned values should be in the range [-1,2.5].
# 
#     EVI2 does not require a blue band like EVI, which means less data is required to use it.
#     Additionally, the blue band used in EVI can have a low signal-to-noise ratio
#     in earth observation imagery. When atmospheric effects are insignificant (e.g. on clear days),
#     EVI2 should closely match EVI.
# 
#     Parameters
#     ----------
#     ds: xarray.Dataset
#         An `xarray.Dataset` that must contain 'nir', and 'red' `DataArrays`.
#     G, C, L: float
#         G is the gain factor - a constant scaling factor.
#         C pertains to aerosols in clouds.
#         L adjusts for canopy background and soil appearance. It particularly pertains to
#         the nir and red bands, which are transmitted non-linearly through a canopy.
#     normalize: boolean
#         Whether to normalize to the range [-1,1] - the range of most common spectral indices.
# 
#     Returns
#     -------
#     evi: xarray.DataArray
#         An `xarray.DataArray` with the same shape as `ds` - the same coordinates in
#         the same order.
#     """
#     evi = G * (ds.nir - ds.red) / (ds.nir + C * ds.red + L)
#     # Clamp values to the range [-1,2.5].
#     evi.values[evi.values < -1] = -1
#     evi.values[2.5 < evi.values] = 2.5
#     if normalize:
#         # Scale values in the  range [0,2.5] to the range [0,1].
#         pos_vals_mask = 0 < evi.values
#         evi.values[pos_vals_mask] = np.interp(evi.values[pos_vals_mask], (0, 2.5), (0, 1))
#     return evi
# 
# def NDVI(ds):
#     """
#     Computes the Normalized Difference Vegetation Index for an `xarray.Dataset`.
#     The formula is (NIR - RED) / (NIR + RED).
#     Values should be in the range [-1,1] for valid LANDSAT data (nir and red are positive).
# 
#     Parameters
#     ----------
#     ds: xarray.Dataset
#         An `xarray.Dataset` that must contain 'nir' and 'red' `DataArrays`.
# 
#     Returns
#     -------
#     ndvi: xarray.DataArray
#         An `xarray.DataArray` with the same shape as `ds` - the same coordinates in
#         the same order.
#     """
#     return (ds.nir - ds.red) / (ds.nir + ds.red)


# Path: data_cube_utilities/dc_ndvi_anomaly.py
import xarray as xr
import numpy as np
from .vegetation import EVI as _EVI_orig, EVI2 as _EVI2_orig, NDVI as _NDVI_orig
    from .dc_water_classifier import wofs_classify

# This import is only for


def EVI(*args, **kwargs):
    """
    Instead of this function, please use the EVI() function in vegetation.py.
    """
    return _EVI_orig(*args, **kwargs)


def EVI2(*args, **kwargs):
    """
    Instead of this function, please use the EVI2() function in vegetation.py.
    """
    return _EVI2_orig(*args, **kwargs)


def NDVI(*args, **kwargs):
    """
    Instead of this function, please use the NDVI() function in vegetation.py.
    """

    return _NDVI_orig(*args, **kwargs)