Simple Python 3 module to read Sentinel 2 metadata from SAFE. In its current version, it is designed to work with Level 1C data and Level 2A data.
Derived from old and unsupported Python 2 (https://github.com/ungarj/s2reader)
To get more information on the data format, please be refered to the official Sentinel 2 Product Specification. A brief introduction on the most important termes can be found in the documentation as well.
import s2reader3
with s2reader3.open("example.SAFE") as s2_product:
# returns product start time
print(s2_product.product_start_time)
# returns product stop time
print(s2_product.product_stop_time)
# returns product generation time
print(s2_product.generation_time)
# returns product footprint
print(s2_product.footprint)
# iterates through product granules
for granule in s2_product.granules:
# returns granule path
print(granule.granule_path)
# returns granule footprint
print(granule.footprint)
# returns list of image paths of a specific band (e.g. all .jp2 files for
# band 1)
print(s2_product.granule_paths(1))