Reader#
- class Reader[source]#
Bases:
object
Factory class creating satellite products according to their names.
It creates a singleton that you can call only one time per file.
- open(product_path: Union[str, CloudPath, Path], archive_path: Union[str, CloudPath, Path] = None, output_path: Union[str, CloudPath, Path] = None, method: CheckMethod = CheckMethod.MTD, remove_tmp: bool = False, custom: bool = False, constellation: Union[Constellation, str, list] = None, **kwargs) Product [source]#
Open the product.
>>> from eoreader.reader import Reader >>> path = r"S2B_MSIL1C_20210517T103619_N7990_R008_T30QVE_20210929T075738.SAFE.zip" >>> Reader().open(path) eoreader.S2Product 'S2B_MSIL1C_20210517T103619_N7990_R008_T30QVE_20210929T075738' Attributes: condensed_name: 20210517T103619_S2_T30QVE_L1C_075738 path: D:/S2B_MSIL1C_20210517T103619_N7990_R008_T30QVE_20210929T075738.SAFE.zip constellation: Sentinel-2 sensor type: Optical product type: MSIL1C default pixel size: 10.0 default resolution: 10.0 acquisition datetime: 2021-05-17T10:36:19 band mapping: COASTAL_AEROSOL: 01 BLUE: 02 GREEN: 03 RED: 04 VEGETATION_RED_EDGE_1: 05 VEGETATION_RED_EDGE_2: 06 VEGETATION_RED_EDGE_3: 07 NIR: 8A NARROW_NIR: 08 WATER_VAPOUR: 09 CIRRUS: 10 SWIR_1: 11 SWIR_2: 12 needs extraction: False cloud cover: 0.155752635193646 tile name: T30QVE
- Parameters:
product_path (Union[str, CloudPath, Path]) – Product path
archive_path (Union[str, CloudPath, Path]) – Archive path
output_path (Union[str, CloudPath, Path]) – Output Path
method (CheckMethod) – Checking method used to recognize the products
remove_tmp (bool) – Remove temp files (such as clean or orthorectified bands…) when the product is deleted
custom (bool) – True if we want to use a custom stack
constellation (Union[Constellation, str, list]) – One or several constellations to help the Reader to choose more rapidly the correct Product
- Returns:
Correct products
- Return type:
- valid_mtd(product_path: Union[str, CloudPath, Path], constellation: Union[str, Constellation]) bool [source]#
Check if the product’s mtd is in the product folder/archive
>>> from eoreader.reader import Reader, Constellation >>> path = r"S2A_MSIL1C_20200824T110631_N0209_R137_T30TTK_20200824T150432.SAFE.zip" >>> With IDs >>> Reader().valid_mtd(path, "S1") False >>> Reader().valid_mtd(path, "S2") True >>> # With names >>> Reader().valid_mtd(path, "Sentinel-1") False >>> Reader().valid_mtd(path, "Sentinel-2") True >>> # With Constellation >>> Reader().valid_mtd(path, Constellation.S1) False >>> Reader().valid_mtd(path, Constellation.S2) True
- Parameters:
product_path (Union[str, CloudPath, Path]) – Product path
constellation (Union[str, Constellation]) – Constellation’s name or ID
- Returns:
True if valid name
- Return type:
- valid_name(product_path: Union[str, CloudPath, Path], constellation: Union[str, Constellation]) bool [source]#
Check if the product’s name is valid for the given satellite
>>> from eoreader.reader import Reader, Constellation >>> path = r"S2A_MSIL1C_20200824T110631_N0209_R137_T30TTK_20200824T150432.SAFE.zip" >>> With IDs >>> Reader().valid_name(path, "S1") False >>> Reader().valid_name(path, "S2") True >>> # With names >>> Reader().valid_name(path, "Sentinel-1") False >>> Reader().valid_name(path, "Sentinel-2") True >>> # With Constellation >>> Reader().valid_name(path, Constellation.S1) False >>> Reader().valid_name(path, Constellation.S2) True