4 from netCDF4
import Dataset
6 import matplotlib.pyplot
as plt
11 def diag(testdata, test, mpi, omp, suffix, testfig):
13 f = Dataset(testdata +
"/" + test +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
".nc",
"r", format=
"NETCDF4")
16 _FillValue = f.__dict__[
"_FillValue"]
20 vunitmin = np.min(vunit)
21 vunitmax = np.max(vunit)
31 diag_list = [
"coef_ens",
"fit_rh",
"fit_rv"]
34 for diag
in diag_list:
35 fig, ax = plt.subplots()
36 fig.subplots_adjust(right=0.8)
37 cmap = matplotlib.cm.get_cmap(
'Spectral')
39 ax.set_ylim([vunitmin,vunitmax])
41 for group
in f.groups:
42 for subgroup
in f.groups[group].groups:
43 if (diag
in f.groups[group].groups[subgroup].variables):
44 ax.plot(f.groups[group].groups[subgroup][diag][:], vunit, label=group +
" - " + subgroup)
49 handles, labels = ax.get_legend_handles_labels()
50 fig.legend(handles, labels, loc=
'center right')
53 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + diag +
".jpg", format=
"jpg", dpi=300)