





"""simple docstring"""




# Imports
import numpy as np




class 			_a						:






				def __init__(			self		:   Tuple,			lowerCAmelCase__		:   Optional[Any]=None,			lowerCAmelCase__		:   Optional[Any]=None,			lowerCAmelCase__		:   List[Any]=None,			lowerCAmelCase__		:   Optional[Any]=None,			lowerCAmelCase__		:   List[Any]=None							)     ->				str:




										'''simple docstring'''



										self.set_matricies(red=lowerCAmelCase__,			green=lowerCAmelCase__,			blue=lowerCAmelCase__,			red_edge=lowerCAmelCase__,			nir=lowerCAmelCase__							)






				def     snake_case     (			self		:   str,			lowerCAmelCase__		:   Any=None,			lowerCAmelCase__		:   Dict=None,			lowerCAmelCase__		:   Optional[Any]=None,			lowerCAmelCase__		:   List[Any]=None,			lowerCAmelCase__		:   Tuple=None							)     ->				str:




										'''simple docstring'''



										if red is not None:
																_UpperCamelCase      : List[Any]         =   red
										if green is not None:
																_UpperCamelCase      : Any         =   green
										if blue is not None:
																_UpperCamelCase      : List[str]         =   blue
										if red_edge is not None:
																_UpperCamelCase      : int         =   red_edge
										if nir is not None:
																_UpperCamelCase      : Any         =   nir
										return True






				def     snake_case     (			self		:   str,			lowerCAmelCase__		:   str="",			lowerCAmelCase__		:   Any=None,			lowerCAmelCase__		:   str=None,			lowerCAmelCase__		:   List[str]=None,			lowerCAmelCase__		:   int=None,			lowerCAmelCase__		:   Tuple=None							)     ->				int:




										'''simple docstring'''



										self.set_matricies(red=lowerCAmelCase__,			green=lowerCAmelCase__,			blue=lowerCAmelCase__,			red_edge=lowerCAmelCase__,			nir=lowerCAmelCase__							)
										_UpperCamelCase      : Tuple         =   {
										    '''ARVI2''': self.arvaa,
										    '''CCCI''': self.ccci,
										    '''CVI''': self.cvi,
										    '''GLI''': self.gli,
										    '''NDVI''': self.ndvi,
										    '''BNDVI''': self.bndvi,
										    '''redEdgeNDVI''': self.red_edge_ndvi,
										    '''GNDVI''': self.gndvi,
										    '''GBNDVI''': self.gbndvi,
										    '''GRNDVI''': self.grndvi,
										    '''RBNDVI''': self.rbndvi,
										    '''PNDVI''': self.pndvi,
										    '''ATSAVI''': self.atsavi,
										    '''BWDRVI''': self.bwdrvi,
										    '''CIgreen''': self.ci_green,
										    '''CIrededge''': self.ci_rededge,
										    '''CI''': self.ci,
										    '''CTVI''': self.ctvi,
										    '''GDVI''': self.gdvi,
										    '''EVI''': self.evi,
										    '''GEMI''': self.gemi,
										    '''GOSAVI''': self.gosavi,
										    '''GSAVI''': self.gsavi,
										    '''Hue''': self.hue,
										    '''IVI''': self.ivi,
										    '''IPVI''': self.ipvi,
										    '''I''': self.i,
										    '''RVI''': self.rvi,
										    '''MRVI''': self.mrvi,
										    '''MSAVI''': self.m_savi,
										    '''NormG''': self.norm_g,
										    '''NormNIR''': self.norm_nir,
										    '''NormR''': self.norm_r,
										    '''NGRDI''': self.ngrdi,
										    '''RI''': self.ri,
										    '''S''': self.s,
										    '''IF''': self._if,
										    '''DVI''': self.dvi,
										    '''TVI''': self.tvi,
										    '''NDRE''': self.ndre,
										}

										try:
																return funcs[index]()
										except KeyError:
																print('''Index not in the list!'''							)
																return False






				def     snake_case     (			self		:   Any							)     ->				str:




										'''simple docstring'''



										return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))






				def     snake_case     (			self		:   str							)     ->				Optional[Any]:




										'''simple docstring'''



										return ((self.nir - self.redEdge) / (self.nir + self.redEdge)) / (
										    (self.nir - self.red) / (self.nir + self.red)
										)






				def     snake_case     (			self		:   str							)     ->				Tuple:




										'''simple docstring'''



										return self.nir * (self.red / (self.green**2))






				def     snake_case     (			self		:   Dict							)     ->				str:




										'''simple docstring'''



										return (2 * self.green - self.red - self.blue) / (
										    2 * self.green + self.red + self.blue
										)






				def     snake_case     (			self		:   int							)     ->				List[Any]:




										'''simple docstring'''



										return (self.nir - self.red) / (self.nir + self.red)






				def     snake_case     (			self		:   Union[str, Any]							)     ->				Union[str, Any]:




										'''simple docstring'''



										return (self.nir - self.blue) / (self.nir + self.blue)






				def     snake_case     (			self		:   Optional[Any]							)     ->				List[str]:




										'''simple docstring'''



										return (self.redEdge - self.red) / (self.redEdge + self.red)






				def     snake_case     (			self		:   Optional[int]							)     ->				List[str]:




										'''simple docstring'''



										return (self.nir - self.green) / (self.nir + self.green)






				def     snake_case     (			self		:   Optional[int]							)     ->				Tuple:




										'''simple docstring'''



										return (self.nir - (self.green + self.blue)) / (
										    self.nir + (self.green + self.blue)
										)






				def     snake_case     (			self		:   int							)     ->				Optional[Any]:




										'''simple docstring'''



										return (self.nir - (self.green + self.red)) / (
										    self.nir + (self.green + self.red)
										)






				def     snake_case     (			self		:   int							)     ->				Dict:




										'''simple docstring'''



										return (self.nir - (self.blue + self.red)) / (self.nir + (self.blue + self.red))






				def     snake_case     (			self		:   int							)     ->				Tuple:




										'''simple docstring'''



										return (self.nir - (self.green + self.red + self.blue)) / (
										    self.nir + (self.green + self.red + self.blue)
										)






				def     snake_case     (			self		:   Dict,			lowerCAmelCase__		:   int=0.08,			lowerCAmelCase__		:   Dict=1.22,			lowerCAmelCase__		:   int=0.03							)     ->				Optional[Any]:




										'''simple docstring'''



										return a * (
										    (self.nir - a * self.red - b)
										    / (a * self.nir + self.red - a * b + x * (1 + a**2))
										)






				def     snake_case     (			self		:   List[Any]							)     ->				str:




										'''simple docstring'''



										return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)






				def     snake_case     (			self		:   Any							)     ->				Tuple:




										'''simple docstring'''



										return (self.nir / self.green) - 1






				def     snake_case     (			self		:   List[Any]							)     ->				List[str]:




										'''simple docstring'''



										return (self.nir / self.redEdge) - 1






				def     snake_case     (			self		:   List[Any]							)     ->				Optional[int]:




										'''simple docstring'''



										return (self.red - self.blue) / self.red






				def     snake_case     (			self		:   Optional[int]							)     ->				int:




										'''simple docstring'''



										_UpperCamelCase      : Union[str, Any]         =   self.ndvi()
										return ((ndvi + 0.5) / (abs(ndvi + 0.5							))) * (abs(ndvi + 0.5							) ** (1 / 2))






				def     snake_case     (			self		:   Optional[int]							)     ->				Tuple:




										'''simple docstring'''



										return self.nir - self.green






				def     snake_case     (			self		:   str							)     ->				List[str]:




										'''simple docstring'''



										return 2.5 * (
										    (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
										)






				def     snake_case     (			self		:   Tuple							)     ->				List[Any]:




										'''simple docstring'''



										_UpperCamelCase      : int         =   (2 * (self.nir**2 - self.red**2) + 1.5 * self.nir + 0.5 * self.red) / (
										    self.nir + self.red + 0.5
										)
										return n * (1 - 0.25 * n) - (self.red - 0.125) / (1 - self.red)






				def     snake_case     (			self		:   int,			lowerCAmelCase__		:   Optional[Any]=0.16							)     ->				Optional[int]:




										'''simple docstring'''



										return (self.nir - self.green) / (self.nir + self.green + y)






				def     snake_case     (			self		:   List[Any],			lowerCAmelCase__		:   List[Any]=0.5							)     ->				Optional[Any]:




										'''simple docstring'''



										return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)






				def     snake_case     (			self		:   Optional[Any]							)     ->				Union[str, Any]:




										'''simple docstring'''



										return np.arctan(
										    ((2 * self.red - self.green - self.blue) / 30.5) * (self.green - self.blue)							)






				def     snake_case     (			self		:   int,			lowerCAmelCase__		:   List[str]=None,			lowerCAmelCase__		:   Union[str, Any]=None							)     ->				Any:




										'''simple docstring'''



										return (self.nir - b) / (a * self.red)






				def     snake_case     (			self		:   int							)     ->				Union[str, Any]:




										'''simple docstring'''



										return (self.nir / ((self.nir + self.red) / 2)) * (self.ndvi() + 1)






				def     snake_case     (			self		:   List[Any]							)     ->				Optional[Any]:




										'''simple docstring'''



										return (self.red + self.green + self.blue) / 30.5






				def     snake_case     (			self		:   Optional[int]							)     ->				Dict:




										'''simple docstring'''



										return self.nir / self.red






				def     snake_case     (			self		:   Optional[int]							)     ->				int:




										'''simple docstring'''



										return (self.rvi() - 1) / (self.rvi() + 1)






				def     snake_case     (			self		:   int							)     ->				List[Any]:




										'''simple docstring'''



										return (
										    (2 * self.nir + 1)
										    - ((2 * self.nir + 1) ** 2 - 8 * (self.nir - self.red)) ** (1 / 2)
										) / 2






				def     snake_case     (			self		:   str							)     ->				Optional[Any]:




										'''simple docstring'''



										return self.green / (self.nir + self.red + self.green)






				def     snake_case     (			self		:   Optional[int]							)     ->				Any:




										'''simple docstring'''



										return self.nir / (self.nir + self.red + self.green)






				def     snake_case     (			self		:   str							)     ->				str:




										'''simple docstring'''



										return self.red / (self.nir + self.red + self.green)






				def     snake_case     (			self		:   Union[str, Any]							)     ->				int:




										'''simple docstring'''



										return (self.green - self.red) / (self.green + self.red)






				def     snake_case     (			self		:   List[Any]							)     ->				Optional[int]:




										'''simple docstring'''



										return (self.red - self.green) / (self.red + self.green)






				def     snake_case     (			self		:   Optional[Any]							)     ->				Dict:




										'''simple docstring'''



										_UpperCamelCase      : Union[str, Any]         =   np.max([np.max(self.red							), np.max(self.green							), np.max(self.blue							)]							)
										_UpperCamelCase      : Dict         =   np.min([np.min(self.red							), np.min(self.green							), np.min(self.blue							)]							)
										return (max_value - min_value) / max_value






				def     snake_case     (			self		:   str							)     ->				Any:




										'''simple docstring'''



										return (2 * self.red - self.green - self.blue) / (self.green - self.blue)






				def     snake_case     (			self		:   Optional[Any]							)     ->				str:




										'''simple docstring'''



										return self.nir / self.red






				def     snake_case     (			self		:   List[str]							)     ->				Tuple:




										'''simple docstring'''



										return (self.ndvi() + 0.5) ** (1 / 2)






				def     snake_case     (			self		:   Optional[int]							)     ->				Optional[Any]:




										'''simple docstring'''



										return (self.nir - self.redEdge) / (self.nir + self.redEdge)










"""simple docstring"""




class 			_a						:






				def __init__(			self		:   Optional[int],			lowerCAmelCase__		:   list							)     ->				None:




										'''simple docstring'''



										_UpperCamelCase      : Optional[int]         =   set_counts
										_UpperCamelCase      : Any         =   max(lowerCAmelCase__							)
										_UpperCamelCase      : int         =   len(lowerCAmelCase__							)
										_UpperCamelCase      : int         =   [1] * num_sets
										_UpperCamelCase      : List[Any]         =   list(range(lowerCAmelCase__							)							)






				def     snake_case     (			self		:   int,			lowerCAmelCase__		:   int,			lowerCAmelCase__		:   int							)     ->				bool:




										'''simple docstring'''



										_UpperCamelCase      : Optional[Any]         =   self.get_parent(lowerCAmelCase__							)
										_UpperCamelCase      : Any         =   self.get_parent(lowerCAmelCase__							)

										if src_parent == dst_parent:
																return False

										if self.ranks[dst_parent] >= self.ranks[src_parent]:
																self.set_counts[dst_parent] += self.set_counts[src_parent]
																_UpperCamelCase      : List[Any]         =   0
																_UpperCamelCase      : str         =   dst_parent
																if self.ranks[dst_parent] == self.ranks[src_parent]:
																						self.ranks[dst_parent] += 1
																_UpperCamelCase      : Union[str, Any]         =   self.set_counts[dst_parent]
										else:
																self.set_counts[src_parent] += self.set_counts[dst_parent]
																_UpperCamelCase      : Tuple         =   0
																_UpperCamelCase      : Optional[Any]         =   src_parent
																_UpperCamelCase      : int         =   self.set_counts[src_parent]

										_UpperCamelCase      : Optional[Any]         =   max(self.max_set,			lowerCAmelCase__							)
										return True






				def     snake_case     (			self		:   Optional[Any],			lowerCAmelCase__		:   int							)     ->				int:




										'''simple docstring'''



										if self.parents[disj_set] == disj_set:
																return disj_set
										_UpperCamelCase      : Union[str, Any]         =   self.get_parent(self.parents[disj_set]							)
										return self.parents[disj_set]



