<jupyter_start><jupyter_text>CMIP6 multimodel mean process<jupyter_code>ls ../../src/DATA/cmip6-mmm
import xarray as xr
ts = xr.open_dataarray("../../src/DATA/cmip6-mmm/ts-CMIP6-clim60.nc")
pr = xr.open_dataarray("../../src/DATA/cmip6-mmm/pr-CMIP6-clim60.nc")
from src.xr_utils import get_trend, can_coords, clip
from src.plot_utils import cmap, get_dim, ps_defaults, label_subplots, axis_formatter
ps_defaults(dpi=200, use_tex=False)
import matplotlib.pyplot as plt

pr = xr.open_dataarray("../../src/DATA/cmip6-mmm/pr-CMIP6-clim60.nc")
fig, axs = plt.subplots(2, figsize=get_dim(ratio=2 * 0.3), sharex=True)
pr_mean = can_coords(pr).mean("T")
clip(pr_mean).plot(
    ax=axs[0],
    cmap=cmap("rain"),
    cbar_kwargs={
        "label": "Mean Precipitation",
        "format": axis_formatter(),
    },
)  # , vmin=-1.5, vmax=1.5)
axs[0].set_xlabel("")
pr_trend = get_trend(can_coords(pr))
clip(pr_trend).plot(
    ax=axs[1], cmap=cmap("ranom"), cbar_kwargs={"label": "Trend in Precipitation"}
)  # , vmin=-1.5, vmax=1.5)
label_subplots(axs)
import matplotlib.pyplot as plt

ts = xr.open_dataarray("../../src/DATA/cmip6-mmm/ts-CMIP6-clim60.nc")
fig, axs = plt.subplots(2, figsize=get_dim(ratio=2 * 0.3), sharex=True)
ts_mean = can_coords(ts).mean("T")
clip(ts_mean).plot(
    ax=axs[0],
    cmap=cmap("sst"),
    cbar_kwargs={
        "label": "Mean SST [K]",
        "format": axis_formatter(),
    },
)  # , vmin=-1.5, vmax=1.5)
axs[0].set_xlabel("")
ts_trend = get_trend(can_coords(ts))
clip(ts_trend).plot(
    ax=axs[1], cmap=cmap("delta"), vmin=-1.5, vmax=1.5, cbar_kwargs={"label": "Trend in SST [K]"}
)  # , vmin=-1.5, vmax=1.5)
label_subplots(axs)
import matplotlib.pyplot as plt

rh = xr.open_dataarray("../../src/DATA/cmip6-mmm/rh-CMIP6-clim60.nc")
fig, axs = plt.subplots(2, figsize=get_dim(ratio=2 * 0.3), sharex=True)
rh_mean = can_coords(rh).mean("T")
clip(rh_mean).plot(
    ax=axs[0],
    cmap=cmap("sst"),
    cbar_kwargs={
        "label": "Mean rh",
        "format": axis_formatter(),
    },
)  # , vmin=-1.5, vmax=1.5)
axs[0].set_xlabel("")
rh_trend = get_trend(can_coords(rh))
clip(rh_trend).plot(
    ax=axs[1], cmap=cmap("delta"), cbar_kwargs={"label": "Trend in rh"}
)  # , vmin=-1.5, vmax=1.5)
label_subplots(axs)
import matplotlib.pyplot as plt

clt = xr.open_dataarray("../../src/DATA/cmip6-mmm/clt-CMIP6-clim60.nc")
fig, axs = plt.subplots(2, figsize=get_dim(ratio=2 * 0.3), sharex=True)
clt_mean = can_coords(clt).mean("T")
clip(clt_mean).plot(
    ax=axs[0],
    cmap=cmap("sst"),
    cbar_kwargs={
        "label": "Mean CLT",
        "format": axis_formatter(),
    },
)  # , vmin=-1.5, vmax=1.5)
axs[0].set_xlabel("")
clt_trend = get_trend(can_coords(clt))
clip(clt_trend).plot(
    ax=axs[1], cmap=cmap("delta"), cbar_kwargs={"label": "Trend in CLT"}
)  # , vmin=-1.5, vmax=1.5)
label_subplots(axs)
import matplotlib.pyplot as plt

ps = xr.open_dataarray("../../src/DATA/cmip6-mmm/ps-CMIP6-clim60.nc")
fig, axs = plt.subplots(2, figsize=get_dim(ratio=2 * 0.3), sharex=True)
ps_mean = can_coords(ps).mean("T")
clip(ps_mean).plot(
    ax=axs[0],
    cmap=cmap("sst"),
    cbar_kwargs={
        "label": "Mean $p_s$",
        "format": axis_formatter(),
    },
)
axs[0].set_xlabel("")
ps_trend = get_trend(can_coords(ps))
clip(ps_trend).plot(
    ax=axs[1],
    cmap=cmap("delta"),
    cbar_kwargs={
        "label": "Trend in $p_s$",
        "format": axis_formatter(),
    },
)
label_subplots(axs)
from src.metrics import get_nino_trend
from src.constants import FIGURE_PATH, DATA_PATH
get_nino_trend(
    "../../src/DATA/cmip6-mmm/ts-CMIP6-clim60.nc",
    str("nino_cmip6_trend.png"),
    str(DATA_PATH / "cmip6_nino.nc"),
    show_plots=True
)<jupyter_output>warning, not changing:  variable
warning, not changing:  variable
warning, not changing:  variable
warning, not changing:  variable
pac
warning, not changing:  variable
pac
warning, not changing:  variable
pac
warning, not changing:  variable
pac
warning, not changing:  variable
nino4
warning, not changing:  variable
nino3.4
warning, not changing:  variable
nino3
warning, not changing:  variable
nino1+2
nino4
warning, not changing:  variable
nino3.4
warning, not changing:  variable
nino3
warning, not changing:  variable
nino1+2
nino4
warning, not changing:  variable
nino3.4
warning, not changing:  variable
nino3
warning, not changing:  variable
nino1+2
nino4
warning, not changing:  variable
nino3.4
warning, not changing:  variable
nino3
warning, not changing:  variable
nino1+2
warning, not changing:  variable
warning, not changing:  variable
warning, not changing:  variable
warning, not changing:  variable
<xarray.DataArray (variable: 1, month: 12)>
array([[25.52106857, 26.84934754, 27[...]
{'fraction_non_alphanumeric': 0.17528185492448414, 'fraction_numerical': 0.03382259093809828, 'mean_word_length': 4.337116912599319, 'pattern_counts': {'":': 16, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '86773', 'license': 'MIT', 'n_tokens_mistral': 2054, 'n_tokens_neox': 1998, 'n_words': 361, 'path': 'notebooks/exploratory/cmip6.ipynb', 'repo_name': 'sdat2/seager19', 'size': '4701'}