Package: scikeo
scikit-eo: A Python package for Remote Sensing Data AnalysisIntroductionNowadays, remotely sensed data has increased dramatically. Microwaves and optical images with different spatial and temporal resolutions are available and are used to monitor a variety of environmental issues such as deforestation, land degradation, land use and land cover change, among others. Although there are efforts (i.e., Python packages, forums, communities, etc.) to make available line-of-code tools for pre-processing, processing and analysis of satellite imagery, there is still a gap that needs to be filled. In other words, too much time is still spent by many users developing Python lines of code. Algorithms for mapping land degradation through a linear trend of vegetation indices, fusion optical and radar images to classify vegetation cover, and calibration of machine learning algorithms, among others, are not available yet.Therefore,scikit-eois a Python package that provides tools for remote sensing. This package was developed to fill the gaps in remotely sensed data processing tools. Most of the tools are based on scientific publications, and others are useful algorithms that will allow processing to be done in a few lines of code. With these tools, the user will be able to invest time in analyzing the results of their data and not spend time on elaborating lines of code, which can sometimes be stressful.Tools for Remote SensingName of functions/classesDescriptionmlaMachine Learning (Random Forest, Support Vector Machine, Decition Tree, Naive Bayes, Neural Network, etc.)calmlaCalibrating supervised classification in Remote Sensing (e.g., Monte Carlo Cross-Validation, Leave-One-Out Cross-Validation, etc.)confintervalMLInformation of confusion matrix by proportions of area, overall accuracy, user's accuracy with confidence interval and estimated area with confidence interval as well.rkmeansK-means classificationcalkmeansThis function allows to calibrate the kmeans algorithm. It is possible to obtain the best k value and the best embedded algorithm in kmeans.pcaPrincipal Components AnalysisatmosCorrAtmospheric Correction of satellite imagerydeepLearningDeep Learning algorithmslinearTrendLinear trend is useful for mapping forest degradation or land degradationfusionrsThis algorithm allows to fuse images coming from different spectral sensors (e.g., optical-optical, optical and SAR or SAR-SAR). Among many of the qualities of this function, it is possible to obtain the contribution (%) of each variable in the fused imagesmaSpectral Mixture Analysis - Classification sup-pixeltassCapThe Tasseled-Cap TransformationYou will find more algorithms!.InstallationTo usescikit-eoit is necessary to install it. There are two options:1. From PyPIscikit-eois available onPyPI, so to install it, run this command in your terminal:pipinstallscikeo2. Installing from sourceIt is also possible to install the latest development version directly from the GitHub repository with:pipinstallgit+https://github.com/ytarazona/scikit-eoExample1.0 Applying Machine LearningLibraries to be used:importrasterioimportnumpyasnpfromscikeo.mlaimportMLAimportmatplotlib.pyplotaspltfromdbfreadimportDBFimportmatplotlibasmplimportpandasaspd2.0 Optical imageLandsat-8 OLI (Operational Land Imager) will be used to obtain in order to classify using Random Forest (RF). This image, which is in surface reflectance with bands:Blue -> B2Green -> B3Red -> B4Nir -> B5Swir1 -> B6Swir2 -> B7The image and signatures to be used can be downloadedhere:3.0 Supervised Classification using Random ForestImage and endmemberspath_raster=r"C:\data\ml\LC08_232066_20190727_SR.tif"img=rasterio.open(path_raster)path_endm=r"C:\data\ml\endmembers.dbf"endm=DBF(path_endm)# endmembersdf=pd.DataFrame(iter(endm))df.head()Instance ofmla():inst=MLA(image=img,endmembers=endm)Applying Random Forest:svm_class=inst.SVM(training_split=0.7)4.0 ResultsDictionary of resultssvm_class.keys()Overall accuracysvm_class.get('Overall_Accuracy')Kappa indexsvm_class.get('Kappa_Index')Confusion matrix or error matrixsvm_class.get('Confusion_Matrix')Preparing the image before plotting# Let's define the color palettepalette=mpl.colors.ListedColormap(["#2232F9","#F922AE","#229954","#7CED5E"])Applying theplotRGB()algorithm is easy:# LetÂ´s plotfig,axes=plt.subplots(nrows=1,ncols=2,figsize=(15,9))# satellite imageplotRGB(img,title='Image in Surface Reflectance',ax=axes[0])# class resultsaxes[1].imshow(svm_class.get('Classification_Map'),cmap=palette)axes[1].set_title("Classification map")axes[1].grid(False)Free software: Apache Software License 2.0Documentation:AcknowledgmentSpecial thanks to:David Montero Loaizafor the idea of the package namescikit-eo.Qiusheng Wufor the suggestions that helped to improve the package.CreditsThis package was created withCookiecutter