<jupyter_start><jupyter_text>only use the abs version AR see final script at :/pic/projects/hyperion/chen423/tools/paper_tools/AR-SST/step5.moisture_decomposition.py<jupyter_code>import numpy as np
import xarray as xr

import matplotlib.pyplot as plt
scenario = 'HIST'

year = 2003
month = 10

para_b = int(10)
reffile = '/raid1/chen423/serdp/data/ref_data/wrf_ref/geo_em.d01.nc'
landmask = xr.open_dataset(reffile).LANDMASK.values[0,para_b:(450-para_b),para_b:(450-para_b)]
ETdir = '/home/chen423/.tmp/AR-SST/%s/moisture/ET/' % (scenario)
uIVTdir = '/home/chen423/.tmp/AR-SST/%s/moisture/uIVT/' % (scenario)
vIVTdir = '/home/chen423/.tmp/AR-SST/%s/moisture/vIVT/' % (scenario)
#ARdir = '/home/chen423/.tmp/AR-SST/%s/AR_tagged/Gershunov/SERDP6km_adj/' % (scenario)
ETfile = ETdir + 'WRF_NARR.%s.SFCEVP.%d.%d.nc' % (scenario, year, month)
uIVTfile = uIVTdir + 'WRF_NARR.%s.uIVT.%d.%d.nc' % (scenario, year, month)
vIVTfile = vIVTdir + 'WRF_NARR.%s.vIVT.%d.%d.nc' % (scenario, year, month)

#ARfile = ARdir + 'WRF_ARtag_adj.%s.Gershunov.%d.%d.ARabs.nc' % (scenario, year, month)
ETdata = xr.open_dataset(ETfile).SFCEVP.values[:,para_b:(450-para_b),para_b:(450-para_b)]
uIVTdata = xr.open_dataset(uIVTfile).uIVT.values[:,para_b:(450-para_b),para_b:(450-para_b)]
vIVTdata = xr.open_dataset(vIVTfile).vIVT.values[:,para_b:(450-para_b),para_b:(450-para_b)]
#ARtag = xr.open_dataset(ARfile).AR_tag.values[:,para_b:(450-para_b),para_b:(450-para_b)]
def compute_moisture_intensity(in_uIVT, in_vIVT, in_ET, ref_mask):
    # refmask is landmak, land is 1, ocean is 0
    
    # note:
    #      uIVT: into the domain
    #      vIVT: bottom: into the domain;   top: away from the domain
    
    #uIVT_total = in_uIVT[:,0][in_ARtag[:,0]==1].sum()*6000*86400
    uIVT_total = in_uIVT[:,0].sum()*6000*86400
    vIVT_sub_bottom = in_vIVT[0,:][ref_mask[0,:]==0].sum()*6000*86400
    vIVT_sub_top = in_vIVT[(450-2*para_b-1),:][ref_mask[(450-2*para_b-1),:]==0].sum()*6000*86400
    ET_total = in_ET[(ref_mask==0)].sum()*6000*6000

    return ET_total, uIVT_total, vIVT_sub_bottom, vIVT_sub_top<jupyter_output><empty_output><jupyter_text>mask_test = np.zeros((430,430))mask_test[100:150,:] = 1plt.pcolormesh(np.ma.masked_array(vIVTdata[0], mask=mask_test))<jupyter_code>nt = uIVTdata.shape[0]
testdata = np.zeros((nt,4))
for t in np.arange(nt):
    testdata[t] = compute_moisture_intensity(uIVTdata[t], vIVTdata[t], ETdata[int(np.floor(t/4))], landmask)
    print(t)
plt.scatter(np.arange(nt), testdata[:,0]/(testdata[:,1]+testdata[:,2]-testdata[:,3]))
plt.ylim([-0.2, 0.3])
import scipy.io as sio
testfile = '/home/chen423/.tmp/AR-SST/HIST/moisture/full_ocean/ETratio.HIST.full_ocean.2003.10.mat'
array_ET = sio.loadmat(testfile)['array_ET']
array_uIVT = sio.loadmat(testfile)['array_uIVT']
array_vIVT_bottom = sio.loadmat(testfile)['array_vIVT_bottom']
array_vIVT_top = sio.loadmat(testfile)['array_vIVT_top']
plt.scatter(np.arange(nt), array_ET/(array_uIVT+array_vIVT_bottom-array_vIVT_top))
plt.ylim([-0.2, 0.3])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18626155878467635, 'fraction_numerical': 0.05449141347424042, 'mean_word_length': 5.791479820627803, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '628908', 'license': 'MIT', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1389, 'n_words': 160, 'path': 'scripts/rebuttal/figR3-01.moisture_source_seperation.full_ocean.ipynb', 'repo_name': 'lucas-uw/Chen-2020-GRL', 'size': '3028'}