sisppeo.masks.waterdetect package¶
Submodules¶
sisppeo.masks.waterdetect.Common module¶
- class sisppeo.masks.waterdetect.Common.DWConfig(config_file=None)[source]¶
Bases:
object
- property average_results¶
- property classifier¶
- property clip_band¶
- property clip_inf_value¶
- property clip_sup_value¶
- property clustering_bands¶
- property clustering_method¶
- property detect_water_cluster¶
- property linkage¶
- property max_clusters¶
- property max_train_size¶
- property min_clusters¶
- property min_positive_pixels¶
- property min_train_size¶
- property score_index¶
- property train_size¶
- class sisppeo.masks.waterdetect.Common.DWutils[source]¶
Bases:
object
- static calc_normalized_difference(img1, img2, mask=None)[source]¶
Calc the normalized difference of given arrays (img1 - img2)/(img1 + img2). Updates the mask if any invalid numbers (ex. np.inf or np.nan) are encountered :param img1: first array :param img2: second array :param mask: initial mask, that will be updated :return: nd array filled with -9999 in the mask and the mask itself
- static check_path(path_str, is_dir=False)[source]¶
Check if the path/file exists and returns a Path variable with it :param path_str: path string to test :param is_dir: whether if it is a directory or a file :return: Path type variable
- static get_train_test_data(data, train_size, min_train_size, max_train_size)[source]¶
Split the provided data in train-test bunches :param min_train_size: minimum data quantity for train set :param max_train_size: maximum data quantity for train set :param train_size: percentage of the data to be used as train dataset :param data: data to be split :return: train and test datasets
sisppeo.masks.waterdetect.Image module¶
- class sisppeo.masks.waterdetect.Image.DWImageClustering(bands, bands_keys, invalid_mask, config)[source]¶
Bases:
object
- apply_cluster(data)[source]¶
Apply the cluster algorithm to the data. Number of cluster is in self.best_k :param data: data to be clustered :return: Vector with the labels
- static apply_naive_bayes(data, clusters_labels, clusters_data)[source]¶
Apply Naive Bayes classifier to classify data :param data: new data to be classified :param clusters_labels: labels for the reference data :param clusters_data: reference data :return: labels for the new data
- bands_to_columns()[source]¶
Convert self.bands to a column type matrix where each band is a column It follows the order of the keys ordered :return: column type matrix
- calc_clusters_params(data, clusters_labels)[source]¶
Calculate parameters for each encountered cluster. Mean, Variance, Std-dev :param data: Clustered data :param clusters_labels: Labels for the data :return: List with cluster statistics
- check_necessary_bands(bands, bands_keys, invalid_mask)[source]¶
Check if the bands_keys combination for the clustering algorithm are available in bands and if they all have the same shape :param invalid_mask: array mask with the invalid pixels :param bands: image bands available :param bands_keys: bands combination :return: bands and bands_keys
- create_matrice_cluster(indices_array)[source]¶
Recreates the matrix with the original shape with the cluster labels for each pixel :param indices_array: position of the clustered pixels in the matrix :return: clustered image (0-no data, 1-water, 2, 3, … - other)
- detect_cluster(param, logic, band1, band2=None)[source]¶
Detects a cluster according to a specific metrics :param param: Which parameter to search (mean, std-dev, variance, …) :param logic: Max or Min :param band1: The band related to the parameter :param band2: :return: Cluster object that satisfies the logic
- find_best_k(data)[source]¶
Find the best number of clusters according to an metrics. :param data: data to be tested :return: number of clusters
- identify_water_cluster()[source]¶
Finds the water cluster within all the clusters. It can be done using MNDWI, MBWI or Mir2 bands :return: water cluster object
- run_detect_water(config=None)[source]¶
Runs the detect_water function :param config: Options dictionary for the processing :return: clustered matrix where 1= water