<jupyter_start><jupyter_text>ImportUse elements of the scientific python stack<jupyter_code>from matplotlib import pyplot as plt
import numpy as np
import xarray as xr

# Import a client
from dask.distributed import Client

# Import intake-esm
import intake

import util<jupyter_output><empty_output><jupyter_text>Setup a PBSClusterSpeed up processing with DASK with 8 threads<jupyter_code>cluster = util.get_pbscluster(8)
# Setup your client
client = Client(cluster)
client<jupyter_output>/glade/work/marsh/miniconda3/envs/default/lib/python3.9/site-packages/distributed/node.py:160: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 41339 instead
  warnings.warn(<jupyter_text>Open a catalog<jupyter_code>cat = intake.open_esm_datastore(
    "/glade/work/marsh/intake-esm-catalogs/WACCM6-MA-1deg.json",
    ).search(
    variable=('Uzm'),
    frequency=('day_1')
)
print(cat.keys())
# cat
dsets = cat.to_dataset_dict(cdf_kwargs={'chunks': {'time': 8}, 'decode_times': False})
dsets.keys()
def plot_u(u, case):
    
    print(case)
    fig = u.plot.contourf(y='ilev', 
                          ylim=(100,1), 
                          yincrease=False, 
                          yscale='log',
                          figsize=(15,6), 
                          levels=np.arange(-30,31,2.5)
                         )
    fig.axes.set_ylabel('Pressure (hPa)')
    fig.axes.set_xlabel('Year')
    plt.title('Equatorial zonal mean U')

    plt.show()
    return
hist_cases = [key for key in list(cat) if "HIST" in key]
print(len(hist_cases))
for case in hist_cases:
    # print(case)
    ds = dsets[case]
    ds = xr.decode_cf(ds)
    ds = ds.sortby('time')
    u0 = ds['Uzm'].isel(zlon=0).sel(lat=0.0, method='nearest').sel(time=slice("1980-01", "2010-12"))
    plot_u(u0, case)
    
case = 'atm.cam.h1.b.e21.BWSSP245.f09_g17.release-cesm2.1.3.WACCM-MA-1deg.001'

ds = dsets[case]
ds = xr.decode_cf(ds)
ds = ds.sortby('time')
u0 = ds['Uzm'].isel(zlon=0).sel(lat=0.0, method='nearest').sel(time=slice("2015-01", "2045-12"))
plot_u(u0, case)
u0 = ds['Uzm'].isel(zlon=0).sel(lat=0.0, method='nearest').sel(time=slice("2046-01", "2076-12"))
plot_u(u0, case)<jupyter_output>atm.cam.h1.b.e21.BWSSP245.f09_g17.release-cesm2.1.3.WACCM-MA-1deg.001
{'fraction_non_alphanumeric': 0.15127871694841785, 'fraction_numerical': 0.05158214130905939, 'mean_word_length': 3.4555984555984556, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '246644', 'license': 'MIT', 'n_tokens_mistral': 966, 'n_tokens_neox': 892, 'n_words': 156, 'path': 'notebooks/plot_qbo.ipynb', 'repo_name': 'dan800/intake-esm', 'size': '2307'}