Cube Visualization

This tutorial shows how to visualize a cube:

[1]:
import cubo
import xarray as xr

Create a cube with an edge size of 64 pixels from Sentinel-2 and apply a cloud coverage filter of 40 percent. Get just the RGB bands:

[2]:
da = cubo.create(
    lat=47.848151988493385,
    lon=13.379491178028564,
    collection="sentinel-2-l2a",
    bands=["B02","B03","B04"],
    start_date="2020-01-01",
    end_date="2021-01-01",
    edge_size=64,
    resolution=10,
    query={"eo:cloud_cover": {"lt": 40}}
)
da
[2]:
<xarray.DataArray 'sentinel-2-l2a' (time: 46, band: 3, y: 64, x: 64)>
dask.array<fetch_raster_window, shape=(46, 3, 64, 64), dtype=float64, chunksize=(1, 1, 64, 64), chunktype=numpy.ndarray>
Coordinates: (12/46)
  * time                                     (time) datetime64[ns] 2020-01-01...
    id                                       (time) <U54 'S2B_MSIL2A_20200101...
  * band                                     (band) <U3 'B02' 'B03' 'B04'
  * x                                        (x) float64 3.784e+05 ... 3.791e+05
  * y                                        (y) float64 5.301e+06 ... 5.3e+06
    s2:cloud_shadow_percentage               (time) float64 6.94 6.743 ... 6.516
    ...                                       ...
    gsd                                      float64 10.0
    proj:bbox                                object {300000.0, 409800.0, 5400...
    common_name                              (band) <U5 'blue' 'green' 'red'
    center_wavelength                        (band) float64 0.49 0.56 0.665
    full_width_half_max                      (band) float64 0.098 0.045 0.038
    epsg                                     <U10 'EPSG:32633'
Attributes:
    collection:           sentinel-2-l2a
    stac:                 https://planetarycomputer.microsoft.com/api/stac/v1
    epsg:                 EPSG:32633
    resolution:           10
    edge_size:            64
    central_lat:          47.848151988493385
    central_lon:          13.379491178028564
    central_y:            5300694.38448788
    central_x:            378764.6058600877
    time_coverage_start:  2020-01-01
    time_coverage_end:    2021-01-01

Visualize an RGB image per timestep in the cube:

[3]:
(da.sel(band=["B04","B03","B02"])/2000).clip(0,1).plot.imshow(col="time",col_wrap = 5)
[3]:
<xarray.plot.facetgrid.FacetGrid at 0x7f1e87e93550>
../_images/tutorials_cube_visualization_6_1.png