<jupyter_start><jupyter_text>Plotting diurnal cyclesQuick example of how to compute and plot the average diurnal cycle for the average surface temperature of each model. First, we start up a Kubernetes cluster and client:<jupyter_code>from dask_kubernetes import KubeCluster

cluster = KubeCluster(n_workers=10)
cluster
from dask.distributed import Client

client = Client(cluster)
client<jupyter_output><empty_output><jupyter_text>Then we open up the preexisting catalog of TRACMIP data (we will search for the relevant data):<jupyter_code>from intake import open_catalog

cat = open_catalog("https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/climate.yaml")
col = cat.tracmip()
col
col.df
ds_dict = col.search(frequency="A3hr", experiment="landControl",
                     variable="ts").to_dataset_dict()<jupyter_output><empty_output><jupyter_text>Finally, we can use this data to generate a rough plot of the average diurnal cycle over different regions of each model:<jupyter_code>ds_dict.keys()
import matplotlib.pyplot as plt
%matplotlib inline

plt.figure(figsize=(18, 20), facecolor='w', edgecolor='k')

for i, source in enumerate(ds_dict.keys()):
    ax = plt.subplot(5, 3, i + 1)
    ds_dict[source]["ts"].sel(lon=slice(0,45), lat=slice(-30,30)) \
                         .groupby("time.hour").mean(dim=("time", "lat", "lon")) \
                         .plot(color="red", label="land")
    ds_dict[source]["ts"].sel(lon=slice(45,360), lat=slice(-30,30)) \
                         .groupby("time.hour").mean(dim=("time", "lat", "lon")) \
                         .plot(color="blue", label="ocean")
    ax.set(title=ds_dict[source].attrs["model_id"], ylabel=ds_dict[source]["ts"].attrs["units"])
    ax.legend()
    
plt.tight_layout()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1378169790518192, 'fraction_numerical': 0.014332965821389196, 'mean_word_length': 4.353982300884955, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '262968', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 617, 'n_tokens_neox': 582, 'n_words': 132, 'path': 'diurnal_cycle.ipynb', 'repo_name': 'pangeo-data/pangeo-tracmip-examples', 'size': '1814'}