source: trunk/LMDZ.PLUTO/util/script_figures/temp_time_zoom.py @ 3868

Last change on this file since 3868 was 3868, checked in by afalco, 6 months ago

Pluto: update figure scripts.
AF

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#! /usr/bin/env python
2from    netCDF4               import    Dataset
3from    numpy                 import    *
4import  numpy                 as        np
5import  matplotlib.pyplot     as        mpl
6from matplotlib.cm import get_cmap
7import pylab
8from matplotlib import ticker
9import matplotlib.colors as colors
10import datetime
11from mpl_toolkits.basemap import Basemap, shiftgrid
12from FV3_utils import *
13
14############################
15filename1=name+"_S.nc"
16var="temperature" #variable
17longitude=[-169,-165]
18# longitude=-165
19latitude=[-19,-15]
20latitude=-18
21
22# local time de la longitude consideree a t=0
23loct=12
24sol0=12
25t0=1./24*loct
26t1=t0+12
27tint=[sol0+t0,sol0+t1] #Time must be as written in the input file
28print(tint)
29nc1=Dataset(filename1)
30
31lat=getvar(nc1,"latitude")
32lon=getvar(nc1,"longitude")
33alt=getvar(nc1,"altitude")
34tim=getvar(nc1,"Time",times=tint)
35############################
36
37mpl.figure(figsize=(18, 10))
38
39myvar=getvar(nc1,var,times=tint,longitudes=longitude,latitudes=latitude)[:,:,0,0]
40font=23
41print(("tim=",tim))
42print(('on prend les premiers indice, shape (tmps, alt, var) =',shape(tim), shape(alt), shape(myvar)))
43#pal=get_cmap(name="RdYlBu_r")
44pal=get_cmap(name="Spectral_r")
45lev=np.linspace(40,50,10)
46# xticks=[0,2,4,6,8,10,12,14,16,18,20,22,24]
47#yticks=np.linspace(0,240,9)
48
49
50CF=mpl.contourf(tim,alt,np.transpose(myvar),lev,cmap=pal,extend='both')
51cbar=mpl.colorbar(CF,shrink=1, format="%1.0f")
52cbar.ax.set_title("Temp [K]",y=1.04,fontsize=font)
53for t in cbar.ax.get_yticklabels():
54      t.set_fontsize(font)
55
56
57vect=lev
58CS=mpl.contour(tim,alt,np.transpose(myvar),vect,colors='k',linewidths=0.5)
59#inline=1 : values over the line
60#mpl.clabel(CS, inline=2, fontsize=10, fmt='%1.1e')
61mpl.clabel(CS, inline=1, fontsize=15, fmt='%1.0f',inline_spacing=1)
62
63
64#mpl.title('Latitude ='+str(tintstr[i]),fontsize=font)
65mpl.xlabel('Local Time (h)',labelpad=10,fontsize=font)
66mpl.ylabel('Altitude (km)',labelpad=10, fontsize=font)
67# mpl.xticks(xticks,fontsize=font)
68mpl.xticks(fontsize=font)
69#mpl.yticks(yticks,fontsize=font)
70mpl.yticks(fontsize=font)
71pylab.ylim([0,4])
72
73mpl.savefig('temploctime.eps',dpi=200)
74mpl.savefig('temploctime.png',dpi=200)
75mpl.show()
76
77
78
Note: See TracBrowser for help on using the repository browser.