Explore collection metadata using earthdaily

Import librairies

from rich.console import Console
from rich.table import Table

from earthdaily import EarthDataStore

console = Console()

Init earthdatastore with environment variables or default credentials

eds = EarthDataStore()
Traceback (most recent call last):
  File "/private/var/folders/_t/czv_cfrd613_6_gd_p8qpqd80000gp/T/tmpmap_d3kq/7261d0bf6bc6b22a0278281791f6623d19ddf89a/examples/summary_stack.py", line 21, in <module>
    eds = EarthDataStore()
          ^^^^^^^^^^^^^^^^
  File "/private/var/folders/_t/czv_cfrd613_6_gd_p8qpqd80000gp/T/tmpmap_d3kq/7261d0bf6bc6b22a0278281791f6623d19ddf89a/earthdaily/__init__.py", line 51, in EarthDataStore
    return earthdatastore.Auth.from_credentials(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_t/czv_cfrd613_6_gd_p8qpqd80000gp/T/tmpmap_d3kq/7261d0bf6bc6b22a0278281791f6623d19ddf89a/earthdaily/earthdatastore/__init__.py", line 464, in from_credentials
    config = cls.read_credentials(
             ^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_t/czv_cfrd613_6_gd_p8qpqd80000gp/T/tmpmap_d3kq/7261d0bf6bc6b22a0278281791f6623d19ddf89a/earthdaily/earthdatastore/__init__.py", line 529, in read_credentials
    raise NotImplementedError("Credentials weren't found.")
NotImplementedError: Credentials weren't found.

Explore available collections

table = Table("Available collections")
for t in eds.explore():
    table.add_row(t)
console.print(table)

Explore a specific collection

collection = eds.explore("sentinel-2-c1-l2a")
console.log(collection.properties)

List properties available per item

table = Table("properties", "values", "dtype", title=f"Properties for {collection}")
for k, v in collection.item_properties.items():  # item_properties is a dict
    table.add_row(k, str(v), type(v).__name__)
console.print(table)

Read assets and metadata

table = Table("assets", "common_name", "description", title=f"Assets for {collection}")
for asset in collection.assets():
    table.add_row(
        asset,
        collection.assets(asset).get("eo:bands", [{}])[0].get("common_name"),
        collection.assets(asset).get("eo:bands", [{}])[0].get("description"),
    )
console.print(table)

Total running time of the script: (0 minutes 0.004 seconds)

Gallery generated by Sphinx-Gallery