4 from netCDF4
import Dataset
6 import matplotlib.pyplot
as plt
13 f = Dataset(testdata +
"/" + test +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
".nc",
"r", format=
"NETCDF4")
23 x = np.linspace(1, nfac, nfac)
26 mse_mean = np.zeros((0, nfac))
27 mse_mean = np.append(mse_mean, [np.mean(f[
"mse"][:,:], axis=1)], axis=0)
28 mse_mean = np.append(mse_mean, [np.mean(f[
"mse_th"][:,:], axis=1)], axis=0)
29 mse_std = np.zeros((0, nfac))
30 mse_std = np.append(mse_std, [np.std(f[
"mse"][:,:], axis=1)], axis=0)
31 mse_std = np.append(mse_std, [np.std(f[
"mse_th"][:,:], axis=1)], axis=0)
34 fig, ax = plt.subplots()
35 ax.set_xlim([0.5,float(nfac)+0.5])
36 ax.set_xlabel(
"Number of members")
37 ax.set_ylabel(
"Mean Square Error")
38 ax.plot(x, mse_mean[0,:],
'k-')
39 ax.plot(x, mse_mean[0,:]-mse_std[0,:],
'k--')
40 ax.plot(x, mse_mean[0,:]+mse_std[0,:],
'k--')
41 ax.plot(x, mse_mean[1,:],
'r-')
42 ax.plot(x, mse_mean[1,:]-mse_std[1,:],
'r--')
43 ax.plot(x, mse_mean[1,:]+mse_std[1,:],
'r--')
46 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
".jpg", format=
"jpg", dpi=300)