Reader¶
- class Reader[source]¶
Bases:
object
Factory class creating satellite products according to their names.
It creates a singleton that you can call only on,e time per file.
Methods
__init__
()open
(product_path[, archive_path, ...])Open the product.
valid_mtd
(product_path, platform)Check if the product's mtd is in the product folder/archive
valid_name
(product_path, platform)Check if the product's name is valid for the given satellite
- open(product_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], archive_path: Optional[Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path]] = None, output_path: Optional[Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path]] = None, method: eoreader.reader.CheckMethod = CheckMethod.MTD, remove_tmp: bool = False) Product [source]¶
Open the product.
>>> from eoreader.reader import Reader >>> path = r"S2A_MSIL1C_20200824T110631_N0209_R137_T30TTK_20200824T150432.SAFE.zip" >>> Reader().open(path) <eoreader.products.optical.s2_product.S2Product object at 0x000001984986FAC8>
- 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
- Returns
Correct products
- Return type
- valid_mtd(product_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], platform: Union[str, eoreader.reader.Platform]) bool [source]¶
Check if the product’s mtd is in the product folder/archive
>>> from eoreader.reader import Reader, Platform >>> 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 Platform >>> Reader().valid_mtd(path, Platform.S1) False >>> Reader().valid_mtd(path, Platform.S2) True
- valid_name(product_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], platform: Union[str, eoreader.reader.Platform]) bool [source]¶
Check if the product’s name is valid for the given satellite
>>> from eoreader.reader import Reader, Platform >>> 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 Platform >>> Reader().valid_name(path, Platform.S1) False >>> Reader().valid_name(path, Platform.S2) True