4 from netCDF4
import Dataset
6 import matplotlib.pyplot
as plt
11 def umf(testdata, test, mpi, omp, suffix, testfig):
13 f = Dataset(testdata +
"/" + test +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
".nc",
"r", format=
"NETCDF4")
16 _FillValue = f.__dict__[
"_FillValue"]
23 var_list = [
"m2",
"m4",
"kurt"]
26 nl0 = f[var_list[0]][:,:].shape[0]
33 field = ma.masked_invalid(field)
35 levels = np.linspace(0, vmax, 21)
36 field = field.filled(fill_value=-1.0e38)
39 fig, ax = plt.subplots(nrows=nl0)
40 fig.subplots_adjust(hspace=0.4, right=0.8)
41 for il0
in range(0, nl0):
42 ax[il0].set_title(var +
" @ " + str(il0))
43 im = ax[il0].tricontourf(lon, lat, field[il0,:], levels=levels, cmap=
"YlOrRd")
46 cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
47 fig.colorbar(im, cax=cbar_ax)
50 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + var +
".jpg", format=
"jpg", dpi=300)