예제 #1
0
plot_all_years = False
plot_acc_clim = False

# Lat-lon box for MFC / precip
lon1, lon2 = 60, 100
lat1, lat2 = 10, 30

# Files for different onset indices
indfiles = { 'CHP_MFC' : mfcfiles, 'CHP_PCP' : precipfiles, 'HOWI' : vimtfiles}

# ----------------------------------------------------------------------
# Read data and calculate indices

# MFC and precip over SASM region
nroll = 7
tseries = utils.get_mfc_box(mfcfiles, precipfiles, None, years, nroll, lat1, lat2,
                            lon1, lon2)

# Monsoon onset day and index timeseries
if onset_nm.startswith('CHP'):
    # Use precip/MFC already loaded
    data = tseries[onset_nm.split('_')[1] + '_ACC']
else:
    data = None
index = utils.get_onset_indices(onset_nm, indfiles[onset_nm], years, data)
onset, retreat, length = index['onset'], index['retreat'], index['length']
tseries[onset_nm] = index['tseries']

# ENSO
enso = utils.get_enso_indices(years)
enso = xray.DataArray(enso[enso_nm]).rename({'Year' : 'year'})
예제 #2
0
datafiles = {}
datafiles['HOWI'] = [datadir + 'merra_vimt_ps-300mb_%d.nc' % yr for yr in years]
datafiles['MFC'] = [datadir + 'merra_MFC_40E-120E_90S-90N_%d.nc' % yr
                    for yr in years]
datafiles['PCP'] = [datadir + 'merra_precip_%d.nc' % yr for yr in years]

# Lat-lon box for MFC / precip
lon1, lon2 = 60, 100
lat1, lat2 = 10, 30

# ----------------------------------------------------------------------
# Read data

# MFC and precip over SASM region
nroll = 7
tseries = utils.get_mfc_box(datafiles['MFC'], datafiles['PCP'], None, years,
                            nroll, lat1, lat2, lon1, lon2)

# Monsoon onset/retreat indices
if onset_nm.startswith('CHP'):
    # --- Use precip/MFC already loaded
    data = tseries[onset_nm.split('_')[1] + '_ACC']
    files = None
else:
    data = None
    files = datafiles[onset_nm]
index = utils.get_onset_indices(onset_nm, files, years, data)
index = index[['onset', 'retreat']].to_dataframe()
index['length'] = index['retreat'] - index['onset']

# ENSO
enso = utils.get_enso_indices(years, enso_keys)