API Reference¶
sentipy.settings¶
Settings and configuration that apply across the whole project
Sentinel 2 bands¶
https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/resolutions/radiometric
Band label | Band code | Band description | Central wavelength | Resolution (m) |
---|---|---|---|---|
Band 1 | “B01” | Coastal aerosol | 0.443 | 60 |
Band 2 | “B02” | Blue | 0.49 | 10 |
Band 3 | “B03” | Green | 0.56 | 10 |
Band 4 | “B04” | Red | 0.665 | 10 |
Band 5 | “B05” | Vegetation Red Edge | 0.705 | 20 |
Band 6 | “B06” | Vegetation Red Edge | 0.74 | 20 |
Band 7 | “B07” | Vegetation Red Edge | 0.783 | 20 |
Band 8 | “B08” | NIR | 0.842 | 10 |
Band 8A | “B8a” | Vegetation Red Edge | 0.865 | 20 |
Band 9 | “B09” | Water vapour | 0.945 | 60 |
Band 10 | “B10” | SWIR - Cirrus | 1.375 | 60 |
Band 11 | “B11” | SWIR | 1.61 | 20 |
Band 12 | “B12” | SWIR | 2.19 | 20 |
> The Band code is used to refer to Sentinel-2 bands throughout the project.
-
sentipy.settings.
DEFAULT_BAND_SEQUENCE
= ('B03', 'B04', 'B05', 'B06', 'B07', 'B8a', 'B11', 'B12', 'COS_VIEW_ZENITH', 'COS_SUN_ZENITH', 'COS_REL_AZIMUTH') Default sequence of Sentinel-2 bands & meta-data assumed throughout project
sentipy.s2_toolbox¶
Python implementation of some Sentinel-2 toolbox processing tools.
Home for the objects & logic that deal with the calculation of FAPAR
-
class
sentipy.s2_toolbox.
CanopyWater
[source] Bases:
sentipy.s2_toolbox.S2BiophysicalCalculator
Calculator for the Canopy Water biophysical parameter.
-
VALIDATION_RANGES
= {'B03': {'max': 0.263, 'min': 0.0}, 'B04': {'max': 0.3, 'min': 0.0}, 'B05': {'max': 0.315, 'min': 0.0}, 'B06': {'max': 0.619, 'min': 0.0}, 'B07': {'max': 0.764, 'min': 0.004}, 'B11': {'max': 0.503, 'min': 0.006}, 'B12': {'max': 0.503, 'min': 0.0}, 'B8a': {'max': 0.792, 'min': 0.017}, 'Cos(rel. azimuth)': {'max': 1.0, 'min': -1.0}, 'Cos(sun zenith)': {'max': 1.0, 'min': 0.0}, 'Cos(view zenith)': {'max': 1.0, 'min': 0.0}}
-
-
class
sentipy.s2_toolbox.
Fapar
[source] Bases:
sentipy.s2_toolbox.S2BiophysicalCalculator
Calculator for the Fapar biophysical parameter; the fraction of photosynthetically-active radiation absorbed (by vegetation).
-
VALIDATION_RANGES
= {'B03': {'max': 0.263, 'min': 0.0}, 'B04': {'max': 0.3, 'min': 0.0}, 'B05': {'max': 0.315, 'min': 0.0}, 'B06': {'max': 0.619, 'min': 0.0}, 'B07': {'max': 0.764, 'min': 0.004}, 'B11': {'max': 0.503, 'min': 0.006}, 'B12': {'max': 0.503, 'min': 0.0}, 'B8a': {'max': 0.792, 'min': 0.017}, 'Cos(rel. azimuth)': {'max': 1.0, 'min': -1.0}, 'Cos(sun zenith)': {'max': 1.0, 'min': 0.0}, 'Cos(view zenith)': {'max': 1.0, 'min': 0.0}}
-
-
class
sentipy.s2_toolbox.
Fcover
[source] Bases:
sentipy.s2_toolbox.S2BiophysicalCalculator
Calculator for the Fcover biophysical parameter; the fraction of ground covered by vegetation.
-
class
sentipy.s2_toolbox.
S2BiophysicalCalculator
[source] Bases:
abc.ABC
-
run
(input_arr: <sphinx.ext.autodoc.importer._MockObject object at 0x7f5a894be550>, band_sequence: List[str] = ('B03', 'B04', 'B05', 'B06', 'B07', 'B8a', 'B11', 'B12', 'COS_VIEW_ZENITH', 'COS_SUN_ZENITH', 'COS_REL_AZIMUTH'), validate: bool = True) → Union[float, <sphinx.ext.autodoc.importer._MockObject object at 0x7f5a894568d0>][source] Run the calculator on an input array
By default, the calculator expects only the following bands to be passed in the sequence below:
- B03
- B04
- B05
- B06
- B07
- B8a
- B11
- B12
- COS_VIEW_ZENITH
- COS_SUN_ZENITH
- COS_REL_AZIMUTH
If band values are to be passed in a different set or sequence, the band_sequence parameter must be passed with band names (matching those above) for each element in the input array. eg. [“extra_band_1”, “COS_SUN_ZENITH”, “B03”, “B04”, …, “COS_REL_AZIMUTH”, “extra_band_2”]
Parameters: - input_arr – Input values for the calculator to use
- band_sequence – Names of bands included in the input array (names must match those used above for the required bands)
- validate – Flag for whether or not to apply validation ranges to the inputs
Returns: Scalar estimate of the biophysical property
-
sentipy.agri_indices¶
A simple python API for processing raster arrays into common indices used in the agricultural domain.
There are a wide range of agriculturally-relevant indices to be processed from (multi-spectral) optical satellite imagery in general.
This module provides implementations of a number of indices, largely inspired by the Index Database and the SentinelHub custom scripts repository. They are implemented principally with Sentinel-2 in mind, but can be applied to imagery from other constellations where equivalent bands are available (it is left to the user to decide where this is the case).
Available implementations:
- NDVI
- NDWI
- OSAVI
-
sentipy.agri_indices.
ndmi
(img_arr, band_sequence: tuple = ('B08', 'B11'))[source] Normalized Difference Moisture Index
- NDMI = (NIR - SWIR)/(NIR + SWIR)
- = (B08 - B11)/(B08 + B11)
-
sentipy.agri_indices.
ndvi
(img_arr, band_sequence: tuple = ('B04', 'B08'))[source] Normalized Difference Vegetation Index
- NDVI = (NIR - RED)/(NIR + RED)
- = (B08 - B04)/ (B08 + B04)
-
sentipy.agri_indices.
ndwi
(img_arr, band_sequence: tuple = ('B03', 'B08'))[source] Normalized Difference Water Index
- NDWI = -(GREEN - NIR)/(GREEN + NIR)
- = -(B03 - B08)/(B03 + B08)
-
sentipy.agri_indices.
osavi
(img_arr, band_sequence: tuple = ('B04', 'B08'))[source] Optimized Soil-Adjusted Vegetation Index Index DB link
- OSAVI = (1+0.16)*(NIR - RED)/(NIR + RED + 0.16)
- = (1.16)*(B08 - B04)/(B08 + B04 + 0.16)