4 from netCDF4
import Dataset
7 case =
'straka-test-main'
8 data = Dataset(
'%s.nc' % case,
'r')
10 x1 = data[
'x1'][:]/1.E3
11 x2 = data[
'x2'][:]/1.E3
13 tslice = [0., 300., 600., 900.]
20 fig, axs = subplots(4, 1, figsize = (10, 12), sharex =
True, sharey =
True)
21 subplots_adjust(hspace = 0.08)
22 X, Y = meshgrid(x2, x1)
23 clines = hstack((arange(-17., 0.), arange(1., 5.)))
25 for i, t
in enumerate(tslice):
26 j = where(time >= t)[0][0]
27 theta = data[
'theta'][j,:,:,0]
29 print(
'time = %.2f, theta min = %.2f, theta max = %.2f' % (time[j], theta.min(), theta.max()))
31 ax.contour(X, Y, theta, clines, colors =
'k', linestyles =
'-')
33 ax.set_xlim([0., 19.2])
34 ax.set_ylim([0., 4.8])
35 ax.text(14., 4.4,
'time = %.1f ' % time[j], fontsize = 12)
36 ax.text(14., 4.0,
'%.2f m' % (1.E3*(
max(x2) -
min(x2))/len(x2),),
38 ax.text(14., 3.6,
'min T = %.2f K' % theta.min(), fontsize = 12)
39 ax.text(14., 3.2,
'max T = %.2f K' % theta.max(), fontsize = 12)
40 ax.set_ylabel(
'Z (km)', fontsize = 15)
41 ax.set_xlabel(
'X (km)', fontsize = 15)
42 savefig(
'2d.straka-theta.png' % case, bbox_inches =
'tight')
double min(double x1, double x2, double x3)
double max(double x1, double x2, double x3)