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

Last change on this file since 3833 was 3833, checked in by afalco, 20 hours ago

Pluto: updated plots scripts.
Fixed some issues with reading XIOS, etc.
Included display_netcdf.py tool from Mars PCM.
AF

  • Property svn:executable set to *
File size: 2.2 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]
20# latitude=-19
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
41# tim=np.linspace(0,24,9)
42print(("tim=",tim))
43print(('on prend les premiers indice, shape (tmps, alt, var) =',shape(tim), shape(alt), shape(myvar)))
44#pal=get_cmap(name="RdYlBu_r")
45pal=get_cmap(name="Spectral_r")
46lev=np.linspace(40,50,10)
47# xticks=[0,2,4,6,8,10,12,14,16,18,20,22,24]
48print(('hello:',np.linspace(0,24,13)))
49#yticks=np.linspace(0,240,9)
50
51
52CF=mpl.contourf(tim,alt,np.transpose(myvar),lev,cmap=pal,extend='both')
53cbar=mpl.colorbar(CF,shrink=1, format="%1.0f")
54cbar.ax.set_title("Temp [K]",y=1.04,fontsize=font)
55for t in cbar.ax.get_yticklabels():
56      t.set_fontsize(font)
57
58
59vect=lev
60CS=mpl.contour(tim,alt,np.transpose(myvar),vect,colors='k',linewidths=0.5)
61#inline=1 : values over the line
62#mpl.clabel(CS, inline=2, fontsize=10, fmt='%1.1e')
63mpl.clabel(CS, inline=1, fontsize=15, fmt='%1.0f',inline_spacing=1)
64
65
66#mpl.title('Latitude ='+str(tintstr[i]),fontsize=font)
67mpl.xlabel('Local Time (h)',labelpad=10,fontsize=font)
68mpl.ylabel('Altitude (km)',labelpad=10, fontsize=font)
69# mpl.xticks(xticks,fontsize=font)
70mpl.xticks(fontsize=font)
71#mpl.yticks(yticks,fontsize=font)
72mpl.yticks(fontsize=font)
73pylab.ylim([0,4])
74
75mpl.savefig('temploctime.eps',dpi=200)
76mpl.savefig('temploctime.png',dpi=200)
77mpl.show()
78
79
80
Note: See TracBrowser for help on using the repository browser.