.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/compare_scale_s2.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_compare_scale_s2.py: Compare Sentinel-2 scale/offset evolution during time ================================================================= Using SCL data from L2A .. GENERATED FROM PYTHON SOURCE LINES 8-10 Import librairies ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 10-15 .. code-block:: Python from matplotlib import pyplot as plt from earthdaily import EarthDataStore, datasets .. GENERATED FROM PYTHON SOURCE LINES 16-18 Load plot ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 18-22 .. code-block:: Python # load geojson pivot = datasets.load_pivot() .. GENERATED FROM PYTHON SOURCE LINES 23-25 Init earthdatastore with environment variables or default credentials ---------------------------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 25-29 .. code-block:: Python eds = EarthDataStore() .. GENERATED FROM PYTHON SOURCE LINES 30-32 Search for collection items .. GENERATED FROM PYTHON SOURCE LINES 32-45 .. code-block:: Python def get_cube(rescale=True): pivot_cube = eds.datacube( "sentinel-2-l2a", intersects=pivot, datetime=["2022-01-01", "2022-03-10"], assets=["red", "green", "blue"], mask_with="native", # same as scl clear_cover=50, # at least 50% of the polygon must be clear rescale=rescale, ) return pivot_cube .. GENERATED FROM PYTHON SOURCE LINES 46-48 Get cube with rescale (*0.0001) ---------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: Python pivot_cube = get_cube(rescale=False) * 0.0001 .. GENERATED FROM PYTHON SOURCE LINES 52-54 Plots cube with SCL with at least 50% of clear data ---------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 54-58 .. code-block:: Python pivot_cube.ed.plot_rgb(col_wrap=3) plt.show() .. image-sg:: /_auto_examples/images/sphx_glr_compare_scale_s2_001.png :alt: time = 2022-01-07, time = 2022-01-09, time = 2022-01-22, time = 2022-01-29, time = 2022-02-03, time = 2022-02-11, time = 2022-02-16, time = 2022-02-18, time = 2022-02-26, time = 2022-02-28, time = 2022-03-03, time = 2022-03-08 :srcset: /_auto_examples/images/sphx_glr_compare_scale_s2_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 59-61 Get cube with automatic rescale (default option) ---------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 61-66 .. code-block:: Python pivot_cube = get_cube() pivot_cube.clear_percent.plot.scatter(x="time") plt.show() .. image-sg:: /_auto_examples/images/sphx_glr_compare_scale_s2_002.png :alt: spatial_ref = 0 :srcset: /_auto_examples/images/sphx_glr_compare_scale_s2_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 67-69 Plots cube with SCL with at least 50% of clear data ---------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 69-73 .. code-block:: Python pivot_cube.ed.plot_rgb(col_wrap=3) plt.show() .. image-sg:: /_auto_examples/images/sphx_glr_compare_scale_s2_003.png :alt: time = 2022-01-07, time = 2022-01-09, time = 2022-01-22, time = 2022-01-29, time = 2022-02-03, time = 2022-02-11, time = 2022-02-16, time = 2022-02-18, time = 2022-02-26, time = 2022-02-28, time = 2022-03-03, time = 2022-03-08 :srcset: /_auto_examples/images/sphx_glr_compare_scale_s2_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 1.656 seconds) .. _sphx_glr_download__auto_examples_compare_scale_s2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: compare_scale_s2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: compare_scale_s2.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: compare_scale_s2.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_