Combining cutout with complementing datasets

Here we explain how to combine a cutout with a complementing dataset.

Interpolate to cutout grid

In this case, we will use the a lam-dataset in a different grid that contains just one variable (tp in the example below) and a global-dataset. What we want to do is to interpolate the global-dataset to the resulting dataset from the cutout grid operation.

from anemoi.datasets import open_dataset

ds = open_dataset(
    complement={
        "cutout": [
            "lam-dataset",
            {
                "dataset": "global-dataset",
                "select": ["tp"],
            },
        ],
        "min_distance_km": 1,
        "adjust": "dates",
    },
    source="global-dataset",
    interpolation="nearest",
    k=1,
)

or for the config file:

dataset:
   complement:
      dataset:
         cutout:
          - lam-dataset
          - dataset: global-dataset
            select: [ tp ]
         min_distance_km: 1
         adjust: dates
   source: global-dataset
   interpolation: nearest
   k: 1

The adjust option is in case the end or start dates do not exactly match.