.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/summary_stack.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__auto_examples_summary_stack.py: Explore collection metadata using earthdaily =============================================================== .. GENERATED FROM PYTHON SOURCE LINES 7-9 Import librairies ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 9-17 .. code-block:: Python from rich.console import Console from rich.table import Table from earthdaily import EarthDataStore console = Console() .. GENERATED FROM PYTHON SOURCE LINES 18-20 Init earthdatastore with environment variables or default credentials ---------------------------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 20-23 .. code-block:: Python eds = EarthDataStore() .. rst-class:: sphx-glr-script-out .. code-block:: pytb 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 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. .. GENERATED FROM PYTHON SOURCE LINES 24-26 Explore available collections ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 26-32 .. code-block:: Python table = Table("Available collections") for t in eds.explore(): table.add_row(t) console.print(table) .. GENERATED FROM PYTHON SOURCE LINES 33-35 Explore a specific collection ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 35-39 .. code-block:: Python collection = eds.explore("sentinel-2-c1-l2a") console.log(collection.properties) .. GENERATED FROM PYTHON SOURCE LINES 40-42 List properties available per item ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 42-48 .. code-block:: Python 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) .. GENERATED FROM PYTHON SOURCE LINES 49-51 Read assets and metadata ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 51-60 .. code-block:: Python 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) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.004 seconds) .. _sphx_glr_download__auto_examples_summary_stack.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: summary_stack.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: summary_stack.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: summary_stack.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_