Changeset 727 for configs/testing/python
- Timestamp:
- 08/22/18 17:30:37 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
configs/testing/python/common.py
r520 r727 44 44 # plt.yticks(np.arange(0, 10001, 1000)) 45 45 plt.savefig('%s.png'%varname) 46 plt.close() 46 47 lon, lat, Omega,T,u,Phi = getvars(nc, 'lon','lat','OMEGA', 'T', 'U', 'PHI') 47 48 plot_var(nlon,nlat,llm, lon,Phi,Omega,'Omega') … … 64 65 axis_latitude() 65 66 plt.savefig('T850.png') 67 plt.close() 66 68 67 def plot_dT(nlon,nlat,llm, lon,T ,p,Phi): # perturbation temp, final time69 def plot_dT(nlon,nlat,llm, lon,T_ref,T,p,Phi): # perturbation temp, final time 68 70 # vertical slice at final time 69 71 print 'Reading data ...' 70 T ,p, Phi = T[-1,:,nlat/2,:], p[-1,:,nlat/2,:], Phi[-1,:,nlat/2,:]72 T_ref,T,p,Phi = [ x[-1,:,nlat/2,:] for x in T_ref,T,p,Phi] 71 73 print '... done.' 72 74 N, Teq, peq = 0.01, 300., 1e5 … … 85 87 plt.yticks(np.arange(0, 10001, 1000)) 86 88 plt.savefig('dT.png') 89 plt.close() 90 91 plt.figure(figsize=(12,6)) 92 plt.contourf(lon2,z,T-T_ref) 93 plt.colorbar() 94 plt.title('$T-T_{ref}$') 95 axis_longitude() 96 plt.ylabel('z (m)') 97 plt.yticks(np.arange(0, 10001, 1000)) 98 plt.savefig('dT_ref.png') 99 plt.close() 87 100 88 101 lon, lat, T850, T, Phi, p = getvars(nc, 'lon','lat','T850', 'T', 'PHI','P') 89 plot_dT(nlon,nlat,llm, lon,T,p,Phi) 102 T_ref, = getvars(nc_ref, 'T') 103 plot_dT(nlon,nlat,llm, lon,T_ref,T,p,Phi) 104 # plot_dT_ref(nlon,nlat,llm, lon,T_ref,T,p,Phi) 90 105 plot_T850(lon,lat,T850) 91 106 … … 116 131 #--------------------------- MAIN ---------------------------- 117 132 118 gridfile = 'netcdf/output_dcmip2016_regular.nc' 119 nc = cdf.Dataset(gridfile, "r") 133 filename = 'output_dcmip2016_regular.nc' 134 nc = cdf.Dataset('netcdf/%s'%filename, "r") 135 nc_ref = cdf.Dataset('netcdf_ref/%s'%filename, "r") 136 120 137 llm, nlon, nlat, ntime = getdims(nc, 'lev','lon','lat','time_counter') 121 138 Cpd, kappa, g = 1004.5, 0.2857143, 9.80616
Note: See TracChangeset
for help on using the changeset viewer.