Package: geodata-preprocess-IIITB-SCL
Geodata-preprocess-IIITB-SCLThis is official documaentation of geodata-preprocess-IIITB-SCL. The package has many useful functions for dealing with geospatial data, also few functions like computation of NDVI, MNDWI are integrated with dask to speed up it's computation.InstallationThis can installed using pip using the following command in both Windows and Linux OS$ pip install geodata-preprocess-IIITB-SCLUsageAll Sorted File NamesThe geospatial data file names are moslty represented by date and time. For few specific tasks like time series forecasting , it might be necessary to get all files in sequential form. This function returns list of all file names in sorted order.Functionget_file_names(folder_path)Parametersfolder_path: Folder path where geospatial Images existReturn TypeOrdered name list of Geospatial ImagesNumber of BandsThe functions finds number of bands in the image. Red, Green, Blue, Infrared etc.Functionnumber_of_bands(filepath)Parametersfile path: Path of Image.Return TypeInteger value, number of bands.Numpy Array of the ImageThe functions converts the file in numpy array format with all it's bands.Functionnumpy_image(filepath):Parametersfile path: Path of Image.Return TypeNumpy Array.Dataframe of the ImageConverts the geospatial file in pandas dataframe.Functiondataframe_image(filepath)Parametersfile path: Path of Image.Return TypePandas dataframe.Min Max Scaling of DataframeThis functions performs min-max scaling of the dataframe.Functionmin_max_scaled(df_raw)Parametersdf_raw: Input pandas dataframe.Return TypeNumpy array representing scaled values.Convert the numpy to dask arrayThis function converts numpy array to dask array with specified chunks of the same bandwidth.Functionnumpy_to_dask_array(df,chunk_len)Parametersdf: Input dataframechunk_len:specifies the chunk sizeReturn TypeDask array.One hot to labelSome of the geospatial data may be segmented (each pixel being classified to a label). Generally the open source labelled data is one hot encoded. This functions converts the it in labelled form.Functionone_hot_to_label(file_path)Parametersfile path: Path of Image.Return TypeNumpy array representing labelled data with only one band.Ordered labelsSome of the labels of an image might not be following a sequential form. For eg there is bunch of images whose pixel labels are from 2,4, 7. To make it sequential this function would be helpfulFunctionget_ordered_labels(y)Parameters_y: Labelled numpy array.Return TypeOrdered numpy array.Normalized differenceThis is a key functions used for NDVI and MNDWI indices. With specifying band values as Red and Near Red Infrared bands we can find NDVI index , and by specifying Short Wave Infrared and Green bands whe can get MNDWI index for any geospatial image.Functionnormalized_difference( b1, b2):NDVI Computation (Returning list)Functions here are used for finding NDVI indices of list of geospatial imageWithout DaskFunctionfind_ndvi_list(file_path_list)Parametersfile path_list: List of path of Images.Return TypeList of NDVI index (numpy array) in the same order of values in input list.With DaskFunctionfind_ndvi_list_with_dask(worker_nodes,file_path_list)Parametersfile path_list: List of path of Images.worker_nodes: Number of dask worker nodes in a clusterReturn TypeList of NDVI index (numpy array) in the same order of values in input list.NDVI Computation (Saving the values in folder)Without DaskFunctionfind_and_write_ndvi_list(file_path_list,destination_folder)Parametersfile path_list: List of path of Images.destination_folder: path where indices will be saved.Return TypeNoneWith DaskFunctionfind_and_write_ndvi_list_with_dask(worker_nodes,file_path_list,destination_folder)Parametersfile path_list: List of path of Images.worker_nodes: Number of dask worker nodes in a clusterdestination_folder: path where indices will be saved.Return TypeNoneContributingThe following are the core contributors:Pratyush UpadhyayDeeksha AgarwalLicensegeodata-preprocess-IIITB-SCLwas created by IITB-SCL. It is licensed under the terms of the MIT license.