Skip to content

module process


function crop

1
crop(image, shp, filename=None, filepath=None)

This algorithm allows to clip a raster (.tif) including a satellite image using a shapefile.

Parameters:

  • image: This parameter can be a string with the raster path (e.g., r'/home/image/b3.tif') or it can be a rasterio.io.DatasetReader type.

  • shp: Vector file, tipically shapefile.

  • filename: The image name to be saved.

  • filepath: The path which the image will be stored.

Return:

A raster in your filepath.


function extract

1
extract(image, shp)

This algorithm allows to extract raster values using a shapefile.

Parameters:

  • image: Optical images. It must be rasterio.io.DatasetReader with 3d or 2d.

  • shp: Vector file, tipically shapefile.

Return:

A dataframe with raster values obtained.

Note:

This function is usually used to extract raster values to be used on machine learning algorithms.


function confintervalML

1
confintervalML(matrix, image_pred, pixel_size=10, conf=1.96, nodata=None)

The error matrix is a simple cross-tabulation of the class labels allocated by the classification of the remotely sensed data against the reference data for the sample sites. The error matrix organizes the acquired sample data in a way that summarizes key results and aids the quantification of accuracy and area. The main diagonal of the error matrix highlights correct classifications while the off-diagonal elements show omission and commission errors. The cell entries and marginal values of the error matrix are fundamental to both accuracy assessment and area estimation. The cell entries of the population error matrix and the parameters derived from it must be estimated from a sample. This function shows how to obtain a confusion matrix by estimated proportions of area with a confidence interval at 95% (1.96).

Parameters:

  • matrix: confusion matrix or error matrix in numpy.ndarray.

  • image_pred: Could be an array with 2d (rows, cols). This array should be the image classified with predicted classes. Or, could be a list with number of pixels for each class.

  • pixel_size: Pixel size of the image classified. By default is 10m of Sentinel-2.

  • conf: Confidence interval. By default is 95%.

Return:

Information of confusion matrix by proportions of area, overall accuracy, user's accuracy with confidence interval and estimated area with confidence interval as well.

Reference:

Olofsson, P., Foody, G.M., Herold, M., Stehman, S.V., Woodcock, C.E., and Wulder, M.A. 2014. “Good practices
- for estimating area and assessing accuracy of land change.” Remote Sensing of Environment, Vol. 148: 42–57.
- doi: https://doi.org/10.1016/j.rse.2014.02.015.

Note:

Columns and rows in a confusion matrix indicate reference and prediction respectively.


function print_info

1
print_info(params)

Information: Confusion Matrix by Estimated Proportions of area an uncertainty

Parameters:

  • params: confintervalML result. See the function: https://github.com/ytarazona/scikit-eo/blob/main/scikeo/process.py

Return:

Information of confusion matrix by proportions of area, overall accuracy, user's accuracy with confidence interval and estimated area with confidence interval as well.

Note:

This function was tested using ground-truth values obtained by Olofsson et al. (2014).


This file was automatically generated via lazydocs.


Last update: 2023-08-02