[177] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | ########################################################################## |
---|
| 4 | import numpy as np |
---|
| 5 | import myplot as myp |
---|
| 6 | import mymath as mym |
---|
| 7 | import netCDF4 |
---|
| 8 | import matplotlib.pyplot as plt |
---|
| 9 | ########################################################################## |
---|
| 10 | namefile = '/home/aslmd/POLAR/POLAR_APPERE_highres/wrfout_d01_2024-03-04_06:00:00_zabg' |
---|
| 11 | namefile2 = '/home/aslmd/POLARWATERCYCLE/wrfout_d01_2024-05-03_01:00:00_zabg' |
---|
| 12 | nc = netCDF4.Dataset(namefile) |
---|
| 13 | [lon2d,lat2d] = myp.getcoord2d(nc) |
---|
| 14 | ########################################################################## |
---|
| 15 | ntime = 5 |
---|
| 16 | nvert = 1 |
---|
| 17 | u = nc.variables['Um' ][ntime,nvert,:,:] |
---|
| 18 | v = nc.variables['Vm' ][ntime,nvert,:,:] |
---|
| 19 | ########################################################################## |
---|
| 20 | plt.figure(1) |
---|
| 21 | ########################################################################## |
---|
| 22 | [lon2d,lat2d] = myp.getcoord2d(nc) |
---|
| 23 | [wlon,wlat] = myp.latinterv("North_Pole") |
---|
| 24 | #plt.title("Polar mesoscale domain") |
---|
| 25 | m = myp.define_proj("ortho",wlon,wlat,back="vishires") |
---|
| 26 | x, y = m(lon2d, lat2d) |
---|
| 27 | m.pcolor(x, y, nc.variables['HGT'][0,:,:] / 1000.) |
---|
| 28 | ########################################################################### |
---|
| 29 | myp.makeplotpng("mars_polar_mesoscale_1",folder="/u/aslmd/WWW/antichambre/",pad_inches_value=0.15) |
---|
| 30 | ########################################################################### |
---|
| 31 | plt.figure(2) |
---|
| 32 | plt.subplot(121) |
---|
| 33 | [lon2d,lat2d] = myp.getcoord2d(nc) |
---|
| 34 | [wlon,wlat] = myp.latinterv("Close_North_Pole") |
---|
| 35 | plt.title("Near-surface winds at Ls=60"+mym.deg()) |
---|
| 36 | m = myp.define_proj("npstere",wlon,wlat,back="vishires") |
---|
| 37 | x, y = m(lon2d, lat2d) |
---|
| 38 | myp.vectorfield(u, v, x, y, stride=5, csmooth=6, scale=15., factor=200., color='darkblue') |
---|
| 39 | ########################################################################### |
---|
| 40 | plt.subplot(122) |
---|
| 41 | [wlon,wlat] = [[-180.,180.],[84.,90.]] |
---|
| 42 | plt.title("+ sensible heat flux (W/m2)") |
---|
| 43 | m = myp.define_proj("npstere",wlon,wlat,back="vishires") |
---|
| 44 | x, y = m(lon2d, lat2d) |
---|
| 45 | zeplot = m.contour(x, y, -nc.variables['HFX'][ntime,:,:],[-2.,0.,2.,4.,6.,8.,10.,12.],cmap=plt.cm.Reds) |
---|
| 46 | plt.clabel(zeplot, inline=1, inline_spacing=1, fontsize=7, fmt='%0i') |
---|
| 47 | myp.vectorfield(u, v, x, y, stride=2, scale=15., factor=200., color='darkblue') |
---|
| 48 | #plt.colorbar(pad=0.1).set_label('Downward sensible heat flux [W/m2]') |
---|
| 49 | ########################################################################### |
---|
| 50 | myp.makeplotpng("mars_polar_mesoscale_2",folder="/u/aslmd/WWW/antichambre/",pad_inches_value=0.35) |
---|
| 51 | ########################################################################### |
---|
| 52 | nc = netCDF4.Dataset(namefile2) |
---|
| 53 | [lon2d,lat2d] = myp.getcoord2d(nc) |
---|
| 54 | ########################################################################## |
---|
| 55 | plt.figure(3) |
---|
| 56 | ########################################################################### |
---|
| 57 | [wlon,wlat] = [[mym.min(lon2d),mym.max(lon2d)],[mym.min(lat2d)+7.,mym.max(lat2d)]] |
---|
| 58 | #plt.figure(2) |
---|
| 59 | #plt.title("Water vapor (pr.mic)") |
---|
| 60 | #field = np.array(nc.variables['MTOT']) |
---|
| 61 | #nnn = field.shape[2] |
---|
| 62 | #ye = plt.contour( np.arange(field.shape[0]),\ |
---|
| 63 | # np.linspace(wlat[0],wlat[1],nnn),\ |
---|
| 64 | # np.transpose(mym.mean(field,axis=1)),\ |
---|
| 65 | # np.arange(0.,100.,5.)) |
---|
| 66 | #plt.clabel(ye, inline=1, inline_spacing=1, fontsize=7, fmt='%0i') |
---|
| 67 | ############################################################################ |
---|
| 68 | sub = 121 |
---|
| 69 | for i in range(3,23,12): |
---|
| 70 | print i,sub |
---|
| 71 | plt.subplot(sub) |
---|
| 72 | plt.title("H2Ovap (pr.mic) UTC "+str(i+1)+":00") |
---|
| 73 | m = myp.define_proj("npstere",wlon,wlat,back="vishires") |
---|
| 74 | x, y = m(lon2d, lat2d) |
---|
| 75 | yeah = m.contour(x, y, nc.variables['MTOT'][i,:,:],np.arange(30.,90.,10.),linewidths=1.0) |
---|
| 76 | plt.clabel(yeah, inline=1, inline_spacing=1, width=1.0, fontsize=7, fmt='%0i') |
---|
| 77 | sub += 1 |
---|
| 78 | print sub |
---|
| 79 | ############################################################################ |
---|
| 80 | myp.makeplotpng("mars_polar_mesoscale_3",folder="/u/aslmd/WWW/antichambre/", pad_inches_value=0.15) |
---|
| 81 | ############################################################################ |
---|
| 82 | |
---|
| 83 | #yeah = m.contour(x, y, mym.mean(nc.variables['MTOT'],axis=0),np.arange(0.,75.,5.),cmap=plt.cm.gist_rainbow,linewidths=1.5) |
---|