Reader
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, cloudpathlib.cloudpath.CloudPath, Path], archive_path: Optional[Union[str, cloudpathlib.cloudpath.CloudPath, Path]] = None, output_path: Optional[Union[str, cloudpathlib.cloudpath.CloudPath, Path]] = None, method: CheckMethod = CheckMethod.MTD, remove_tmp: bool = False, custom=False, **kwargs) 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
custom (bool) – True if we want to use a custom stack
- Returns
Correct products
- Return type
- valid_mtd(product_path: Union[str, cloudpathlib.cloudpath.CloudPath, Path], platform: Union[str, 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, Path], platform: Union[str, 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