<jupyter_start><jupyter_text>ESM4<jupyter_code>ppname = 'ocean_cobalt_omip_2d'
add = 'spco2'
operation = 'mean'

pathDict = {'pp':('/archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_piControl_D/gfdl.ncrc4-intel16-prod-openmp/pp'),
           'ppname':ppname,
           'out':'ts',
           'local':'annual/5yr',
           'time':'*',
           'add':add,
           }
pathout = '../../data/esm4/processed/global_'+operation+'s/'
fileout = 'esm4_'+add
if os.path.isfile(pathout+fileout+'.nc'):
    print("File exists. Redo calculation?")
gridpath = gu.core.get_pathstatic(pathDict['pp'],pathDict['ppname'])
# dmget
path = gu.core.get_pathspp(**pathDict)
out = gu.core.issue_dmget(path)
ds = gu.core.open_frompp(**pathDict)
grid = xr.open_dataset(gridpath)
with ProgressBar():
    if operation=='integral':
        (ds[add]*grid['areacello']).sum(['xh','yh']).to_netcdf(pathout+fileout+'.nc')
    elif operation=='mean':
        (((ds[add]*grid['areacello']).sum(['xh','yh']))
         /(grid['areacello'].sum(['xh','yh']))).to_netcdf(pathout+fileout+'.nc')<jupyter_output>[########################################] | 100% Completed | 13.3s<jupyter_text>CM4<jupyter_code>ppname = 'ocean_bling_cmip6_omip_2d_1x1deg'
add = 'fgco2'
operation = 'integral'

pathDict = {'pp':('/archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_piControl_C/gfdl.ncrc4-intel16-prod-openmp/pp'),
           'ppname':ppname,
           'out':'ts',
           'local':'monthly/5yr',
           'time':'*',
           'add':add,
           }
pathout = '../../data/cm4/processed/global_'+operation+'s/'
fileout = 'cm4_'+add
if os.path.isfile(pathout+fileout+'.nc'):
    print("File exists. Redo calculation?")
gridpath = gu.core.get_pathstatic(pathDict['pp'],pathDict['ppname'])
# dmget
path = gu.core.get_pathspp(**pathDict)
out = gu.core.issue_dmget(path)
ds = gu.core.open_frompp(**pathDict)
grid = xr.open_dataset(gridpath)
with ProgressBar():
    if operation=='integral':
        (ds[add]*grid['areacello']).sum(['lon','lat']).to_netcdf(pathout+fileout+'.nc')
    elif operation=='mean':
        (((ds[add]*grid['areacello']).sum(['lon','lat']))
         /(grid['areacello'].sum(['lon','lat']))).to_netcdf(pathout+fileout+'.nc')<jupyter_output>[########################################] | 100% Completed | 22.0s<jupyter_text>Draw output<jupyter_code>try:
    gint.close()
    print('output closed')
except:
    pass
gint = xr.open_dataarray(pathout+fileout+'.nc', cache=False, decode_times=False)
fig,ax = plt.subplots(figsize=(12,4))
ax1 = ax
roll = 10
v = gint.rolling(time=roll,center=True).mean()
ax1.plot(v['time'],v,label=add,color='tab:blue')
ax1.autoscale(enable=True,axis='x',tight=True)

# fig.savefig('../../figures/esm4/ts.'+add+'.roll-'+str(roll)+'.png')
gint<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23758099352051837, 'fraction_numerical': 0.02087832973362131, 'mean_word_length': 4.729896907216495, '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': '593167', 'license': 'MIT', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1080, 'n_words': 113, 'path': 'notebooks/esm4/calc_integrals.ipynb', 'repo_name': 'gmacgilchrist/bio-pump-timescales', 'size': '2778'}