raster4ml package
Submodules
raster4ml.extraction module
- raster4ml.extraction.batch_extract_by_points(image_paths, shape_path, unique_id)[source]
Batch extract values from a set of raster data using point shapefile.
- Parameters
image_paths (list) – List of image paths.
shape_path (str) – Path of the shapefile.
unique_id (str) – A unique column in the shapefile which will be retained as the id.
- Returns
A pandas dataframe containing all the values per id.
- Return type
pandas dataframe
- raster4ml.extraction.batch_extract_by_polygons(image_paths, shape_path, unique_id, statistics='all')[source]
Batch extract value by a polygon shapefile from a given image paths. Similar to zonal statistics.
- Parameters
image_paths (list) – List of image paths.
shape_path (str) – Path of the shapefile.
unique_id (str) – A unique column in the shapefile which will be retained as the id.
statistics (str or list) – List of statistics to be calculated if shape is polygon. Accepted statsitcs are either ‘all’ or a list containing follwoing statistics: ‘mean’, ‘median’, ‘mode’, ‘sum’, ‘min’, ‘max’, ‘std’, ‘range’, ‘iqr’, ‘unique’. If only one statistic to be calculated, that should be inside a list. For example, if only ‘mean’ is to be calculated, it should be given as [‘mean’].
prefix (str, optional) – If predix is given, then the prefix will be used in front of the statistics name within the final dataframe column, by default None
- Returns
A pandas dataframe containing all the statistics values per id. Each column name will be made through automatically adding a prefix (which is the filename of each image) and the corresponding statistics.
- Return type
pandas dataframe
- raster4ml.extraction.clip_by_polygons(image_path, shape_path, unique_id, out_dir, out_type='numpy')[source]
Clip a raster image by a polygon shapefile.
Based on the geometry of each polygon, the function will clip the images and save it in a given directory with a unique name.
- Parameters
image_path (str) – Path of the image.
shape_path (str) – Path of the shapefile.
unique_id (str) – A unique column in the shapefile which will be retained as the id.
out_dir (str) – Path of the directory where the clipped images will be saved.
out_type (str, optional) – The type of output data. It can be either ‘numpy’ or ‘tif’, by default ‘numpy’
- Returns
Saves the clipped data.
- Return type
None
- Raises
ValueError – The shapefile must be either Polygon or MultiPolygon.
- raster4ml.extraction.extract_by_points(image_path, shape_path, unique_id)[source]
Extract value by a point shapefile.
The function will extract the pixel values underneath each point in a given point shapefile.
- Parameters
image_path (str) – Path of the image.
shape_path (str) – Path of the shapefile.
unique_id (str) – A unique column in the shapefile which will be retained as the id.
- Returns
A pandas dataframe containing all the values per id.
- Return type
pandas dataframe
- Raises
ValueError – The shapefile must be either Point or MultiPoint.
- raster4ml.extraction.extract_by_polygons(image_path, shape_path, unique_id, statistics='all', prefix=None)[source]
Extract value from a raster data using a polygon shapefile. Similar to Zonal Statistics.
- Parameters
image_path (str) – Path of the image.
shape_path (str) – Path of the shapefile.
unique_id (str) – A unique column in the shapefile which will be retained as the id.
statistics (str or list) – List of statistics to be calculated if shape is polygon. Accepted statsitcs are either ‘all’ or a list containing follwoing statistics: ‘mean’, ‘median’, ‘mode’, ‘sum’, ‘min’, ‘max’, ‘std’, ‘range’, ‘iqr’, ‘unique’. If only one statistic to be calculated, that should be inside a list. For example, if only ‘mean’ is to be calculated, it should be given as [‘mean’].
prefix (str, optional) – If predix is given, then the prefix will be used in front of the statistics name within the final dataframe column, by default None
- Returns
A pandas dataframe containing all the statistics values per id.
- Return type
pandas dataframe
- Raises
ValueError – The shapefile must be either Polygon or MultiPolygon.
raster4ml.features module
- class raster4ml.features.VegetationIndices(image_path, wavelengths, threshold=10, bit_depth=None)[source]
Bases:
object
Constructs all the necessary attributes for the VegetationIndices object.
- Parameters
image_path (str) – Path of the image.
wavelengths (list or list of lists) –
The wavelengths (in nanometer) of the bands in the stacked image. It can be either a list containing the center wavelengths of the bands, or it can be a list of lists where each element represents the initial and final wavelength.
Example: If list: [430, 450, 560] If list of lists: [[420, 440], [530, 560], [670, 690]]
threshold (int (optional)) – An integer value which defines the threshold of wavelength. For example, if a band’s wavelngth is 550 nm and threshold is 10, then the vegetation index calculation will consider 550 +/- 10 nm as the input. It is suggested to use smaller threshold value (or keep the default 10) while using hyperspectral images and larger values (may be 100) for multispectral images.
bit_depth (int (optional)) – Bit depth of the image. For example, Landsat 8 images are 14-bit. So if 14 is given as the bit_depth, then the image values will be divided by 2**14=16384.
- calculate(out_dir, featuers='all'):
Calculate all the vegetation indices possible. The index list is adapted from: https://www.indexdatabase.de/
- Raises
ValueError – If invalid image path is given.
- AFRI1600()[source]
Aerosol free vegetation index 1600
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- AFRI2100()[source]
Aerosol free vegetation index 2100
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ARI()[source]
Anthocyanin reflectance index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ARVI()[source]
Atmospherically Resistant Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ARVI2()[source]
Atmospherically Resistant Vegetation Index 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ATSAVI()[source]
Adjusted transformed soil-adjusted VI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- AVI()[source]
Ashburn Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- BGI()[source]
Blue green pigment index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- BNDVI()[source]
Blue Normalized Difference Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- BRI()[source]
Blue red pigment index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- BWDRVI()[source]
Blue-wide dynamic range vegetation index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CARI()[source]
Chlorophyll Absorption Ratio Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CARI2()[source]
Chlorophyll Absorption Ratio Index 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CASI_NDVI()[source]
CASI NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CASI_TM4_3()[source]
CASI TM4/3
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CCCI()[source]
Canopy Chlorophyll Content Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CI()[source]
Curvative index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CIgreen()[source]
Chlorophyll Index Green
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CIrededge()[source]
Chlorophyll Index RedEdge 710
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CIrededge710()[source]
Chlorophyll Index RedEdge 710
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CTVI()[source]
Corrected Transformed Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- CVI()[source]
Chlorophyll vegetation index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- Chlgreen()[source]
Chlorophyll Green
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- Chlrededge()[source]
Chlorophyll RedEdge
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- D678_500()[source]
Difference 678 & 500
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- D800_550()[source]
Difference 800 & 550
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- D800_680()[source]
Difference 800 & 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- D833_658()[source]
Difference 833 & 658
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- DD()[source]
Double Difference Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- DDn()[source]
Double Difference Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- DPI()[source]
Double Peak Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- DSWI()[source]
Disease water stress index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- DSWI5()[source]
Disease water stress index 5
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- DVIMSS()[source]
Differenced Vegetation Index MSS
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- EVI()[source]
Enhanced Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- EVI2()[source]
Enhanced Vegetation Index 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- EVI3()[source]
Enhanced Vegetation Index 3
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GARI()[source]
Green atmospherically resistant vegetation index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GBNDVI()[source]
Green-Blue NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GDVI()[source]
Green Difference Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GEMI()[source]
Global Environment Monitoring Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GLI()[source]
Green leaf index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GNDVI()[source]
Blue Normalized Difference Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GNDVIhyper()[source]
Green NDVI hyper
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GNDVIhyper2()[source]
Green NDVI hyper 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GOSAVI()[source]
Green Optimized Soil Adjusted Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GSAVI()[source]
Green Soil Adjusted Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- GVIMSS()[source]
Tasselled Cap - Green Vegetation Index MSS
- Returns
GVIMSS
- Return type
numpy 2d-array
- GVMI()[source]
Global Vegetation Moisture Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- Gitelson()[source]
Gitelson index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- IF()[source]
Shape Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- IPVI()[source]
Infrared percentage vegetation index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- IR550()[source]
Inverse reflectance 550
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- IR700()[source]
Inverse reflectance 700
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- LCI()[source]
Leaf Chlorophyll Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- LWCI()[source]
Leaf Water Content Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- LWVI1()[source]
Leaf water vegetation index 1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- LWVI2()[source]
Leaf water vegetation index 1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- LogR()[source]
Log ratio
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MCARI()[source]
Modified Chlorophyll Absorption in Reflectance Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MCARI1()[source]
Modified Chlorophyll Absorption in Reflectance Index 1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MCARI1510()[source]
Modified Chlorophyll Absorption in Reflectance Index 1510
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MCARI2()[source]
Modified Chlorophyll Absorption in Reflectance Index 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MCARI705()[source]
Modified Chlorophyll Absorption in Reflectance Index 705, 750
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MCARI710()[source]
Modified Chlorophyll Absorption in Reflectance Index 710, 750
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MGVI()[source]
Misra Green Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MND_734_747_715_720()[source]
Modified Normalized Difference 734/747/715/720
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MND_750_705()[source]
Modified Normalised Difference 750/705
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MND_850_1788_1928()[source]
Modified Normalized Difference 850/1788/1928
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MND_850_2218_1928()[source]
Modified Normalized Difference 850/2218/1928
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MNLI()[source]
Modified NLI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MNSI()[source]
Misra Non Such Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MRVI()[source]
Modified Normalized Difference Vegetation Index RVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSAVI()[source]
Modified Soil Adjusted Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSAVIhyper()[source]
Modified Soil Adjusted Vegetation Index hyper
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSBI()[source]
Misra Soil Brightness Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSR670()[source]
Modified Simple Ratio 670, 800
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSR705()[source]
Modified Simple Ratio 705, 750
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSR_705_445()[source]
Modified Simple Ratio 705, 445
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MSR_NIR_Red()[source]
Modified Simple Ratio NIR Red
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MTCI()[source]
MERIS Terrestrial chlorophyll index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MTVI1()[source]
Modified Triangular Vegetation Index 1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MTVI2()[source]
Modified Triangular Vegetation Index 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MVI()[source]
Mid-infrared vegetation index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- MYVI()[source]
Misra Yellow Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NBR()[source]
Normalized Burn Ratio
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDBleaf()[source]
Normalized Difference leaf canopy biomass
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDLI()[source]
Normalized Difference Lignin Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDMI()[source]
Normalized Difference Moisture Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDNI()[source]
Normalized Difference Nitrogen Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDRE()[source]
Normalized Difference Rededge Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDSI()[source]
Normalized Difference Salinity Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDVI()[source]
Normalized Difference Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDVI_700()[source]
NDVI 700
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDVI_705()[source]
Chl NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDVI_rededge()[source]
Normalized Difference Rededge/Red
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDVIg()[source]
Green NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDWI_Hyp()[source]
Normalized difference water index hyperion
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1080_1180()[source]
Normalized difference 1080 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1080_1260()[source]
Normalized difference 1080 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1080_1450()[source]
Normalized difference 1080 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1080_1675()[source]
Normalized difference 1080 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1080_2170()[source]
Normalized difference 1080 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1180_1450()[source]
Normalized difference 1180 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1180_1675()[source]
Normalized difference 1180 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1180_2170()[source]
Normalized difference 1180 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1260_1450()[source]
Normalized difference 1260 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1260_1675()[source]
Normalized difference 1260 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1260_2170()[source]
Normalized difference 1260 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_1510_660()[source]
Normalized difference 1260 660
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_682_553()[source]
Normalized difference 682 553
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_750_650()[source]
Normalized difference 750 650
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_750_660()[source]
Normalized difference 750 660
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_750_680()[source]
Normalized difference 750 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_774_677()[source]
Normalized difference 774 677
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_782_666()[source]
Normalized difference 782 666
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_790_670()[source]
Normalized difference 790 670
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_800_1180()[source]
Normalized difference 800 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_800_1260()[source]
Normalized difference 800 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_800_1450()[source]
Normalized difference 800 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_800_1675()[source]
Normalized difference 800 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_800_2170()[source]
Normalized difference 800 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_800_680()[source]
Normalized difference 800 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_819_1600()[source]
Normalized difference 819 1600
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_819_1649()[source]
Normalized difference 819 1649
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_827_668()[source]
Normalized difference 827 668
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_833_1649()[source]
Normalized difference 833 1649
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_833_658()[source]
Normalized difference 833 658
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_850_1650()[source]
Normalized difference 850 1650
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_857_1241()[source]
Normalized difference 857 1241
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_860_1240()[source]
Normalized difference 860 1240
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_895_675()[source]
Normalized difference 895 675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_900_680()[source]
Normalized difference 900 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_960_1180()[source]
Normalized difference 960 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_960_1260()[source]
Normalized difference 960 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_960_1450()[source]
Normalized difference 960 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_960_1675()[source]
Normalized difference 960 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- ND_960_2170()[source]
Normalized difference 960 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDchl()[source]
Normalized Difference Chlorophyll
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NDlma()[source]
Normalized Difference leaf mass per area
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NGRDI()[source]
Normalized Green Red Difference Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NLI()[source]
Nonlinear vegetation index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NPCI()[source]
Normalized Pigment Chlorophyll Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NPQI()[source]
Normalized Phaeophytinization Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NormG()[source]
Normalized Green
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NormNIR()[source]
Normalized NIR
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- NormR()[source]
Normalized Red
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- OSAVI()[source]
Optimized Soil Adjusted Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- OSAVI2()[source]
Optimized Soil Adjusted Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- OSAVI_1510()[source]
Optimized Soil Adjusted Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PNDVI()[source]
Pan NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PPR()[source]
Plant pigment ratio
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PRI_528_587()[source]
Photochemical Reflectance Index 528/587
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PRI_531_570()[source]
Photochemical Reflectance Index 531/570
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PRI_550_530()[source]
Photochemical Reflectance Index 550/530
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PRI_570_531()[source]
Photochemical Reflectance Index 570/531
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PRI_570_539()[source]
Photochemical Reflectance Index 570/539
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PSNDa1()[source]
Pigment specific normalised difference A1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PSNDb1()[source]
Pigment specific normalised difference B1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PSNDb2()[source]
Pigment specific normalised difference B2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PSNDc1()[source]
Pigment specific normalised difference C1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PSNDc2()[source]
Pigment specific normalised difference C2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PSRI()[source]
Plant Senescence Reflectance Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PVIhyp()[source]
Hyperspectral perpendicular VI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- PVR()[source]
Photosynthetic vigour ratio
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- R(wavelength)[source]
Find the nearest band of the image from given wavelength.
- Parameters
wavelength (float) – The wavelength in nm.
- Returns
The image numpy nd-array with selected bands matching the wavelength.
- Return type
numpy nd-array
- RARS()[source]
Ratio Analysis of Reflectance Spectra, Simple Ratio of 760 500
- Returns
RARS
- Return type
numpy 2d-array
- RBNDVI()[source]
Red-Blue NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- RDVI()[source]
Renormalized Difference Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- REIP1()[source]
Red-Edge Inflection Point 1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- REIP2()[source]
Red-Edge Inflection Point 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- REIP3()[source]
Red-Edge Inflection Point 3
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- RENDVI()[source]
Red edge NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- REP()[source]
Red-Edge Position Linear Interpolation
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- RI()[source]
Normalized Burn Ratio
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- RRE()[source]
Reflectance at the inflexion point
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- RVSI()[source]
Red-Edge Stress Vegetation Index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- R_675_700_650()[source]
Ratio 675 700 650
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- R_WI_ND750()[source]
Ratio 675 700 650
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- Rededge2()[source]
Rededge1
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SARVI2()[source]
Soil and Atmospherically Resistant Vegetation Index 2
- Returns
SR_355_365_gk
- Return type
numpy 2d-array
- SBIMSS()[source]
Tasselled Cap - Soil Brightness Index MSS
- Returns
NSIMSS
- Return type
numpy 2d-array
- SR_1058_1148()[source]
Simple Ratio of 1058 1148
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1080_1180()[source]
Simple Ratio of 1080 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1080_1260()[source]
Simple Ratio of 1080 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1080_1450()[source]
Simple Ratio of 1080 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1080_1675()[source]
Simple Ratio of 1080 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1080_2170()[source]
Simple Ratio of 1080 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1180_1080()[source]
Simple Ratio of 1180 1080
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1180_1450()[source]
Simple Ratio of 1180 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1180_1675()[source]
Simple Ratio of 1180 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1180_2170()[source]
Simple Ratio of 1180 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1193_1126()[source]
Simple Ratio of 1193 1126
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1250_1050()[source]
Simple Ratio of 1250 1050
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1260_1080()[source]
Simple Ratio of 1260 1080
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1260_1450()[source]
Simple Ratio of 1260 1450
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1260_1675()[source]
Simple Ratio of 1260 1675
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1260_2170()[source]
Simple Ratio of 1260 2170
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1450_1080()[source]
Simple Ratio of 1450 1080
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1450_1180()[source]
Simple Ratio of 1450 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1450_1260()[source]
Simple Ratio of 1450 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1450_960()[source]
Simple Ratio of 1450 960
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1600_820()[source]
Simple Ratio of 1600 820
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1650_2218()[source]
Simple Ratio of 1650 2218
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1660_550()[source]
Simple Ratio of 1660 550
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1660_680()[source]
Simple Ratio of 1660 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1675_1080()[source]
Simple Ratio of 1675 1080
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1675_1180()[source]
Simple Ratio of 1675 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1675_1260()[source]
Simple Ratio of 1675 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_1675_960()[source]
Simple Ratio of 1675 960
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_2170_1080()[source]
Simple Ratio of 2170 1080
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_2170_1180()[source]
Simple Ratio of 2170 1180
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_2170_1260()[source]
Simple Ratio of 2170 1260
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_2170_960()[source]
Simple Ratio of 2170 960
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_355_365_gk()[source]
Simple Ratio of SR_355_365_gk
- Returns
SR_355_365_gk
- Return type
numpy 2d-array
- SR_430_680()[source]
Simple Ratio of 430 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_440_690()[source]
Simple Ratio of 440 690
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_440_740()[source]
Simple Ratio of 440 740
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_520_420()[source]
Simple Ratio of 520 420
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_520_670()[source]
Simple Ratio of 520 670
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_520_760()[source]
Simple Ratio of 520 760
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_542_750()[source]
Simple Ratio of 542 750
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_550_420()[source]
Simple Ratio of 550 420
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_550_670()[source]
Simple Ratio of 550 670
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_550_680()[source]
Simple Ratio of 550 680
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_550_760()[source]
Simple Ratio of 550 760
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_550_800()[source]
Simple Ratio of 550 800
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_554_677()[source]
Simple Ratio of 554 677
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_556_750()[source]
Simple Ratio of 556 750
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_560_658()[source]
Simple Ratio of 560 658
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_605_420()[source]
Simple Ratio of 605 420
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_605_670()[source]
Simple Ratio of 605 670
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_605_760()[source]
Simple Ratio of 605 760
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_672_550()[source]
Simple Ratio of 672 550
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- SR_672_708()[source]
Simple Ratio of 672 708
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- TCARI1510()[source]
Transformed Chlorophyll Absorbtion Ratio 1510
- Returns
NSIMSS
- Return type
numpy 2d-array
- TCARI2()[source]
Transformed Chlorophyll Absorbtion Ratio 2
- Returns
NSIMSS
- Return type
numpy 2d-array
- TSAVI()[source]
Transformed Soil Adjusted Vegetation Index
- Returns
NSIMSS
- Return type
numpy 2d-array
- VARI700()[source]
Visible Atmospherically Resistant Index 700
- Returns
NSIMSS
- Return type
numpy 2d-array
- VARIgreen()[source]
Visible Atmospherically Resistant Index Green
- Returns
NSIMSS
- Return type
numpy 2d-array
- VARIrededge()[source]
Visible Atmospherically Resistant Index RedEdge
- Returns
NSIMSS
- Return type
numpy 2d-array
- Vog2()[source]
Modified Normalised Difference 734/747/715/726 Vogelmann indices 2
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- YVIMSS()[source]
Tasselled Cap - Yellow Vegetation Index MSS
- Returns
NSIMSS
- Return type
numpy 2d-array
- calculate(out_dir, features='all')[source]
_summary_
- Parameters
out_dir (str) – Path of the directory where indice(s) will be saved.
features (str or list (optional)) – If ‘all’ then all the vegetation indices available in the package will be calculated. Or the user can put the names of the indices to calculate in a list. Allowable indices are:
- Returns
Saves the output indices.
- Return type
None
- Raises
ValueError – _description_
- mARI()[source]
Modified anthocyanin reflectance index
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
- mNDVI()[source]
Modified NDVI
- Returns
A 2D numpy array of calcualted feature.
- Return type
numpy 2d-array
raster4ml.plotting module
raster4ml.preprocessing module
- raster4ml.preprocessing.reproject_raster(src_image_path, dst_image_path, band=None, dst_crs='EPSG:4326')[source]
Reproject the raster into a different CRS.
- Parameters
src_image_path (str) – Path of the image to be reprojected.
dst_image_path (src) – Path of the destination image as reprojected.
band (int, (Optional)) – Specify the band to reproject.
dst_crs (str) – The destination CRS in EPSG code. For example, ‘EPSG:4326’, Default to ‘EPSG:4326’
- Returns
Nothing returns, the image is saved.
- Return type
None
- raster4ml.preprocessing.stack_bands(image_paths, out_file)[source]
Stack the images together as bands.
- Parameters
image_paths (list) – List of images that needs to be stacked
out_file (src) – Output path fot the stacked image. Supports .tif.
- Returns
Nothing returns, the image is saved.
- Return type
None
- Raises
ValueError – If invalid image path is given.
raster4ml.utils module
- raster4ml.utils.check_projection(src, shape)[source]
Check if the raster and shapefile has same projection or not. If not, it reprojects the shapefile.
- Parameters
src (rasterio object) – An image opened by rasterio.
shape (geopandas object) – A shapfile opened using geopandas.
- Returns
The same given shapefile but reprojected to raster data’s projection.
- Return type
geopandas object
- raster4ml.utils.get_vegetation_indices_names()[source]
Returns all supported vegetation index names to calcualte.
- Returns
List of vegetation indices.
- Return type
list
- raster4ml.utils.save_raster(src, array, out_path, **kwargs)[source]
Saves a numpy image into a geospatial tif image.
- Parameters
src (rasterio object) – An image object opened using rasterio.
array (numpy nd-array) – A numpy nd-array which needs to be saved.
out_path (str) – Output path where the tif file will be saved.
- Returns
Saves the image.
- Return type
None