Installation and a quick example

Install from conda-forge

OceanVal runs on Linux with Python 3.10–3.13. If you do not have conda installed, follow the conda installation guide first.

You can install the package using pip. However, this is not advised as setting up system dependencies can be tricky.

Install the released package:

console
conda install -c conda-forge oceanval

A two-minute example

The example below downloads one year of CMIP6 sea surface temperature output and validates it against the COBE2 observational dataset. It takes a couple of minutes to run and produces a report like this one. Run it from an empty directory, in a Python script or Jupyter notebook:

python
import os
import oceanval

url = "http://noresg.nird.sigma2.no/thredds/fileServer/esg_dataroot/cmor/CMIP6/CMIP/NCC/NorESM2-LM/historical/r3i1p1f1/Omon/tos/gn/v20190920/tos_Omon_NorESM2-LM_historical_r3i1p1f1_gn_201001-201412.nc"

# download this file
out = os.path.basename(url)
os.system(f"wget {url} -O {out}")

oceanval.add_gridded_comparison(
    recipe={"temperature": "cobe2"},
    model_variable="tos",
)

oceanval.matchup(
    sim_dir=".",
    start=2014, end=2014,
    n_dirs_down=0, cores=1,
    lon_lim=[-180, 180], lat_lim=[-90, 90],
    ask=False,
)

oceanval.validate(concise=False, region="global")

When it finishes, an HTML report opens in your browser showing how the model and observations compare. The built-in cobe2 recipe handles downloading the observational data automatically.

Note

This is a demonstration of the workflow, not a rigorous way to validate a climate model. For a real validation you would use more years of output and more variables. Continue with the quickstart.