Example #1
0
for i in range(6):
    plot_timeseries_spread(lead[i], axs[i])
    if i!=5:
        axs[i].set_xticks([])

plt.tight_layout()


#%% =============================================================================
# All season correlation skill
# =============================================================================
# scores on the full time series
r, p  = evaluation_correlation(f'{model_name}', variable_name=f'quantile0.5')

# score in different decades
r_dec, p_dec = evaluation_decadal_correlation(f'{model_name}',variable_name=f'quantile0.5')

# plot correlation skills
ax = plt.figure(figsize=(5.,3.)).gca()

for j in range(n_decades-1):
    plt.plot(lead_times, r_dec[:,j], c=decade_color[j], label=f"{decade_name[j]}")
plt.plot(lead_times, r, label="1963-2017", c='k', lw=2)

plt.ylim(0,1)
plt.xlim(0.,lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('ACC')
plt.grid()
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))
ax.xaxis.set_major_locator(MaxNLocator(integer=True))
Example #2
0
for j in range(len(lead_times)):
    rps_mean[j] = (((prob[:, :, j] - oni_cls_prob)**2)).sum(axis=0).mean()
    rps_mean_clim[j] = (((prob_clim[:, :, j] -
                          oni_cls_prob)**2)).sum(axis=0).mean()

rpss = 1 - rps_mean / rps_mean_clim

print(rpss)
#%% =============================================================================
# All season correlation skill
# =============================================================================
# scores on the full time series
r, p = evaluation_correlation(f'{model_name}_prob', variable_name=f'median')

# score in different decades
r_dec, p_dec = evaluation_decadal_correlation(f'{model_name}_prob',
                                              variable_name=f'median')

# plot correlation skills
ax = plt.figure(figsize=(6.5, 3.5)).gca()

for j in range(n_decades - 1):
    plt.plot(lead_times,
             r_dec[:, j],
             c=decade_color[j],
             label=f"Deep Ens.  ({decade_name[j]})")
plt.plot(lead_times, r, label="Deep Ens.  (1963-2017)", c='k', lw=2)

plt.ylim(0, 1)
plt.xlim(0., lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('r')
Example #3
0
from mlr import pipeline, mlr, pipeline_noise
#

model_name = 'mlr_review'
cross_hindcast(mlr, pipeline, f'{model_name}')

#%% =============================================================================
# All season correlation skill
# =============================================================================

plt.close("all")
# scores on the full time series
r, p  = evaluation_correlation(f'{model_name}', variable_name='prediction')

# score in different decades
r_dec, p_dec = evaluation_decadal_correlation(f'{model_name}', variable_name='prediction')

# plot correlation skills
ax = plt.figure(figsize=(6.5,3.5)).gca()

for j in range(n_decades-1):
    plt.plot(lead_times, r_dec[:,j], c=decade_color[j], label=f"Deep Ens.  ({decade_name[j]})")
plt.plot(lead_times, r, label="Deep Ens.  (1962-2017)", c='k', lw=2)

plt.ylim(0,1)
plt.xlim(0.,lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('r')
plt.grid()
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))
ax.xaxis.set_major_locator(MaxNLocator(integer=True))
Example #4
0
from ninolearn.plot.evaluation import plot_seasonal_skill

from mlr import pipeline, mlr
#
cross_hindcast(mlr, pipeline, 'mlr')

#%% =============================================================================
# All season correlation skill
# =============================================================================

plt.close("all")
# scores on the full time series
r, p = evaluation_correlation('mlr', variable_name='prediction')

# score in different decades
r_dec, p_dec = evaluation_decadal_correlation('mlr',
                                              variable_name='prediction')

# plot correlation skills
ax = plt.figure(figsize=(6.5, 3.5)).gca()

for j in range(n_decades - 1):
    plt.plot(lead_times,
             r_dec[:, j],
             c=decade_color[j],
             label=f"Deep Ens.  ({decade_name[j]})")
plt.plot(lead_times, r, label="Deep Ens.  (1962-2017)", c='k', lw=2)

plt.ylim(0, 1)
plt.xlim(0., lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('r')
Example #5
0
        axs[i].set_xticks([])

plt.tight_layout()

fig, ax = plt.subplots(1, figsize=(7, 2))
plot_timeseries(lead_times[3], ax)
plt.tight_layout()

#%% =============================================================================
# All season correlation skill
# =============================================================================
# scores on the full time series
r, p = evaluation_correlation(f'{model_name}')

# score in different decades
r_dec, p_dec = evaluation_decadal_correlation(f'{model_name}')

# plot correlation skills
ax = plt.figure(figsize=(6.5, 3.5)).gca()

for j in range(n_decades - 1):
    plt.plot(lead_times,
             r_dec[:, j],
             c=decade_color[j],
             label=f"Deep Ens.  ({decade_name[j]})")
plt.plot(lead_times, r, label="Deep Ens.  (1963-2017)", c='k', lw=2)

plt.ylim(0, 1)
plt.xlim(0., lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('r')
Example #6
0
qrnn_model = 'qnn_ex_pca_tanh'

file_gdnn = join(processeddir, f'{gdnn_model}_forecasts_with_std_estimated.nc')
file_qrnn = join(processeddir, f'{qrnn_model}_forecasts_with_std_estimated.nc')

data_gdnn = xr.open_dataset(file_gdnn)
data_qrnn = xr.open_dataset(file_qrnn)

#%% =============================================================================
# All season correlation skill Figure 2
# =============================================================================

fig, ax = plt.subplots(1, 2, figsize=(8.5, 3.5))

r_gdnn, _ = evaluation_correlation(f'{gdnn_model}', variable_name=f'mean')
r_dec_gdnn, _ = evaluation_decadal_correlation(f'{gdnn_model}',
                                               variable_name=f'mean')

r_qrnn, _ = evaluation_correlation(f'{qrnn_model}',
                                   variable_name=f'quantile0.5')
r_dec_qrnn, _ = evaluation_decadal_correlation(f'{qrnn_model}',
                                               variable_name=f'quantile0.5')

for j in range(n_decades - 1):
    ax[0].plot(lead_times,
               r_dec_gdnn[:, j],
               c=decade_color[j],
               label=f"{decade_name[j]}")
    ax[1].plot(lead_times,
               r_dec_qrnn[:, j],
               c=decade_color[j],
               label=f"{decade_name[j]}")
plt.xlim(0., lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('NLL')
plt.grid()
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))
ax.xaxis.set_major_locator(MaxNLocator(integer=True))
plt.tight_layout()

#%% =============================================================================
# All season correlation skill
# =============================================================================
# scores on the full time series
r, p = evaluation_correlation('dem')

# score in different decades
r_dec, p_dec = evaluation_decadal_correlation('dem')

# plot correlation skills
ax = plt.figure(figsize=(6.5, 3.5)).gca()

for j in range(n_decades - 1):
    plt.plot(lead_times,
             r_dec[:, j],
             c=decade_color[j],
             label=f"Deep Ens.  ({decade_name[j]})")
plt.plot(lead_times, r, label="Deep Ens.  (1963-2017)", c='k', lw=2)

plt.ylim(0, 1)
plt.xlim(0., lead_times[-1])
plt.xlabel('Lead Time [Months]')
plt.ylabel('r')