satellitetools.common.sentinel2
Classes for handling Sentinel-2 data.
@author: Olli Nevalainen (Finnish Meteorological Institute)
Attributes
Classes
str(object='') -> str |
|
Sentinel-2 bands. |
|
Sentinel-2 Scene Classification Layer (SCL) classes. |
|
S2 data request paramaters. |
|
Sentinel-2 metadata class. |
|
Sentinel-2 observation geometry class. |
|
Coordinates class. |
|
Sentinel-2 data item class. |
|
Sentinel-2 data collection class. |
Functions
|
Filter qi dataframe. |
|
Module Contents
- class satellitetools.common.sentinel2.StrEnum[source]
Bases:
str,enum.Enumstr(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
Initialize self. See help(type(self)) for accurate signature.
- class satellitetools.common.sentinel2.S2Band[source]
Bases:
enum.StrEnumSentinel-2 bands.
Initialize self. See help(type(self)) for accurate signature.
- class satellitetools.common.sentinel2.SCLClass(*args, **kwds)[source]
Bases:
enum.EnumSentinel-2 Scene Classification Layer (SCL) classes.
- satellitetools.common.sentinel2.S2_BANDS_GEE = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'B9', 'B11', 'B12', 'AOT', 'WVP', 'SCL'][source]
- satellitetools.common.sentinel2.S2_BANDS_10_20_GEE = ['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B8A', 'B11', 'B12'][source]
- satellitetools.common.sentinel2.S2_BANDS_COG = ['coastal', 'blue', 'green', 'red', 'rededge1', 'rededge2', 'rededge3', 'nir', 'nir08', 'nir09',...[source]
- satellitetools.common.sentinel2.S2_BANDS_10_20_COG = ['blue', 'green', 'red', 'rededge1', 'rededge2', 'rededge3', 'nir08', 'swir16', 'swir22'][source]
- class satellitetools.common.sentinel2.Sentinel2RequestParams(datestart: str, dateend: str, datasource: satellitetools.common.classes.DataSource, bands: List[S2Band] = None, target_gsd: float = 20, qi_evaluation_scale: float = 20)[source]
S2 data request paramaters.
Attributes:
- datestartstr
Start date of the data request.
- dateendstr
End date of the data request.
- datasourceDataSource
Data source for the request.
- bandsList[S2Band]
List of Sentinel-2 bands to request.
- target_gsdfloat
Target ground sampling distance (GSD) in meters.
- qi_evaluation_scalefloat
Quality indicator evaluation scale.
Initialize the Sentinel2RequestParams class.
Parameters:
- datestartstr
Start date of the data request.
- dateendstr
End date of the data request.
- datasourceDataSource
Data source for the request.
- bandsList[S2Band]
List of Sentinel-2 bands to request.
- target_gsdfloat
Target ground sampling distance (GSD) in meters.
- qi_evaluation_scalefloat
Quality indicator evaluation scale.
- class satellitetools.common.sentinel2.Sentinel2Metadata(acquisition_time: pandas.Timestamp, tileid: str, assetid: str, productid: str, projection: str, datasource: satellitetools.common.classes.DataSource, observation_geometry: Sentinel2ObservationGeometry | None = None, class_percentages: Dict[SCLClass, float] | None = None)[source]
Sentinel-2 metadata class.
Attributes:
- acquisition_timepd.Timestamp
Acquisition time of the image.
- tileidstr
Sentinel-2 tile ID.
- assetidstr
Asset ID of the image.
- productidstr
Product ID of the image.
- projectionstr
Projection of the image.
- datasourceDataSource
Data source of the image.
- observation_geometryOptional[Sentinel2ObservationGeometry]
Observation geometry of the image.
- class_percentagesOptional[Dict[SCLClass, float]]
Class percentages of the image.
Initialize the Sentinel2Metadata class.
Parameters:
- acquisition_timepd.Timestamp
Acquisition time of the image.
- tileidstr
Sentinel-2 tile ID.
- assetidstr
Asset ID of the image.
- productidstr
Product ID of the image.
- projectionstr
Projection of the image.
- datasourceDataSource
Data source of the image.
- class satellitetools.common.sentinel2.Sentinel2ObservationGeometry[source]
Sentinel-2 observation geometry class.
Attributes:
- sun_azimuthfloat
Sun azimuth angle.
- sun_zenithfloat
Sun zenith angle.
- view_azimuthfloat
View azimuth angle.
- view_zenithfloat
View zenith angle.
- class satellitetools.common.sentinel2.Coordinates[source]
Coordinates class.
Attributes:
- xlist[float]
List of x coordinates.
- ylist[float]
List of y coordinates.
- class satellitetools.common.sentinel2.Sentinel2Item(metadata: Sentinel2Metadata, data: Dict[S2Band, numpy.ndarray] | None = None)[source]
Sentinel-2 data item class.
Attributes:
- metadataSentinel2Metadata
Metadata of the data item.
- dataOptional[Dict[S2Band, np.ndarray]]
Data of the data item.
- coordinatesDict[S2Band, Coordinates]
Coordinates of the data item.
Initialize the Sentinel2Item class.
Parameters:
- metadataSentinel2Metadata
Metadata of the data item.
- dataOptional[Dict[S2Band, np.ndarray]]
Data of the data item.
- coordinates: Dict[S2Band, Coordinates][source]
- class satellitetools.common.sentinel2.Sentinel2DataCollection(aoi: satellitetools.common.classes.AOI, req_params: Sentinel2RequestParams)[source]
Sentinel-2 data collection class.
Attributes:
- aoiAOI
Area of interest.
- req_paramsSentinel2RequestParams
Request parameters.
- quality_informationpd.DataFrame
Quality information.
- xr_datasetxr.Dataset
Xarray dataset.
- s2_itemsList[Sentinel2Item]
List of Sentinel-2 items.
Initialize the Sentinel2DataCollection class.
Parameters:
- aoiAOI
Area of interest.
- req_paramsSentinel2RequestParams
Request parameters.
- s2_items: List[Sentinel2Item] = None[source]
- filter_s2_items_by_tile(tileid: str | None = None)[source]
Filter S2 items by tile.
Parameters:
- tileidstr
Tile ID.
- filter_s2_items_by_quality_information(qi_threshold: float = 0, qi_filter: List[SCLClass] = S2_FILTER1)[source]
Filter S2 items based on quality information.
Parameters:
- qi_thresholdfloat
Quality indicator threshold.
- qi_filterList[SCLClass]
Quality indicator filter.
- satellitetools.common.sentinel2.filter_s2_qi_dataframe(s2_qi_dataframe: pandas.DataFrame, qi_thresh: float, s2_filter: List[SCLClass] = S2_FILTER1) pandas.DataFrame[source]
Filter qi dataframe.
Parameters:
- s2_qi_dataframepd.DataFrame
Quality information dataframe.
- qi_threshfloat
Quality indicator threshold.
- s2_filterList[SCLClass]
Quality indicator filter.
Returns:
- pd.DataFrame
Filtered quality information dataframe.