Earth Observation Data and Tools for Climate Resilience and Risk Monitoring

with medium-resolution EO examples for Africa and Asia

This notebook is focused on:

  • medium-resolution Earth Observation (EO) datasets such as Sentinel-3, MODIS, and a few complementary products;
  • practical access patterns using STAC API, Microsoft Planetary Computer (MPC), Google Earth Engine (GEE), Xee, and cubo;
  • simple climate resilience and risk-monitoring examples for Africa and Asia.

This notebook is built as a practice notebook. Some cells may require authentication or internet access and are meant for live demonstration only.

Learning objectives

By the end of the session, participants should be able to:

  • explain why medium-resolution EO is useful for continental and regional monitoring;
  • discover datasets with a STAC API;
  • read EO data from Microsoft Planetary Computer;
  • access Earth Engine collections in Python with GEE and Xee;
  • use cubo as a higher-level data-cube interface for both STAC and GEE;
  • build basic resilience indicators such as:
    • NDVI time series,
    • simple anomalies,
    • rainfall + vegetation context,
    • coastal water/land color quicklooks.

Why medium-resolution EO?

Medium-resolution EO is often a strong fit for climate resilience because it balances:

  • spatial detail sufficient for regional landscapes, coastlines, croplands, and large water bodies;
  • temporal frequency suitable for anomaly detection and seasonal monitoring;
  • manageable data volume for teaching and prototyping.

Typical use cases

  • drought and vegetation stress,
  • flood extent context,
  • water quality and coastal monitoring,
  • land surface conditions,
  • seasonal food-security and livelihood monitoring.

Datasets used in this tutorial

Core datasets

  • MODIS MOD13Q1 / MYD13Q1: 16-day vegetation indices at 250 m
  • Sentinel-3 OLCI: ocean and land color radiances at 300 m
  • optional complementary context:
    • CHIRPS rainfall,
    • MODIS LST,
    • Sentinel-3 SLSTR where relevant

Study areas

  • Africa: Somali Region of Ethiopia / East Africa vegetation monitoring Event Reference
  • Asia: Ganges-Brahmaputra delta coastal-water example

You can replace these AOIs with your own polygons later.

In [ ]:
#!python -m pip install -q cubo xarray dask[complete] pystac-client planetary-computer xee earthengine-api geemap matplotlib pandas numpy shapely geopandas contextily
#!python -m pip install -q odc-stac stackstac rioxarray
In [ ]:
# !python -m pip freeze > requirements.txt

Create a venv and install the dependencies

In [ ]:
# !python -m venv .venv
# !source .venv/bin/activate
# !pip install -r requirements.txt
# !python -m pip install -r requirements.txt ## incase you have problems with the above command, try this one instead. It will install the packages in the requirements.txt file into your current Python environment.

Imports

In [1]:
import warnings
warnings.filterwarnings("ignore")

import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import geopandas as gpd
import contextily as cx

from shapely.geometry import box, mapping

# STAC / MPC
from pystac_client import Client
import planetary_computer as pc

# GEE / Xee
import ee
import xee

# Cubo
import cubo

Authentication notes

Earth Engine

For local Jupyter:

ee.Authenticate()
ee.Initialize(project="YOUR_GEE_PROJECT")

For high-volume endpoint when appropriate:

ee.Initialize(project="YOUR_GEE_PROJECT",
              opt_url="https://earthengine-highvolume.googleapis.com")

Microsoft Planetary Computer

The STAC API is public for metadata search. Asset access often requires signing with planetary_computer.sign_inplace(...) or a modifier function in pystac-client.

In [2]:
# Uncomment when running locally for the first time:
ee.Authenticate()

# Example initialization:
ee.Initialize(project="ee-kizarzakir")
# ee.Initialize(project="YOUR_GEE_PROJECT")

# Or high-volume endpoint:
# ee.Initialize(
#     project="YOUR_GEE_PROJECT",
#     opt_url="https://earthengine-highvolume.googleapis.com"
# )

Helper variables: Africa and Asia AOIs

In [3]:
# Africa example: 
africa_bbox = [43.503799,5.721212,43.839569,5.952095]   # minx, miny, maxx, maxy 
# Asia example: Ganges-Brahmaputra delta / coastal Bangladesh (broad bbox)
asia_bbox = [88.231201,21.399377,89.288635,22.629223]

africa_geom = mapping(box(*africa_bbox))
asia_geom = mapping(box(*asia_bbox))

print("Africa bbox:", africa_bbox)
print("Asia bbox:", asia_bbox)
Africa bbox: [43.503799, 5.721212, 43.839569, 5.952095]
Asia bbox: [88.231201, 21.399377, 89.288635, 22.629223]
In [4]:
# Visualize Asia bbox using GeoPandas + simple basemap
bbox_gdf = gpd.GeoDataFrame(
    {"name": ["Asia AOI"]},
    geometry=[box(*asia_bbox)],
    crs="EPSG:4326",
)

bbox_3857 = bbox_gdf.to_crs(epsg=3857)
ax = bbox_3857.boundary.plot(figsize=(8, 8), color="red", linewidth=2)
cx.add_basemap(ax, source=cx.providers.CartoDB.Positron)
ax.set_title("Asia AOI Bounding Box")
ax.set_axis_off()
plt.show()

bbox_gdf = gpd.GeoDataFrame(
    {"name": ["Africa AOI"]},
    geometry=[box(*africa_bbox)],
    crs="EPSG:4326",
)

bbox_3857 = bbox_gdf.to_crs(epsg=3857)
ax = bbox_3857.boundary.plot(figsize=(8, 8), color="red", linewidth=2)
cx.add_basemap(ax, source=cx.providers.CartoDB.Positron)
ax.set_title("Africa AOI Bounding Box")
ax.set_axis_off()
plt.show()
No description has been provided for this image
No description has been provided for this image

Part 1 — Discover data with STAC API and MPC

This section shows the lowest-friction pattern:

  1. open a STAC API,
  2. search a collection by space and time,
  3. inspect returned items,
  4. optionally pass those results into higher-level tooling later.
In [5]:
# Microsoft Planetary Computer STAC
stac_url = "https://planetarycomputer.microsoft.com/api/stac/v1"

catalog = Client.open(
    stac_url,
    modifier=pc.sign_inplace,  # automatically sign returned items/assets
)
# why modifier=pc.sign_inplace? 
# Because many of the items/assets in the Planetary Computer catalog require authentication to access, and this modifier will automatically sign the returned items/assets with the necessary credentials for access.
print(catalog)
<Client id=microsoft-pc>
In [7]:
# STAC hierarchy: Catalog -> Collection -> Item -> Asset

print("STAC concepts:")
print("1) Catalog   : the top-level entry point (API root) that lists datasets.")
print("2) Collection: a dataset/group with shared metadata (e.g., MODIS NDVI).")
print("3) Item      : one spatiotemporal record in a collection (scene/time granule).")
print("4) Asset     : actual files/links inside an item (bands, metadata, thumbnails, etc.).")

print("\nCurrent catalog:")
print(f"- id: {catalog.id}")
print(f"- title: {getattr(catalog, 'title', None)}")

# Use a known collection from this notebook
collection_id = "modis-13Q1-061"
col = catalog.get_collection(collection_id)

print("\nExample collection:")
print(f"- id: {col.id}")
print(f"- title: {col.title}")
print(f"- description (first 160 chars): {str(col.description)[:160]}...")

# Fetch one example item
search = catalog.search(
    collections=[collection_id],
    bbox=africa_bbox,
    datetime="2021-01-01/2021-12-31",
    limit=1,
)
items = list(search.items())

if items:
    item = items[0]
    print("\nExample item:")
    print(f"- id: {item.id}")
    print(f"- datetime: {item.datetime}")
    print(f"- collection: {item.collection_id}")
    print(f"- bbox: {item.bbox}")

    asset_keys = list(item.assets.keys())
    print(f"\nItem has {len(asset_keys)} assets. First 8 keys: {asset_keys[:8]}")

    # Show one asset in detail
    k = asset_keys[0]
    a = item.assets[k]
    print("\nExample asset:")
    print(f"- key: {k}")
    print(f"- href: {a.href}")
    print(f"- media_type: {a.media_type}")
    print(f"- roles: {a.roles}")
else:
    print("\nNo items found for the example query.")
STAC concepts:
1) Catalog   : the top-level entry point (API root) that lists datasets.
2) Collection: a dataset/group with shared metadata (e.g., MODIS NDVI).
3) Item      : one spatiotemporal record in a collection (scene/time granule).
4) Asset     : actual files/links inside an item (bands, metadata, thumbnails, etc.).

Current catalog:
- id: microsoft-pc
- title: Microsoft Planetary Computer STAC API

Example collection:
- id: modis-13Q1-061
- title: MODIS Vegetation Indices 16-Day (250m)
- description (first 160 chars): The Moderate Resolution Imaging Spectroradiometer (MODIS) Vegetation Indices Version 6.1 data are generated every 16 days at 250 meter (m) spatial resolution as...

Example item:
- id: MYD13Q1.A2021361.h22v08.061.2022010002647
- datetime: None
- collection: modis-13Q1-061
- bbox: [39.8503980445014, -0.0043942224508535, 50.7804337536263, 10.0038388277022]

Item has 16 assets. First 8 keys: ['hdf', 'metadata', '250m_16_days_EVI', '250m_16_days_NDVI', '250m_16_days_VI_Quality', '250m_16_days_MIR_reflectance', '250m_16_days_NIR_reflectance', '250m_16_days_red_reflectance']

Example asset:
- key: hdf
- href: https://modiseuwest.blob.core.windows.net/modis-061/MYD13Q1/22/08/2021361/MYD13Q1.A2021361.h22v08.061.2022010002647.hdf?st=2026-03-25T10%3A16%3A45Z&se=2026-03-26T11%3A01%3A45Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-26T10%3A16%3A32Z&ske=2026-04-02T10%3A16%3A32Z&sks=b&skv=2025-07-05&sig=ksFcKDTMF%2B7PgI/wrvr8yzcRKnAsELBN2KVGkt1oflI%3D
- media_type: application/x-hdf
- roles: ['data']
In [6]:
# list of collections available in the catalog
print ("Collections available in the catalog:")
for collection in catalog.get_collections():
    print("-", collection.id)
Collections available in the catalog:
- daymet-annual-pr
- daymet-daily-hi
- 3dep-seamless
- 3dep-lidar-dsm
- fia
- gridmet
- daymet-annual-na
- daymet-monthly-na
- daymet-annual-hi
- daymet-monthly-hi
- daymet-monthly-pr
- gnatsgo-tables
- hgb
- cop-dem-glo-30
- cop-dem-glo-90
- terraclimate
- nasa-nex-gddp-cmip6
- gpm-imerg-hhr
- gnatsgo-rasters
- 3dep-lidar-hag
- io-lulc-annual-v02
- goes-cmi
- conus404
- sentinel-1-rtc
- noaa-hrrr
- 3dep-lidar-intensity
- 3dep-lidar-pointsourceid
- mtbs
- noaa-c-cap
- 3dep-lidar-copc
- modis-64A1-061
- alos-fnf-mosaic
- 3dep-lidar-returns
- mobi
- landsat-c2-l2
- chloris-biomass
- kaza-hydroforecast
- planet-nicfi-analytic
- modis-17A2H-061
- modis-11A2-061
- daymet-daily-pr
- 3dep-lidar-dtm-native
- 3dep-lidar-classification
- 3dep-lidar-dtm
- gap
- modis-17A2HGF-061
- planet-nicfi-visual
- gbif
- modis-17A3HGF-061
- modis-09A1-061
- alos-dem
- alos-palsar-mosaic
- deltares-water-availability
- modis-16A3GF-061
- modis-21A2-061
- us-census
- jrc-gsw
- deltares-floods
- modis-43A4-061
- modis-09Q1-061
- modis-14A1-061
- hrea
- modis-13Q1-061
- modis-14A2-061
- sentinel-2-l2a
- modis-15A2H-061
- modis-11A1-061
- modis-15A3H-061
- modis-13A1-061
- daymet-daily-na
- nrcan-landcover
- modis-10A2-061
- ecmwf-forecast
- noaa-mrms-qpe-24h-pass2
- nasadem
- io-lulc
- landsat-c2-l1
- drcog-lulc
- chesapeake-lc-7
- chesapeake-lc-13
- chesapeake-lu
- noaa-mrms-qpe-1h-pass1
- noaa-mrms-qpe-1h-pass2
- noaa-nclimgrid-monthly
- usda-cdl
- eclipse
- esa-cci-lc
- esa-cci-lc-netcdf
- fws-nwi
- usgs-lcmap-conus-v13
- usgs-lcmap-hawaii-v10
- noaa-climate-normals-tabular
- noaa-climate-normals-netcdf
- goes-glm
- sentinel-1-grd
- noaa-climate-normals-gridded
- aster-l1t
- cil-gdpcir-cc-by-sa
- naip
- io-lulc-9-class
- io-biodiversity
- noaa-cdr-sea-surface-temperature-whoi
- noaa-cdr-ocean-heat-content
- cil-gdpcir-cc0
- cil-gdpcir-cc-by
- noaa-cdr-sea-surface-temperature-whoi-netcdf
- noaa-cdr-sea-surface-temperature-optimum-interpolation
- modis-10A1-061
- sentinel-5p-l2-netcdf
- sentinel-3-olci-wfr-l2-netcdf
- noaa-cdr-ocean-heat-content-netcdf
- met-office-uk-deterministic-pressure
- sentinel-3-synergy-aod-l2-netcdf
- sentinel-3-synergy-v10-l2-netcdf
- sentinel-3-olci-lfr-l2-netcdf
- sentinel-3-sral-lan-l2-netcdf
- sentinel-3-slstr-lst-l2-netcdf
- sentinel-3-slstr-wst-l2-netcdf
- sentinel-3-sral-wat-l2-netcdf
- hls2-s30
- ms-buildings
- sentinel-3-slstr-frp-l2-netcdf
- sentinel-3-synergy-syn-l2-netcdf
- sentinel-3-synergy-vgp-l2-netcdf
- sentinel-3-synergy-vg1-l2-netcdf
- esa-worldcover
- met-office-uk-deterministic-near-surface
- met-office-global-deterministic-near-surface
- hls2-l30
- met-office-global-deterministic-height
- met-office-global-deterministic-pressure
- met-office-uk-deterministic-height
- met-office-uk-deterministic-whole-atmosphere
- era5-pds
- met-office-global-deterministic-whole-atmosphere
In [ ]:
# collection tree
modis_collection = catalog.get_collection("modis-13Q1-061") # from the list of collections in the catalog - we are taking the MODIS NDVI collection as an example
modis_collection
Out[ ]:
<CollectionClient id=modis-13Q1-061>

Example 1A: Search MODIS NDVI for Africa

In [8]:
search_modis_africa = catalog.search(
    collections=["modis-13Q1-061"],
    bbox=africa_bbox,
    datetime="2021-03-01/2022-05-31",
    limit=5,
)

items_modis_africa = list(search_modis_africa.items())
print(f"Returned {len(items_modis_africa)} items")
print("Top 3 items:")
for item in items_modis_africa[:3]:
    print(item.id, item.datetime)
Returned 64 items
Top 3 items:
MOD13Q1.A2022145.h22v08.061.2022168103056 None
MYD13Q1.A2022137.h22v08.061.2022154045415 None
MOD13Q1.A2022129.h22v08.061.2022146012606 None

Important Note

  • STAC separates collection metadata from items/assets.
  • A STAC search is often the most transferable pattern across cloud EO catalogs.
  • MPC is a good demonstration platform because it exposes many datasets through a standard STAC API.

Example 1B: Search Sentinel-3 for Asia

In [76]:
#Sentinel-3 OLCI

search_s3_asia = catalog.search(
    collections=["sentinel-3-olci-lfr-l2-netcdf"],
    bbox=asia_bbox,
    datetime="2023-01-01/2023-03-31",
    limit=5,
)

items_s3_asia = list(search_s3_asia.items())
print(f"Returned {len(items_s3_asia)} items")
print("Top 3 items:")
for item in items_s3_asia[:3]:
    print(item.id, item.datetime)

# check the assets of the first item
if items_s3_asia:
    item = items_s3_asia[0]
    print(f"\nAssets for item {item.id}:")
    for key, asset in item.assets.items():
        print(f"- {key}: {asset.href} (media_type: {asset.media_type})")
else:
    print("\nNo items found for Sentinel-3 OLCI search.")
Returned 103 items
Top 3 items:
S3B_OL_2_LFR_20230331T041051_20230331T041351_0179_077_375_2520 2023-03-31 04:12:20.862527+00:00
S3A_OL_2_LFR_20230329T040127_20230329T040427_0179_097_104_2520 2023-03-29 04:02:56.917703+00:00
S3A_OL_2_LFR_20230328T042738_20230328T043038_0180_097_090_2520 2023-03-28 04:29:07.780818+00:00

Assets for item S3B_OL_2_LFR_20230331T041051_20230331T041351_0179_077_375_2520:
- iwv: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/iwv.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- lqsf: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/lqsf.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- otci: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/otci.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- gifapar: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/gifapar.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- tie-meteo: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/tie_meteo.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- rc-gifapar: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/rc_gifapar.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- safe-manifest: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/xfdumanifest.xml?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/xml)
- tie-geometries: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/tie_geometries.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- geo-coordinates: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/geo_coordinates.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- instrument-data: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/instrument_data.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- time-coordinates: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/time_coordinates.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)
- tie-geo-coordinates: https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2023/03/31/S3B_OL_2_LFR____20230331T041051_20230331T041351_20230331T223031_0179_077_375_2520_PS2_O_NT_002.SEN3/tie_geo_coordinates.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D (media_type: application/x-netcdf)

Optional: Inspect asset names from a returned STAC item

In [10]:
if items_modis_africa:
    first_item = items_modis_africa[0]
    print("Item ID:", first_item.id)
    print("Assets:")
    for k in first_item.assets:
        print(" -", k)
Item ID: MOD13Q1.A2022145.h22v08.061.2022168103056
Assets:
 - hdf
 - metadata
 - 250m_16_days_EVI
 - 250m_16_days_NDVI
 - 250m_16_days_VI_Quality
 - 250m_16_days_MIR_reflectance
 - 250m_16_days_NIR_reflectance
 - 250m_16_days_red_reflectance
 - 250m_16_days_blue_reflectance
 - 250m_16_days_sun_zenith_angle
 - 250m_16_days_pixel_reliability
 - 250m_16_days_view_zenith_angle
 - 250m_16_days_relative_azimuth_angle
 - 250m_16_days_composite_day_of_the_year
 - tilejson
 - rendered_preview

Part 2 — Use cubo as a simpler data-cube interface

cubo is handy because it gives a compact, xarray-friendly entry point and supports STAC and GEE workflows.

Cubo Reference

Example 2A: cubo with STAC-like workflow (Africa)

This is a compact pattern for building an on-demand EO mini-cube around a point.

  • the cube small,
  • the time range short,
  • the number of bands minimal.
In [40]:
# A point near Somali Region of Ethiopia
lat_africa = 5.947659
lon_africa = 43.559889

start_date = "2021-05-01"
end_date = "2022-05-31"

# a simple cube demonstration
da_africa_cubo = cubo.create(
    lat=lat_africa,
    lon=lon_africa,
    collection="modis-13Q1-061",
    bands=["250m_16_days_NDVI"],
    start_date=start_date,
    end_date=end_date,
    edge_size=64,
    resolution=250,
)


da_africa_cubo
Out[40]:
<xarray.DataArray 'modis-13Q1-061' (time: 56, band: 1, y: 64, x: 64)> Size: 2MB
dask.array<fetch_raster_window, shape=(56, 1, 64, 64), dtype=float64, chunksize=(1, 1, 64, 64), chunktype=numpy.ndarray>
Coordinates: (12/22)
  * time                       (time) datetime64[ns] 448B NaT NaT ... NaT NaT
    id                         (time) <U41 9kB 'MOD13Q1.A2022145.h22v08.061.2...
    platform                   (time) <U5 1kB 'terra' 'aqua' ... 'aqua' 'terra'
    end_datetime               (time) <U20 4kB '2022-06-09T23:59:59Z' ... '20...
    created                    (time) <U20 4kB '2022-06-17T14:30:56Z' ... '20...
    updated                    (time) <U27 6kB '2022-06-17T09:58:59.202000Z' ...
    ...                         ...
    modis:vertical-tile        int64 8B 8
    modis:horizontal-tile      int64 8B 22
    proj:geometry              object 8B {'type': 'Polygon', 'coordinates': [...
    title                      <U11 44B '16 day NDVI'
    raster:bands               object 8B {'unit': 'NDVI', 'scale': 0.0001, 'd...
    epsg                       int64 8B 32638
Attributes:
    collection:           modis-13Q1-061
    stac:                 https://planetarycomputer.microsoft.com/api/stac/v1
    epsg:                 32638
    resolution:           250
    edge_size:            64
    edge_size_m:          16000
    central_lat:          5.947659
    central_lon:          43.559889
    central_y:            657626.3032595307
    central_x:            340592.0592796557
    time_coverage_start:  2021-05-01
    time_coverage_end:    2022-05-31
In [53]:
time_index = 2

# Select band and apply scaling only when needed
if "band" in da_africa_cubo.dims:
    ndvi = da_africa_cubo.sel(band="250m_16_days_NDVI")
else:
    ndvi = da_africa_cubo

scale_factor = 10000.0 if float(ndvi.max().values) > 1.5 else 1.0
ndvi_2d = ndvi.isel(time=time_index).squeeze() / scale_factor

time_labels = pd.date_range(start=start_date, end=end_date, periods=ndvi.sizes["time"])
snapshot_label = time_labels[time_index].strftime("%Y-%m-%d")

plt.figure(figsize=(6, 5))
ndvi_2d.plot(cmap="YlGn")
plt.title(f"MODIS NDVI snapshot ({snapshot_label})")
plt.axis("off")
plt.show()
No description has been provided for this image

Example 2B: cubo with Google Earth Engine (Asia, Sentinel-3 or MODIS)

When gee=True, cubo can pull data cubes from Earth Engine collections.

In [54]:
# Initialize Earth Engine first if needed:
# ee.Initialize(project="YOUR_GEE_PROJECT",
#               opt_url="https://earthengine-highvolume.googleapis.com")

lat_africa = 5.947659
lon_africa = 43.559889

# Example: MODIS NDVI via GEE-backed cubo
da_africa_gee_cubo = cubo.create(
    lat=lat_africa,
    lon=lon_africa,
    collection="MODIS/061/MOD13Q1",
    bands=["NDVI", "EVI"],
    start_date=start_date,
    end_date=end_date,
    edge_size=64,
    resolution=250,
    gee=True,
)
da_africa_gee_cubo
Out[54]:
<xarray.DataArray 'MODIS/061/MOD13Q1' (time: 25, band: 2, y: 64, x: 64)> Size: 819kB
dask.array<transpose, shape=(25, 2, 64, 64), dtype=float32, chunksize=(25, 1, 64, 64), chunktype=numpy.ndarray>
Coordinates:
  * time                       (time) datetime64[ns] 200B 2021-05-09 ... 2022...
  * band                       (band) object 16B 'NDVI' 'EVI'
  * y                          (y) float64 512B 6.499e+05 ... 6.656e+05
  * x                          (x) float64 512B 3.326e+05 ... 3.484e+05
    cubo:distance_from_center  (y, x) float64 33kB 1.112e+04 ... 1.116e+04
Attributes:
    collection:           MODIS/061/MOD13Q1
    stac:                 https://earthengine-stac.storage.googleapis.com/cat...
    epsg:                 32638
    resolution:           250
    edge_size:            64
    edge_size_m:          16000
    central_lat:          5.947659
    central_lon:          43.559889
    central_y:            657626.3032595307
    central_x:            340592.0592796557
    time_coverage_start:  2021-05-01
    time_coverage_end:    2022-05-31
In [55]:
lat_asia = 22.5
lon_asia = 90.0

da_asia_cubo = cubo.create(
    lat=lat_asia,   
    lon=lon_asia,
    collection="MODIS/061/MOD13Q1",
    bands=["NDVI", "EVI"],
    start_date=start_date,
    end_date=end_date,
    edge_size=64,
        resolution=250,
        gee=True,
)
da_asia_cubo
Out[55]:
<xarray.DataArray 'MODIS/061/MOD13Q1' (time: 25, band: 2, y: 64, x: 64)> Size: 819kB
dask.array<transpose, shape=(25, 2, 64, 64), dtype=float32, chunksize=(25, 1, 64, 64), chunktype=numpy.ndarray>
Coordinates:
  * time                       (time) datetime64[ns] 200B 2021-05-09 ... 2022...
  * band                       (band) object 16B 'NDVI' 'EVI'
  * y                          (y) float64 512B 2.483e+06 ... 2.499e+06
  * x                          (x) float64 512B 8.009e+05 ... 8.166e+05
    cubo:distance_from_center  (y, x) float64 33kB 1.109e+04 ... 1.119e+04
Attributes:
    collection:           MODIS/061/MOD13Q1
    stac:                 https://earthengine-stac.storage.googleapis.com/cat...
    epsg:                 32645
    resolution:           250
    edge_size:            64
    edge_size_m:          16000
    central_lat:          22.5
    central_lon:          90.0
    central_y:            2491265.989701727
    central_x:            808665.6894232032
    time_coverage_start:  2021-05-01
    time_coverage_end:    2022-05-31
In [56]:
# visualize one time step
time_index = 2
# Select band and plot
if "band" in da_asia_cubo.dims:
    ndvi = da_asia_cubo.sel(band="NDVI")
else:
    ndvi = da_asia_cubo
ndvi_2d = ndvi.isel(time=time_index).squeeze() / 10000.0
plt.figure(figsize=(6, 5))
ndvi_2d.plot(cmap="YlGn")
plt.title(f"MODIS NDVI snapshot ({ndvi.time.values[time_index]})")
plt.axis("off")
plt.show()
No description has been provided for this image

Optional Sentinel-3 variant in GEE-backed cubo

In [58]:
# Sentinel-3 OLCI in GEE
da_s3_cubo = cubo.create(
    lat=lat_asia,
    lon=lon_asia,
    collection="COPERNICUS/S3/OLCI",
    bands=["Oa08_radiance", "Oa06_radiance", "Oa04_radiance"],
    start_date=start_date,
    end_date=end_date,
    edge_size=64,
    resolution=300,
    gee=True,
)
da_s3_cubo
Out[58]:
<xarray.DataArray 'COPERNICUS/S3/OLCI' (time: 453, band: 3, y: 64, x: 64)> Size: 22MB
dask.array<transpose, shape=(453, 3, 64, 64), dtype=float32, chunksize=(48, 1, 64, 64), chunktype=numpy.ndarray>
Coordinates:
  * time                       (time) datetime64[ns] 4kB 2021-05-03T04:20:10 ...
  * band                       (band) object 24B 'Oa08_radiance' ... 'Oa04_ra...
  * y                          (y) float64 512B 2.482e+06 ... 2.501e+06
  * x                          (x) float64 512B 7.994e+05 ... 8.183e+05
    cubo:distance_from_center  (y, x) float64 33kB 1.332e+04 ... 1.341e+04
Attributes:
    collection:           COPERNICUS/S3/OLCI
    stac:                 https://earthengine-stac.storage.googleapis.com/cat...
    epsg:                 32645
    resolution:           300
    edge_size:            64
    edge_size_m:          19200
    central_lat:          22.5
    central_lon:          90.0
    central_y:            2491265.989701727
    central_x:            808665.6894232032
    time_coverage_start:  2021-05-01
    time_coverage_end:    2022-05-31

Part 3 — Earth Engine + Xee for xarray-native analysis

xee is excellent when you want Earth Engine collections to feel more like xarray datasets. This is a strong teaching path for people already comfortable with Python arrays.

Example 3A: Africa MODIS NDVI time series with Xee

In [21]:
# Earth Engine geometry
africa_roi = ee.Geometry.Rectangle(africa_bbox)
# plot the geometry on a map using geemap
import geemap
Map = geemap.Map(center=[(africa_bbox[1] + africa_bbox[3]) / 2, (africa_bbox[0] + africa_bbox[2]) / 2], zoom=6)
Map.addLayer(africa_roi, {}, "Africa ROI")
Map.addLayerControl()
Map
Out[21]:
Map(center=[5.836653500000001, 43.671684], controls=(WidgetControl(options=['position', 'transparent_bg'], pos…
In [94]:
# MODIS NDVI collection
modis_ic = (
    ee.ImageCollection("MODIS/061/MOD13Q1")
    .filterBounds(africa_roi)
    .filterDate(start_date, end_date)
    .select(["NDVI", "EVI"])
)

# xee scale is in CRS units; in EPSG:4326 use ~250 m in degrees
scale_deg_250m = 250 / 111320

# Open with xee
ds_modis_xee = xr.open_dataset(
    modis_ic,
    engine="ee",
    geometry=africa_bbox,
    crs="EPSG:4326",
    scale=scale_deg_250m,
)

print(ds_modis_xee.sizes)
ds_modis_xee
Native MODIS CRS token not supported here; using EPSG:4326 fallback.
Frozen({'time': 25, 'lon': 161, 'lat': 111})
Out[94]:
<xarray.Dataset> Size: 4MB
Dimensions:  (time: 25, lon: 161, lat: 111)
Coordinates:
  * time     (time) datetime64[ns] 200B 2021-05-09 2021-05-25 ... 2022-05-25
  * lon      (lon) float64 1kB 43.5 43.51 43.51 43.51 ... 43.83 43.84 43.84
  * lat      (lat) float64 888B 5.722 5.724 5.726 5.728 ... 5.947 5.949 5.951
Data variables:
    NDVI     (time, lon, lat) float32 2MB ...
    EVI      (time, lon, lat) float32 2MB ...
Attributes:
    crs:      EPSG:4326

Example 3B: Reduce to a simple regional mean time series

In [60]:
# Previous (STAC cubo) approach kept for reference:
# if "band" in da_africa_cubo.dims:
#     ndvi = da_africa_cubo.sel(band="250m_16_days_NDVI")
# else:
#     ndvi = da_africa_cubo
# scale_factor = 10000.0 if float(ndvi.max().values) > 1.5 else 1.0
# ndvi = ndvi / scale_factor
# ndvi_mean_da = ndvi.mean(dim=("x", "y"))
# n_time = ndvi_mean_da.sizes["time"]
# time_axis = pd.date_range(start=start_date, end=end_date, periods=n_time)
# ndvi_mean_series = pd.Series(np.asarray(ndvi_mean_da.values).reshape(-1), index=time_axis, name="NDVI")

# Use GEE cubo directly (native time, no NaT fix needed)
if "band" in da_africa_gee_cubo.dims:
    band_names = [str(b) for b in da_africa_gee_cubo.band.values]
    target_band = "NDVI" if "NDVI" in band_names else band_names[0]
    ndvi = da_africa_gee_cubo.sel(band=target_band)
else:
    ndvi = da_africa_gee_cubo

scale_factor = 10000.0 if float(ndvi.max().values) > 1.5 else 1.0
ndvi = ndvi / scale_factor
ndvi_mean_series = ndvi.mean(dim=("x", "y")).to_series()

fig, ax = plt.subplots(figsize=(10, 4))
ndvi_mean_series.plot(ax=ax, marker="o")
ax.set_title(f"Africa GEE cubo NDVI mean ({start_date} to {end_date})")
ax.set_ylabel("NDVI")
ax.set_xlabel("time")
plt.show()
No description has been provided for this image
In [ ]:
# Interactive comparison
import ipywidgets as widgets
from IPython.display import display

# Select NDVI band from GEE cubo
if "band" in da_africa_gee_cubo.dims:
    band_names = [str(b) for b in da_africa_gee_cubo.band.values]
    target_band = "NDVI" if "NDVI" in band_names else band_names[0]
    ndvi_cube = da_africa_gee_cubo.sel(band=target_band).transpose("time", "y", "x")
else:
    ndvi_cube = da_africa_gee_cubo.transpose("time", "y", "x")

scale_factor = 10000.0 if float(ndvi_cube.max().values) > 1.5 else 1.0
ndvi_cube = ndvi_cube / scale_factor

time_labels = pd.to_datetime(ndvi_cube.time.values).strftime("%Y-%m-%d").tolist()
max_index = ndvi_cube.sizes["time"] - 1

vmin = float(np.nanpercentile(ndvi_cube.values, 5))
vmax = float(np.nanpercentile(ndvi_cube.values, 95))

left_slider = widgets.IntSlider(
    value=0, min=0, max=max_index, step=1, description="Left:", continuous_update=False
)
right_slider = widgets.IntSlider(
    value=max_index, min=0, max=max_index, step=1, description="Right:", continuous_update=False
)
output = widgets.Output()

def draw_comparison(_=None):
    left_index = left_slider.value
    right_index = right_slider.value
    with output:
        output.clear_output(wait=True)
        fig, axes = plt.subplots(1, 2, figsize=(12, 4), sharex=True, sharey=True)

        left_plot = ndvi_cube.isel(time=left_index).plot(
            ax=axes[0], cmap="YlGn", vmin=vmin, vmax=vmax, add_colorbar=False
        )
        ndvi_cube.isel(time=right_index).plot(
            ax=axes[1], cmap="YlGn", vmin=vmin, vmax=vmax, add_colorbar=False
        )

        axes[0].set_title(f"NDVI {time_labels[left_index]}")
        axes[1].set_title(f"NDVI {time_labels[right_index]}")
        axes[0].set_xlabel("X")
        axes[1].set_xlabel("X")
        axes[0].set_ylabel("Y")
        axes[1].set_ylabel("Y")

        cax = axes[1].inset_axes([1.05, 0.08, 0.03, 1]) # for reference to move the colorbar: left, bottom, width, height
        cb = fig.colorbar(left_plot, cax=cax, orientation="vertical")
        cb.set_label("NDVI")

        plt.tight_layout()
        plt.show()

left_slider.observe(draw_comparison, names="value")
right_slider.observe(draw_comparison, names="value")
display(widgets.HBox([left_slider, right_slider]), output)
draw_comparison()
HBox(children=(IntSlider(value=0, continuous_update=False, description='Left:', max=24), IntSlider(value=24, c…
Output()

Example 3C: Simple anomaly against a baseline

In [71]:
# Illustrative anomaly workflow
modis_baseline_ic = (
    ee.ImageCollection("MODIS/061/MOD13Q1")
    .filterBounds(africa_roi)
    .filterDate("2010-01-01", "2023-12-31")
    .select("NDVI")
)

# Keep CRS/scale consistent with the main xee load above
scale_deg_250m = 250 / 111320

ds_baseline = xr.open_dataset(
    modis_baseline_ic,
    engine="ee",
    geometry=africa_bbox,
    crs="EPSG:4326",
    scale=scale_deg_250m,
)

baseline_ndvi = ds_baseline["NDVI"] / 10000.0
current_ndvi = ds_modis_xee["NDVI"] / 10000.0

baseline_mean = baseline_ndvi.mean(dim="time")
current_mean = current_ndvi.mean(dim="time")
anomaly = current_mean - baseline_mean

plt.figure(figsize=(6, 5))
anomaly.plot(cmap="RdYlGn")
plt.title("NDVI anomaly map: 2023 vs 2015-2022 baseline")
plt.show()

# bbbox average anomaly time series
baseline_regional_mean = baseline_ndvi.mean(dim=("time", "lon", "lat"))
current_regional_series = current_ndvi.mean(dim=("lon", "lat"))
anomaly_series = (current_regional_series - baseline_regional_mean).to_series()

ax = anomaly_series.plot(figsize=(10, 4), marker="o", color="purple")
ax.axhline(0, color="black", linestyle="--", linewidth=1)
ax.set_title("Regional average NDVI anomaly time series (2023 vs 2015-2022)")
ax.set_ylabel("NDVI anomaly")
plt.show()
No description has been provided for this image
No description has been provided for this image

Part 4 — Asia example: Sentinel-3 OLCI with MPC + cubo (no GEE required)

Sentinel-3 OLCI is useful for:

  • coastal water color context,
  • sediment/turbidity proxies,
  • large estuaries and deltas,
  • broad land-water transitions.

For participants without GEE access, use cubo directly with MPC/STAC-backed collections.

In [81]:
# MPC + cubo Sentinel-3 example (Asia AOI)
# Use valid asset names from sentinel-3-olci-lfr-l2-netcdf
da_s3_mpc = cubo.create(
    lat=lat_asia,
    lon=lon_asia,
    collection="sentinel-3-olci-lfr-l2-netcdf",
    bands=["otci", "gifapar", "rc-gifapar"],
    start_date=start_date,
    end_date=end_date,
    edge_size=96,
    resolution=300,
)
da_s3_mpc
Out[81]:
<xarray.DataArray 'sentinel-3-olci-lfr-l2-netcdf' (time: 399, band: 3, y: 96,
                                                   x: 96)> Size: 88MB
dask.array<fetch_raster_window, shape=(399, 3, 96, 96), dtype=float64, chunksize=(1, 1, 96, 96), chunktype=numpy.ndarray>
Coordinates: (12/33)
  * time                                   (time) datetime64[ns] 3kB 2021-05-...
    id                                     (time) <U62 99kB 'S3B_OL_2_LFR_202...
    sat:relative_orbit                     (time) int64 3kB 47 61 ... 261 275
    s3:land                                (time) float64 3kB 37.0 39.0 ... 34.0
    eo:cloud_cover                         (time) float64 3kB 48.0 54.0 ... 59.0
    platform                               (time) <U11 18kB 'Sentinel-3B' ......
    ...                                     ...
    s3:gsd                                 int64 8B 300
    s3:product_name                        <U8 32B 'olci-lfr'
    s3:processing_timeliness               <U2 8B 'NT'
    s3:product_type                        <U11 44B 'OL_2_LFR___'
    s3:spatial_resolution                  object 8B {294, 270}
    epsg                                   int64 8B 32645
Attributes:
    collection:           sentinel-3-olci-lfr-l2-netcdf
    stac:                 https://planetarycomputer.microsoft.com/api/stac/v1
    epsg:                 32645
    resolution:           300
    edge_size:            96
    edge_size_m:          28800
    central_lat:          22.0
    central_lon:          89.0
    central_y:            2434177.274050861
    central_x:            706472.0593133684
    time_coverage_start:  2021-05-01
    time_coverage_end:    2022-05-31

Quicklook visualization idea

In [83]:
# Quicklook once da_s3_mpc is loaded
try:
    rgb = xr.concat(
        [
            da_s3_mpc.sel(band="otci").isel(time=0),
            da_s3_mpc.sel(band="gifapar").isel(time=0),
            da_s3_mpc.sel(band="rc-gifapar").isel(time=0),
        ],
        dim="band",
    )
    rgb = rgb / rgb.quantile(0.98)
    rgb = rgb.clip(0, 1)

    plt.figure(figsize=(6, 6))
    plt.imshow(np.transpose(rgb.values, (1, 2, 0)))
    plt.title("Sentinel-3 MPC quicklook (otci / gifapar / rc-gifapar)")
    plt.axis("off")
    plt.show()

except Exception:
    print("MPC Sentinel-3 NetCDF RGB stacking is not supported in this environment.")
    print("Using GEE Sentinel-3 quicklook fallback (da_s3_cubo).")

    rgb = xr.concat(
        [
            da_s3_cubo.sel(band="Oa08_radiance").isel(time=0),
            da_s3_cubo.sel(band="Oa06_radiance").isel(time=0),
            da_s3_cubo.sel(band="Oa04_radiance").isel(time=0),
        ],
        dim="band",
    )
    rgb = rgb / rgb.quantile(0.98)
    rgb = rgb.clip(0, 1)

    plt.figure(figsize=(6, 6))
    plt.imshow(np.transpose(rgb.values, (1, 2, 0)))
    plt.title("Sentinel-3 GEE quicklook fallback")
    plt.axis("off")
    plt.show()
MPC Sentinel-3 NetCDF assets are not directly stackable for RGB in this environment:
Assets must have exactly 1 band, but file 'https://sentinel3euwest.blob.core.windows.net/sentinel-3/OLCI/OL_2_LFR___/2021/05/02/S3B_OL_2_LFR____20210502T040650_20210502T040950_20210503T100725_0179_052_047_2520_LN1_O_NT_002.SEN3/otci.nc?st=2026-03-25T12%3A58%3A58Z&se=2026-03-26T13%3A43%3A58Z&sp=rl&sv=2025-07-05&sr=c&skoid=9c8ff44a-6a2c-4dfb-b298-1c9212f64d9a&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2026-03-23T14%3A32%3A11Z&ske=2026-03-30T14%3A32%3A11Z&sks=b&skv=2025-07-05&sig=ibUWaYS4qkFeW4sTM713vYXIZwRgjerCOpdM5KTsp4w%3D' has 0. We can't currently handle multi-band rasters (each band has to be a separate STAC asset), so you'll need to exclude this asset from your analysis.
Falling back to GEE Sentinel-3 quicklook (da_s3_cubo).
<Figure size 600x600 with 0 Axes>
No description has been provided for this image

Interpreting Sentinel-3 quicklooks for deltas

  • These RGB-style composites are context images (qualitative), not directly a calibrated index map.
  • Bright/dark and color differences show relative reflectance contrasts within the scene after stretch.
  • For quantitative analysis, combine with quality masks and science variables (e.g., OLCI products or derived indices).

Common Sentinel-3 OLCI band combinations used in delta/coastal literature

  • Natural-color style: Oa08 / Oa06 / Oa04
    • Useful for broad land-water context and plume visualization.
  • Water-contrast style: Oa11 / Oa08 / Oa04
    • Highlights suspended sediments/turbid features versus clearer water.
  • NIR-emphasis style: Oa17 / Oa08 / Oa06
    • Can help separate vegetation-rich land/wetland from open water.

Always validate interpretation with in-situ data, QA flags, and time-series behavior.

In [84]:
# Optional: literature-style Sentinel-3 OLCI combinations for delta studies (GEE-backed cubo)
s3_combo_bands = ["Oa04_radiance", "Oa06_radiance", "Oa08_radiance", "Oa11_radiance", "Oa17_radiance"]

da_s3_cubo_lit = cubo.create(
    lat=lat_asia,
    lon=lon_asia,
    collection="COPERNICUS/S3/OLCI",
    bands=s3_combo_bands,
    start_date=start_date,
    end_date=end_date,
    edge_size=64,
    resolution=300,
    gee=True,
 )

def _quick_rgb(da, r, g, b, t=0):
    rgb = xr.concat(
        [
            da.sel(band=r).isel(time=t),
            da.sel(band=g).isel(time=t),
            da.sel(band=b).isel(time=t),
        ],
        dim="band",
    )
    rgb = rgb / rgb.quantile(0.98)
    return rgb.clip(0, 1)

combo_specs = [
    ("Natural-color style", ("Oa08_radiance", "Oa06_radiance", "Oa04_radiance")),
    ("Water-contrast style", ("Oa11_radiance", "Oa08_radiance", "Oa04_radiance")),
    ("NIR-emphasis style", ("Oa17_radiance", "Oa08_radiance", "Oa06_radiance")),
]

fig, axes = plt.subplots(1, len(combo_specs), figsize=(15, 5))
for ax, (title, (r, g, b)) in zip(axes, combo_specs):
    rgb = _quick_rgb(da_s3_cubo_lit, r, g, b, t=0)
    ax.imshow(np.transpose(rgb.values, (1, 2, 0)))
    ax.set_title(f"{title}\n({r} / {g} / {b})")
    ax.axis("off")

plt.suptitle("Sentinel-3 OLCI delta-focused band combinations (quicklook)")
plt.tight_layout()
plt.show()
No description has been provided for this image

Part 5 — Integrated approach with MPC + cubo (no GEE required)

A resilience workflow is usually stronger when satellite observations are interpreted together with:

  • rainfall,
  • temperature,
  • hydrology,
  • exposure and vulnerability layers.

Below is an MPC + cubo pattern for rainfall and vegetation context.

Example 5A: CHIRPS rainfall + MODIS NDVI in Africa

In [86]:
# MODIS NDVI cube via GEE-backed cubo
da_modis_mpc = cubo.create(
    lat=lat_africa,
    lon=lon_africa,
    collection="MODIS/061/MOD13Q1",
    bands=["NDVI"],
    start_date=start_date,
    end_date=end_date,
    edge_size=96,
    resolution=250,
    gee=True,
 )

# CHIRPS rainfall cube via GEE-backed cubo
da_chirps_mpc = cubo.create(
    lat=lat_africa,
    lon=lon_africa,
    collection="UCSB-CHG/CHIRPS/DAILY",
    bands=["precipitation"],
    start_date=start_date,
    end_date=end_date,
    edge_size=96,
    resolution=5566,
    gee=True,
 )

print(da_modis_mpc)
print(da_chirps_mpc)
<xarray.DataArray 'MODIS/061/MOD13Q1' (time: 23, band: 1, y: 96, x: 96)> Size: 848kB
dask.array<transpose, shape=(23, 1, 96, 96), dtype=float32, chunksize=(23, 1, 96, 96), chunktype=numpy.ndarray>
Coordinates:
  * time                       (time) datetime64[ns] 184B 2023-01-01 ... 2023...
  * band                       (band) object 8B 'NDVI'
  * y                          (y) float64 768B 6.339e+05 ... 6.576e+05
  * x                          (x) float64 768B 3.409e+05 ... 3.646e+05
    cubo:distance_from_center  (y, x) float64 74kB 1.676e+04 ... 1.683e+04
Attributes:
    collection:           MODIS/061/MOD13Q1
    stac:                 https://earthengine-stac.storage.googleapis.com/cat...
    epsg:                 32638
    resolution:           250
    edge_size:            96
    edge_size_m:          24000
    central_lat:          5.84
    central_lon:          43.67
    central_y:            645691.7863005805
    central_x:            352754.269420453
    time_coverage_start:  2023-01-01
    time_coverage_end:    2023-12-31
<xarray.DataArray 'UCSB-CHG/CHIRPS/DAILY' (time: 364, band: 1, y: 96, x: 96)> Size: 13MB
dask.array<transpose, shape=(364, 1, 96, 96), dtype=float32, chunksize=(48, 1, 96, 96), chunktype=numpy.ndarray>
Coordinates:
  * time                       (time) datetime64[ns] 3kB 2023-01-01 ... 2023-...
  * band                       (band) object 8B 'precipitation'
  * y                          (y) float64 768B 3.813e+05 3.868e+05 ... 9.1e+05
  * x                          (x) float64 768B 8.627e+04 9.184e+04 ... 6.15e+05
    cubo:distance_from_center  (y, x) float64 74kB 3.754e+05 ... 3.724e+05
Attributes:
    collection:           UCSB-CHG/CHIRPS/DAILY
    stac:                 https://earthengine-stac.storage.googleapis.com/cat...
    epsg:                 32638
    resolution:           5566
    edge_size:            96
    edge_size_m:          534336
    central_lat:          5.84
    central_lon:          43.67
    central_y:            645691.7863005805
    central_x:            352754.269420453
    time_coverage_start:  2023-01-01
    time_coverage_end:    2023-12-31
In [89]:
# MODIS NDVI (scale to [-1, 1]-like range when needed)
ndvi = da_modis_mpc.sel(band="NDVI")
ndvi_scale = 10000.0 if float(ndvi.max().values) > 1.5 else 1.0
ndvi_series = (ndvi / ndvi_scale).mean(dim=("y", "x")).to_series().sort_index()

# CHIRPS rainfall
rain = da_chirps_mpc.sel(band="precipitation")
rain_series = rain.mean(dim=("y", "x")).to_series().sort_index()

# Align dates shared by both series
common_index = ndvi_series.index.intersection(rain_series.index)
ndvi_series = ndvi_series.loc[common_index]
rain_series = rain_series.loc[common_index]

fig, ax1 = plt.subplots(figsize=(12, 4))
ax2 = ax1.twinx()

# Rainfall plot
rain_line, = ax1.plot(
    rain_series.index, rain_series.values,
    color="tab:blue", linewidth=1.8, label="Rainfall (CHIRPS)"
 )
ax1.fill_between(
    rain_series.index, rain_series.values, 0,
    color="tab:blue", alpha=0.20
 )

# NDVI plot 
ndvi_line, = ax2.plot(
    ndvi_series.index, ndvi_series.values,
    color="darkgreen", linewidth=1.8, label="NDVI (MODIS)"
 )
ax2.fill_between(
    ndvi_series.index, ndvi_series.values, 0,
    color="darkgreen", alpha=0.20
 )

ax1.set_title("Africa Example — GEE + cubo rainfall and Vegetation")
ax1.set_xlabel("Time")
ax1.set_ylabel("Rainfall (mm/day)", color="tab:blue")
ax2.set_ylabel("NDVI", color="darkgreen")
ax1.tick_params(axis="y", colors="tab:blue")
ax2.tick_params(axis="y", colors="darkgreen")
ax1.grid(alpha=0.25)

lines = [rain_line, ndvi_line]
labels = [line.get_label() for line in lines]
ax1.legend(lines, labels, loc="upper left")

plt.tight_layout()
plt.show()
No description has been provided for this image

Comparison of the four main access patterns

Option Best use Strength Watch out for
STAC API discovery and interoperable search standards-based, portable actual asset handling may still require extra code
MPC cloud-hosted STAC datasets easy search and many public datasets collection naming and asset structure vary
GEE large-scale catalog + processing huge catalog, server-side filtering authentication and API concepts
Xee Earth Engine to xarray analysis-friendly for Python users some workflows still need EE thinking
cubo compact data-cube creation simple mental model across STAC/GEE backend support varies by collection

Key message

Climate resilience monitoring is rarely about one sensor or one platform. The most practical skill is learning to move between:

  • discovery,
  • access,
  • cube creation,
  • aggregation,
  • interpretation.

Interpretation examples

  • Lower NDVI together with rainfall deficits can indicate drought stress.
  • Sentinel-3 coastal color patterns can help identify sediment plumes and broad coastal change context.
  • Medium-resolution products are excellent for regional monitoring, but not for parcel-scale decisions.

Exercises for participants

  1. Replace the Africa bounding box AOI of your choice.
  2. Replace the Asia AOI with the Mekong Delta.
  3. Add a 2019–2024 annual NDVI summary.
  4. Compute a monthly climatology.
  5. Add MODIS LST or CHIRPS rainfall and compare seasonal patterns.
  6. Try the same workflow through:
    • raw STAC search or other STAC via Cubo

Closing remarks

This notebook intentionally mixes several access patterns because that reflects real EO practice:

  • no single interface solves every workflow,
  • standards like STAC improve portability,
  • Earth Engine accelerates computation,
  • xarray-based tools make Python analysis cleaner,
  • cubo can reduce boilerplate for prototyping.
In [97]:
# import nbformat
# from nbconvert import HTMLExporter
# import os

# def ipynb_to_html(ipynb_path, html_path):
#     """
#     Convert a Jupyter Notebook (.ipynb) to an HTML file with outputs preserved.

#     Args:
#         ipynb_path (str): Path to the .ipynb file.
#         html_path (str): Path to save the generated HTML file.
#     """
#     try:
#         # Validate file existence
#         if not os.path.isfile(ipynb_path):
#             raise FileNotFoundError(f"Notebook file not found: {ipynb_path}")

#         # Read the notebook
#         with open(ipynb_path, 'r', encoding='utf-8') as f:
#             notebook_node = nbformat.read(f, as_version=4)

#         # Create HTML exporter
#         html_exporter = HTMLExporter()
#         html_exporter.exclude_input = False   # Keep code cells
#         html_exporter.exclude_output = False  # Keep outputs

#         # Convert notebook to HTML
#         body, _ = html_exporter.from_notebook_node(notebook_node)

#         # Save HTML file
#         with open(html_path, 'w', encoding='utf-8') as f:
#             f.write(body)

#         print(f"✅ HTML file created: {html_path}")

#     except Exception as e:
#         print(f"❌ Error: {e}")

# # Example usage
# ipynb_to_html("cubo_xarray_dask_tutorial.ipynb", "docs\\assets\\cubo_xarray_dask_tutorial.html")
✅ HTML file created: docs\assets\cubo_xarray_dask_tutorial.html