Skip to article frontmatterSkip to article content
CCI Examples

Getting Started with Sea Surface Salinity 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.
  • Visualize 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
import xarray as xr
import matplotlib.pyplot as plt
import warnings
%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 harmonized 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("esa-cci")
# List all available data sets of an ECV
# list_ecv_datasets("SEASURFACESALINITY")

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 providing Sea Surface Salinity (SSS) from multiple sensors. SSS is a key variable for understanding ocean circulation, freshwater fluxes, and the global water cycle. The dataset provides 15-day averaged salinity values at the sea surface level.

To explore other ESA CCI projects (e.g., Water Vapour, Land Surface Temperature, Soil Moisture), simply replace the dataset ID and variable name accordingly.

We will use the following dataset ID:

data_id = 'esacci.SEASURFACESALINITY.15-days.L4.SSS.multi-sensor.multi-platform.MERGED_OI_Monthly_CENTRED_15Day_25km.2-31.r1'

πŸ“˜ A full list of dataset IDs can be retrieved from the store or found in the ESA CCI Climate Toolbox documentation.

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., AOD, 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 analyze 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: Check Open Parameters for the DatasetΒΆ

Before opening the dataset, we can inspect which parameters are supported by the Zarr opener (e.g., time_range, bbox, variable_names). This step helps ensure that we pass valid arguments when loading data and avoid errors.

The command below lists all expected input parameters and their allowed values for the selected dataset.

cci_store.get_open_data_params_schema(data_id=data_id, opener_id='dataset:zarr:cciodp')
Loading...

Step 6: 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
  • (Optional) Bounding box: spatial region of interest β€” here we skip it to load the global dataset
variables = ['sss']  # Variable to retrieve
start_date = '2019-06-01'    # Start and end date (same for a single timestep)
end_date = '2019-06-30'
# bbox = (-10.0, 35.0, 30.0, 60.0)  # Optional: restrict to a region like Europe

Step 7: 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.

sss_ds = cci_store.open_data(
    data_id=data_id,
    variable_names=variables,
    time_range=[start_date, end_date]
    # bbox=bbox  # Uncomment if regional selection is needed
)

Step 8: 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 visualization. This step is useful to understand what the dataset contains before working with it further.

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

Opened Dataset:
 <xarray.Dataset> Size: 10MB
Dimensions:    (lat: 584, lon: 1388, time: 3, bnds: 2)
Coordinates:
  * lat        (lat) float32 2kB -83.52 -81.98 -80.7 -79.57 ... 80.7 81.98 83.52
  * lon        (lon) float32 6kB -179.9 -179.6 -179.4 ... 179.4 179.6 179.9
  * time       (time) datetime64[ns] 24B 2019-06-01T23:59:59 ... 2019-07-01T2...
    time_bnds  (time, bnds) datetime64[ns] 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
Dimensions without coordinates: bnds
Data variables:
    sss        (time, lat, lon) float32 10MB dask.array<chunksize=(1, 584, 1388), meta=np.ndarray>
Attributes:
    Conventions:             CF-1.7
    title:                   esacci.SEASURFACESALINITY.15-days.L4.SSS.multi-s...
    date_created:            2025-04-16T13:06:21.617131
    processing_level:        L4
    time_coverage_start:     2019-05-18T00:00:00
    time_coverage_end:       2019-07-16T23:59:59
    time_coverage_duration:  P59DT23H59M59S
    history:                 [{'program': 'xcube_cci.chunkstore.CciChunkStore...

Step 9: 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 Aerosol Optical Depth (AOD) for the selected day. For more interactive and advanced visualizations, check out the ESA Climate Toolbox or the Toolbox documentation.

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

# Extract one time slice
sss = sss_ds["sss"].isel(time=0).squeeze()

lon = sss_ds["lon"].values
lat = sss_ds["lat"].values

fig = plt.figure(figsize=(10, 5))
ax = plt.axes(projection=ccrs.PlateCarree())

mesh = ax.pcolormesh(
    lon, lat, sss,
    transform=ccrs.PlateCarree(),
    cmap="viridis",      # or "Spectral", "plasma", etc.
    vmin=30, vmax=40      # Adjust if needed
)

ax.coastlines()
plt.colorbar(mesh, ax=ax, label="Sea Surface Salinity (psu)")
plt.title("Sea Surface Salinity – 15-day Mean")
plt.tight_layout()
plt.show()
<Figure size 1000x500 with 2 Axes>