4 from netCDF4
import Dataset
6 import matplotlib.cm
as cm
7 import matplotlib.pyplot
as plt
8 import matplotlib.tri
as tri
15 f = Dataset(testdata +
"/" + test +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
".nc",
"r", format=
"NETCDF4")
18 _FillValue = f.__dict__[
"_FillValue"]
25 vunit = f[
"vunit"][:,:]
30 for group
in f.groups:
31 for var
in f.groups[group].variables:
33 field = f.groups[group][var][:,:]
36 field = ma.masked_invalid(field)
38 levels = np.linspace(0, vmax, 21)
39 field = field.filled(fill_value=-1.0e38)
42 fig, ax = plt.subplots(nrows=nl0)
43 fig.subplots_adjust(hspace=0.4, right=0.8)
44 for il0
in range(0, nl0):
45 ax[il0].set_title(group +
" - " + var +
" @ " + str(il0))
46 im = ax[il0].tricontourf(lon, lat, field[il0,:], levels=levels, cmap=
"YlOrRd")
49 cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
50 fig.colorbar(im, cax=cbar_ax)
53 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + group +
"_" + var +
".jpg", format=
"jpg", dpi=300)
56 for subgroup
in f.groups[group].groups:
57 for var
in f.groups[group].groups[subgroup].variables:
59 field = f.groups[group].groups[subgroup][var][:,:]
62 field = ma.masked_invalid(field)
65 vmax = np.max(np.abs(field))
66 levels = np.linspace(-vmax, vmax, 21)
70 levels = np.linspace(0, vmax, 21)
72 levels = np.linspace(0, 1.0, 21)
73 field = field.filled(fill_value=-1.0e38)
76 fig, ax = plt.subplots(nrows=nl0)
77 fig.subplots_adjust(hspace=0.4, right=0.8)
78 for il0
in range(0, nl0):
79 ax[il0].set_title(group +
" - " + subgroup +
" - " + var +
" @ " + str(il0))
80 im = ax[il0].tricontourf(lon, lat, field[il0,:], levels=levels, cmap=
"YlOrRd")
83 cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
84 fig.colorbar(im, cax=cbar_ax)
87 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + group +
"_" + subgroup +
"_" + var +
".jpg", format=
"jpg", dpi=300)