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__()

Initialize self.

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: str, archive_path: Optional[str] = None, output_path: Optional[str] = None, method=<CheckMethod.MTD: 'Metadata'>)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 (str) – Product path

  • archive_path (str) – Archive path

  • output_path (str) – Output Path

  • look_for_mtd (bool) – Look for the metadata. If false, only check the

Returns

Correct products

Return type

Product

valid_mtd(product_path: str, 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
Parameters
  • product_path (str) – Product path

  • platform (str) – Platform’s name or ID

Returns

True if valid name

Return type

bool

valid_name(product_path: str, 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
Parameters
  • product_path (str) – Product path

  • platform (str) – Platform’s name or ID

Returns

True if valid name

Return type

bool