Skip to content

annual mean in cmip6-ng is days-in-month-weighted #680

@mathause

Description

@mathause

🤦‍♂

We assume that the mean of the monthly data equals the mean of the 12 monthly values (or that subtracting the upsampled annual data from the monthly yields anomalies around 0):

# subtract annual mean to have seasonal anomalies around 0
seasonal_deviations = monthly_target - yearly_predictor

However, cmip6-ng calculates the annual mean using cdo's yearmonmean which weights the data by the number of days per month. While this is more correct it violates our assumption.

Example (IPSL-CM6A-LR, 2014, full resolution):

Image

Details
from pathlib import Path

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import mplotutils as mpl
import xarray as xr

import mesmer

# =====

model = "IPSL-CM6A-LR"
cmip6_data_path = Path("/net/atmos/data/cmip6-ng/")


path_tas_ann = cmip6_data_path / "tas" / "ann" / "g025" 
fN_hist_ann = path_tas_ann / f"tas_ann_{model}_historical_r1i1p1f1_g025.nc"

path_tas_mon = cmip6_data_path / "tas" / "mon" / "g025"
fN_hist_mon = path_tas_mon / f"tas_mon_{model}_historical_r1i1p1f1_g025.nc"

time_coder = xr.coders.CFDatetimeCoder(use_cftime=True)
tas_ann = xr.open_dataset(fN_hist_ann, decode_times=time_coder).load()
tas_mon = xr.open_dataset(fN_hist_mon, decode_times=time_coder).load()


# =====

f, ax = plt.subplots(subplot_kw={"projection": ccrs.Robinson()})


h = (tas_mon.resample(time="YE").mean().isel(time=-1).tas - tas_ann.isel(time=-1).tas).plot(ax=ax, transform=ccrs.PlateCarree(), add_colorbar=False, center=0)
ax.coastlines()

mpl.colorbar(h, ax)

# ax.set_title(r"$\Delta\mathrm{T}^{\mathrm{ann}}$T ann from averaged mon minus weighted mon")
ax.set_title(r"$\Delta\mathrm{T}^{\mathrm{ann}}$ from averaged $\mathrm{T}^{\mathrm{mon}}$ $-$ weighted $\mathrm{T}^{\mathrm{mon}}$")


plt.savefig("deltaT.png", bbox_inches="tight")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions