Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

CCI Examples

Getting Started with Lakes CCI Data

CCI_Logo_large_150kb.jpg

Getting Started with Lakes CCI DataΒΆ

1. Import Necessary PackagesΒΆ

In this section, we import the required Python packages to work with ESA Climate Change Initiative (CCI) data. Most notably, we use the ESA Climate Toolbox which simplifies access, manipulation, and visualization of CCI datasets in Python.

These packages allow us to:

  • Access satellite-based climate data records from ESA.

  • Handle geospatial and temporal dimensions efficiently.

  • Visualise data with intuitive plotting tools.

πŸ“š For a broader introduction to the toolbox and how to install it, visit:
πŸ”— ESA CCI Climate Toolbox Quick Start
πŸ”— ESA Climate Data Toolbox Website

from xcube.core.store import new_data_store
from esa_climate_toolbox.core import get_op
from esa_climate_toolbox.core import list_ecv_datasets
from esa_climate_toolbox.core import get_store
from esa_climate_toolbox.core import list_datasets
from esa_climate_toolbox.ops import plot
from esa_climate_toolbox.core import open_data           
import xarray as xr
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore") 
%matplotlib inline

Step 2: Connect to the ESA CCI Data StoreΒΆ

The ESA Climate Toolbox provides direct access to the ESA Climate Data Store, which hosts harmonised satellite-based climate data records produced under the ESA Climate Change Initiative (CCI).

In this step, we establish a connection to the data store so we can browse and open datasets. This connection allows us to access data without having to download files manually β€” a convenient way to explore and analyze large geospatial datasets in cloud-friendly formats such as Zarr or Kerchunk.

The data store includes a wide range of essential climate variables (ECVs), such as aerosols, land surface temperature, sea level, and soil moisture.

πŸ“˜ Learn more about available datasets:
πŸ”— ESA Climate Data Toolbox – Quick Start Guide

cci_store = new_data_store("ccizarr")
# List all available data sets of an ECV
# list_ecv_datasets("Lakes")

Step 3: Define the Dataset IDΒΆ

To work with a specific ESA CCI dataset, we need to specify its dataset ID. This unique identifier tells the toolbox which variable and product we want to access.

In this example, we are using a dataset from the Lakes CCI project that provides daily Level 3 surface temperature products for inland water bodies. These data are derived from satellite observations using multiple sensors and are valuable for monitoring climate-related changes in freshwater systems.

The key variable used in this example is lake_surface_water_temperature, which provides the skin temperature of lake surfaces globally.

We will use the following dataset ID:

data_id = 'ESACCI-LAKES-L3S-LK_PRODUCTS-MERGED-fv3.0.0.zarr'

Step 4: Describe Dataset (Check Available Variables and Metadata)ΒΆ

Before loading the full dataset, it’s helpful to inspect the metadata to understand its structure. This includes:

  • Available variables (e.g., lake_surface_water_temperature, uncertainty estimates)

  • Temporal and spatial coverage

  • Data format and structure

This step ensures we know what the dataset contains and how to work with it. It also helps confirm that the variable we want to plot or analyse is actually included.

πŸ› οΈ Tip: You can use the description to verify variable names, dimensions (e.g., lat, lon, time), and time coverage.

πŸ“˜ More on dataset structure:
πŸ”— ESA Climate Toolbox – Data Access

cci_store.describe_data(data_id)
Loading...

Step 5: Define Region, Time Range, and Variables of InterestΒΆ

Before opening the dataset, we define a few key parameters:

  • Time range: the date(s) we want to load

  • Variables: which data variable(s) to retrieve

  • Region: spatial region of interest

variables = ['lake_surface_water_temperature']  # Variable to retrieve
region = [35.5, 2, 37, 5] # defining the longitude min, latitude min and maxima, respectively, for Lake Turkana
# start_date = '2022-06-21'    # Start and end date (same for a single timestep), we want to look at the time series as well, so we will skip this step
# end_date = '2022-06-21'

Step 6: Open the DatasetΒΆ

Now we open the dataset using the selected parameters.
The ESA Climate Toolbox will download only the necessary data (e.g., variable and time range). You can always adjust the time range or variables to explore different slices of the dataset.

# if you want to look at a certain time range, you can add the start_date and end_date as follows:
# lakes_ds, lakes_name = open_data(data_id,region=region,var_names=variables, time_range=[start_date, end_date]) 

# in our case we want to load the full dataset first without the time range
lakes_ds, lakes_name = open_data(data_id,region=region,var_names=variables)

Step 7: Display Dataset StructureΒΆ

We print a summary of the opened dataset to inspect its structure, dimensions, variables, and metadata.
This helps verify that the data was loaded correctly and shows what is available for analysis and visualisation. This step is useful to understand what the dataset contains before working with it further.

print("\nOpened Dataset:\n", lakes_ds)

Opened Dataset:
 <xarray.Dataset> Size: 6GB
Dimensions:                         (time: 11419, lat: 360, lon: 180)
Coordinates:
  * lat                             (lat) float32 1kB 2.004 2.013 ... 4.996
  * lon                             (lon) float32 720B 35.5 35.51 ... 36.99 37.0
  * time                            (time) datetime64[ns] 91kB 1992-09-26 ......
Data variables:
    lake_surface_water_temperature  (time, lat, lon) float64 6GB dask.array<chunksize=(2500, 48, 12), meta=np.ndarray>
Attributes: (12/42)
    Conventions:                CF-1.8
    cdm_data_type:              Grid
    comment:                    These data were produced for the ESA Lakes_cc...
    creator_email:              lakes_cci@groupcls.com
    creator_name:               ESA Lakes_cci
    creator_url:                https://climate.esa.int/en/projects/lakes/
    ...                         ...
    time_coverage_duration:     P1D
    time_coverage_end:          2024-01-01 00:00:00
    time_coverage_resolution:   P1D
    time_coverage_start:        1992-09-26 00:00:00
    title:                      ESA Lakes_cci product
    tracking_id:                f2e77692-0925-4a5d-87fb-eaefa86c8292

Step 8: Visualize ResultsΒΆ

We now create a simple map plot of the selected variable.
This allows us to explore the spatial patterns of the data β€” in this case, the lake surface water temperature for the selected day. For more interactive and advanced visualizations, check out the ESA Climate Toolbox or the Toolbox documentation.

Next, we make sure we have the correct chunk size.

lake_turkana_ds = lakes_ds.chunk(lat=48, lon=48)
lake_turkana_ds
Loading...

Next, we will choose a date for the plot.

lake_turkana_ds_june = lake_turkana_ds.sel(time="2022-06-01")
lake_turkana_ds_june
Loading...
import matplotlib.pyplot as plt
import cartopy.crs as ccrs

# Select first (and only) time step and remove singleton dimension
lswt = lake_turkana_ds_june["lake_surface_water_temperature"].squeeze()
time_str = lake_turkana_ds_june['time'].dt.strftime('%d %B %Y').item()

# Create figure and axis
fig = plt.figure(figsize=(12, 6))
ax = plt.axes(projection=ccrs.PlateCarree())

# Plot the data
mesh = lswt.plot(
    ax=ax,
    transform=ccrs.PlateCarree(),
    cmap="turbo",  # or "inferno", "viridis", or "plasma"
    robust=True,
    cbar_kwargs={"label": "Lake Surface Water Temperature (K)"}
)

ax.coastlines()
ax.set_title("Lake Surface Water Temperature – " + time_str + " (Lakes CCI)")

# Add ticks
ax.set_xticks(range(35, 38, 1), crs=ccrs.PlateCarree())  # longitude ticks
ax.set_yticks(range(2, 6, 1), crs=ccrs.PlateCarree())  # latitude ticks
ax.set_xlabel("Longitude")
ax.set_ylabel("Latitude")
plt.tight_layout()
plt.show()
<Figure size 1200x600 with 2 Axes>

If we want to visualise the time series of the lake temperature accross the defined region, in this case Lake Turkana, we can do so by using the tseries_mean operation. The calculated time series will be saved into a new dataset and plotted in a next step.

tseries_mean = get_op("tseries_mean")
ds_mean = tseries_mean(lake_turkana_ds, "lake_surface_water_temperature")
ds_mean
Loading...
import pandas as pd
fig, ax = plt.subplots(figsize=(12, 4))
ds_mean["lake_surface_water_temperature_mean"].plot(ax=ax, linewidth=0.5)
ax.grid(True, linestyle="--", alpha=0.4)
ax.set_xlim(pd.Timestamp("2010-01-01"), pd.Timestamp("2023-12-31"))
plt.show()
<Figure size 1200x400 with 1 Axes>