4 from netCDF4
import Dataset
6 import matplotlib.cm
as cm
7 import matplotlib.pyplot
as plt
8 import matplotlib.tri
as tri
13 def lct_cor(testdata, test, mpi, omp, suffix, testfig):
20 f = Dataset(testdata +
"/" + test +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + mpi.zfill(6) +
"-" + format(iproc_plot,
'06d') +
".nc",
"r", format=
"NETCDF4")
23 _FillValue = f.__dict__[
"_FillValue"]
31 for group
in f.groups:
33 lon = f.groups[group][
"lon"][:,:]
34 lat = f.groups[group][
"lat"][:,:]
35 l0rl0_to_l0 = f.groups[group][
"l0rl0_to_l0"][:,:]
37 for fieldname
in [
"raw",
"fit",
"fit_filt"]:
38 if fieldname
in f.groups[group].variables:
40 field = f.groups[group][fieldname][:,:,:,:]
47 field = ma.masked_invalid(field)
48 vmax = np.max(np.abs(field))
50 levels = np.linspace(-vmax, vmax, 21)
52 levels = np.linspace(-1.0, 1.0, 3)
53 field = field.filled(fill_value=-1.0e38)
56 fig, ax = plt.subplots(nrows=nl0r)
57 fig.subplots_adjust(hspace=0.4, right=0.8)
58 for il0r
in range(0, nl0r):
59 ax[il0r].set_title(group +
" - " + fieldname +
" @ " + str(l0rl0_to_l0[il0_plot,il0r]))
60 im = ax[il0r].tricontourf(lon[ic1a_plot,:], lat[ic1a_plot,:], field[il0_plot,ic1a_plot,il0r,:], levels=levels, cmap=
"bwr")
63 cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
64 fig.colorbar(im, cax=cbar_ax)
67 plt.savefig(testfig +
"/test_" + mpi +
"-" + omp +
"_" + suffix +
"_" + group +
"_" + fieldname +
".jpg", format=
"jpg", dpi=300)