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)
37 vmax = np.max(np.abs(field))
39 levels = np.linspace(-vmax, vmax, 21)
41 levels = np.linspace(-1.0, 1.0, 3)
42 field = field.filled(fill_value=-1.0e38)
45 fig, ax = plt.subplots(nrows=nl0)
46 fig.subplots_adjust(hspace=0.4, right=0.8)
47 for il0
in range(0, nl0):
48 ax[il0].set_title(group +
" - " + var +
" @ " + str(il0))
49 im = ax[il0].tricontourf(lon, lat, field[il0,:], levels=levels, cmap=
"bwr")
52 cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
53 fig.colorbar(im, cax=cbar_ax)
56 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + group +
"_" + var +
".jpg", format=
"jpg", dpi=300)
59 for subgroup
in f.groups[group].groups:
60 for var
in f.groups[group].groups[subgroup].variables:
62 field = f.groups[group].groups[subgroup][var][:,:]
65 field = ma.masked_invalid(field)
66 vmax = np.max(np.abs(field))
68 levels = np.linspace(-vmax, vmax, 21)
69 field = field.filled(fill_value=-1.0e38)
72 fig, ax = plt.subplots(nrows=nl0)
73 fig.subplots_adjust(hspace=0.4, right=0.8)
74 for il0
in range(0, nl0):
75 ax[il0].set_title(group +
" - " + subgroup +
" - " + var +
" @ " + str(il0))
76 im = ax[il0].tricontourf(lon, lat, field[il0,:], levels=levels, cmap=
"bwr")
79 cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
80 fig.colorbar(im, cax=cbar_ax)
83 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + group +
"_" + subgroup +
"_" + var +
".jpg", format=
"jpg", dpi=300)