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.

Best practices

Content creation

The SWUMP criteria

All training material destined for CDS/ADS/CADS portals must satisfy the SWUMP criteria:

Filenames

Filenames should use human-readable slugs that capture the notebook’s key themes, particularly those that distinguish it from other notebooks in the repository.

Scope

Focus on one topic / visualisation / processing routine. Consider separate notebooks if multiple parts or topics are included.

Pedagogical ordering

Within a single notebook, present material in increasing order of complexity:

Diátaxis governs which kind of notebook you are writing; pedagogical ordering governs the order of material within it.

Titles

When selecting titles for your notebooks, consider the needs of a broad and diverse audience.

Training notebooks serve as entry points to the subject matter and should therefore be titled in a way that is clear, accurate, and accessible. Titles must be:

Section headings

TOC

Keep the table of contents (TOC) clear and intuitive, that is, avoid long lists that clutter the view. See the official MyST Markdown documentation for details on how to structure the table of contents.

Scientific terminology

Define acronyms and domain-specific terminology on first use in the prose. Where a term has an authoritative definition elsewhere, link to that source instead of redefining it in the notebook.

A standalone ## Definitions section is optional in the notebook template and should be used only when the notebook introduces several novel terms; otherwise, defining on first use is preferred.

Figures and visualisation

Every figure in a notebook must be self-interpretable without reference to surrounding prose:

Storage and reuse:

Visual style and ECMWF guidelines

For visual styling decisions in plots and figures, consult the ECMWF visual style guide (link to be added by the maintainer once the canonical URL is confirmed). The guide governs plot-level rules: typography, colour usage, gridlines, and chart conventions.

You do not need to manually embed ECMWF or service logos in individual notebooks: the book-level branding (branding/c3s.yml, cams.yml, ecmwf.yml) and myst.yml configuration take care of logo placement at the rendered-book level.

Colour-vision-deficiency-safe palettes

Colour choice is the single most common visualisation issue flagged in expert review. ECMWF acknowledges the gap (Hewson, 2022) but has not yet published a normative palette specification, so the rules below cite community standards that meet or exceed any plausible future guideline.

Universal rule. “If a colour palette is readable in black and white after being desaturated, it is universally accessible to all viewers.” (Crameri et al., 2020) Authors should also simulate colour-vision deficiency (CVD) on every published figure using the Coblis colour-blindness simulator — the same tool referenced in Hewson (2022).

Choose the palette by data type. Sequential, diverging, categorical, and cyclic data each require a different palette family; using the wrong family is as serious as using a CVD-unsafe one.

ColorBrewer for maps. ColorBrewer 2.0 remains a useful source for cartographic sequential, diverging, and qualitative palettes, especially for choropleth and classified maps. Use the colorblind safe filter on the ColorBrewer website, then still check the rendered figure with desaturation or a CVD simulator. Not every ColorBrewer scheme is suitable for every data type, class count, or continuous field.

Data typeRecommended palettesAvoid
Sequential (e.g. temperature, precipitation, concentration)matplotlib built-ins: viridis, cividis, plasma, inferno, magma. Richer set: batlow, lajolla, lapaz (cmcrameri). Oceanographic: cmocean.thermal, cmocean.haline. For classified maps: ColorBrewer sequential schemes marked colorblind safe.jet, rainbow, gist_rainbow, hsv
Diverging (anomalies, biases, departures from a reference)matplotlib: RdBu_r, PuOr, BrBG. Richer set: vik, roma, bam (cmcrameri). Oceanographic: cmocean.balance, cmocean.curl. For classified maps: ColorBrewer diverging schemes marked colorblind safe.seismic (luminance non-monotonic); red–green diverging maps without a luminance change
Categorical / qualitativematplotlib tab10; the Wong 8-colour palette (Okabe–Ito); cmcrameri.cm.categorical; ColorBrewer qualitative schemes marked colorblind safe. Keep to ≤ 8 categories on a single map — split or facet otherwise.More than ~8 categories; bespoke colour mixes that have not been CVD-tested
Cyclic (wind direction, phase, time of day)matplotlib twilight, twilight_shifted. Richer set: romaO, vikO, corkO (cmcrameri).Non-cyclic palettes with a visible seam
Radar / weather domaincmweather colormaps (e.g. ChaseSpectral, LangRainbow12) — designed for CVD readers (Sherman et al., 2024).Legacy NWS rainbow-style radar palettes

Default Python recipe (zero install cost). matplotlib built-ins are sufficient for most training notebooks:

import matplotlib.pyplot as plt
plt.imshow(data, cmap="viridis")     # sequential
plt.imshow(anomaly, cmap="RdBu_r")   # diverging

For richer palettes, install on demand and add to environment.yml:

pip install cmcrameri    # Crameri scientific colour maps
pip install cmweather    # radar/meteorology, CVD-friendly (Sherman et al., 2024)
pip install cmocean      # oceanographic / atmospheric
pip install colorbrewer  # ColorBrewer map palettes
import cmcrameri.cm as cmc
plt.imshow(data, cmap=cmc.batlow)

Authority references. Cite at least one of these when a notebook applies a non-default palette, so reviewers can verify the choice against a stated source:

Data files

Data files should not be stored in the GitHub repository, but hosted externally and linked to, or downloaded from the original source (e.g. CDS/ADS).

Trusted data sources

Cite each dataset using a DOI, an equivalent persistent identifier, or a stable URL with named authoritative provenance. Acceptable provenance includes:

DOI-only is not the only acceptable form: a stable, versioned URL from a recognised authority is also acceptable when no DOI exists.

Code

Code commenting and annotation

For code logic to remain clear to a non-technical audience:

# Compute the monthly climatology over the reference period
# (mean across years for each calendar month).
def monthly_climatology(da, period=("1991", "2020")):
    """Return the monthly climatology of a DataArray.

    Parameters
    ----------
    da : xarray.DataArray
        Time-indexed input data.
    period : tuple of str
        (start_year, end_year) reference period, inclusive.

    Returns
    -------
    xarray.DataArray
        12-element climatology indexed by month.
    """
    return da.sel(time=slice(*period)).groupby("time.month").mean("time")

References and attribution

Every notebook must list its underlying datasets, publications, and reused figures in the ## References section of the notebook template. Use the formats below.

Datasets

Cite by DOI where available; otherwise by a stable URL plus the named authoritative provider.

Publications

Use a consistent citation style (APA is the default for ECMWF training material). For reproducibility-sensitive material, also provide a BibTeX entry.

@article{author2024title,
  author  = {Author, A. B. and Author, C. D.},
  title   = {Title of the article},
  journal = {Journal Name},
  year    = {2024},
  volume  = {12},
  number  = {3},
  pages   = {45--67},
  doi     = {10.xxxx/xxxxx}
}

Reused figures

State the source URL and the licence string under which the figure is reused (e.g. CC-BY-4.0, Crown Copyright, © ECMWF). Match the licence to the original publication.

Tools

MyST markdown

Use enhanced markdown features (e.g. colored cells, icons) provided by MyST markdown to enhance your notebooks.

Avoid HTML <a> tags without href and notebook cross-references built with plain HTML; they render poorly and flood the build with warnings.

Metadata

Apply metadata at the notebook level and at the cell level according to a metadata-schema described here: https://github.com/ecmwf-training/jn-metadata-schema.

References
  1. Crameri, F., Shephard, G. E., & Heron, P. J. (2020). The misuse of colour in science communication. Nature Communications, 11(1). 10.1038/s41467-020-19160-7
  2. Sherman, Z., Grover, M., Jackson, R., Collis, S., O’Brien, J., Homeyer, C. R., Chase, R. J., Lang, T. J., Stechman, D. M., Sockol, A., Muehlbauer, K., Thielen, J., Theisen, A., Gardner, S., & Michelson, D. (2024). Effective Visualization of Radar Data for Users Impacted by Color Vision Deficiency. Bulletin of the American Meteorological Society, 105(8), E1479–E1489. 10.1175/bams-d-23-0056.1
  3. Rocchini, D., Nowosad, J., D’Introno, R., Chieffallo, L., Bacaro, G., Gatti, R. C., Foody, G. M., Furrer, R., Gábor, L., Malavasi, M., Marcantonio, M., Marchetto, E., Moudrý, V., Ricotta, C., Šímová, P., Torresani, M., & Thouverai, E. (2023). Scientific maps should reach everyone: The cblindplot R package to let colour blind people visualise spatial patterns. Ecological Informatics, 76, 102045. 10.1016/j.ecoinf.2023.102045
  4. Copernicus Climate Change Service. (2019). ERA5 monthly averaged data on single levels from 1940 to present. Copernicus Climate Change Service (C3S) Climate Data Store (CDS). 10.24381/CDS.F17050D7