Cubes Visualization with Lexcube

This tutorial shows how to visualize different cubes using Lexcube:

[1]:
import cubo
import lexcube

If you are in Google Colab you have to run the following cell:

[ ]:
# from google.colab import output
# output.enable_custom_widget_manager()

Sentinel-2

An example over crop fields in Colombia.

[2]:
s2 = cubo.create(
    lat=4.31,
    lon=-76.2,
    collection="sentinel-2-l2a",
    bands=["B02","B03","B04"],
    start_date="2019-01-01",
    end_date="2021-12-31",
    edge_size=64,
    resolution=10,
    query={"eo:cloud_cover": {"lt": 40}}
)

ws2 = lexcube.Cube3DWidget(s2.sel(band="B04"), cmap="viridis", vmin=0, vmax=2000)
ws2
/net/home/dmontero/.conda/envs/cube/lib/python3.11/site-packages/stackstac/prepare.py:408: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
  times = pd.to_datetime(
[2]:

Sentinel-1

A C-band cube over the Panama Canal.

[5]:
s1 = cubo.create(
    lat=8.93548,
    lon=-79.56005,
    collection="sentinel-1-rtc",
    bands=["vv","vh"],
    start_date="2021-01-01",
    end_date="2021-12-31",
    edge_size=256,
    resolution=10,
)

ws1 = lexcube.Cube3DWidget(s1.sel(band="vv"), cmap="Greys_r", vmin=0, vmax=0.6)
ws1
/net/home/dmontero/.conda/envs/cube/lib/python3.11/site-packages/stackstac/prepare.py:408: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
  times = pd.to_datetime(
[5]:

MODIS Gross Primary Productivity (GPP)

GPP over the Hainich National Park in Germany.

[6]:
gpp = cubo.create(
    lat=51.0825008,
    lon=10.437455,
    collection="modis-17A2H-061",
    bands=["Gpp_500m"],
    start_date="2022-01-01",
    end_date="2022-12-31",
    edge_size=64,
    resolution=500,
).where(lambda x: x["platform"] == "terra",drop=True)

wgpp = lexcube.Cube3DWidget(gpp.sel(band="Gpp_500m"), cmap="YlGn", vmin=0, vmax=0.1)
wgpp
/net/home/dmontero/.conda/envs/cube/lib/python3.11/site-packages/stackstac/prepare.py:408: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
  times = pd.to_datetime(
[6]:

MODIS Land Surface Temperature (LST)

LST over Budapest.

[12]:
lst = cubo.create(
    lat=47.49744,
    lon=19.048363,
    collection="modis-11A2-061",
    bands=["LST_Day_1km"],
    start_date="2022-01-01",
    end_date="2022-12-31",
    edge_size=128,
    resolution=500,
).where(lambda x: x["platform"] == "terra",drop=True)

wlst = lexcube.Cube3DWidget(lst.sel(band="LST_Day_1km"), cmap="inferno", vmin=270, vmax=310)
wlst
/net/home/dmontero/.conda/envs/cube/lib/python3.11/site-packages/stackstac/prepare.py:408: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
  times = pd.to_datetime(
[12]: