source: trunk/UTIL/PYTHON/planetoplot_v2/examples/meso_profile.py @ 977

Last change on this file since 977 was 977, checked in by aslmd, 12 years ago

UTIL PYTHON planetoplot_v2. Added rainbow spahetti plot based on an idea by Alizee. Simply set a colormap for a 1D plot and you get it. Also added in pp_reload (simple rainbow function in ppplot). Added also xmin and xmax capabilitiy. Fixed various bugs related to dummy axis, logarithmic axes. Removed time_counter from set_ppclass.txt it is useless in most cases.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#! /usr/bin/env python
2from ppclass import pp
3
4# define object, file, var
5m = pp()
6m.file = "/home/aymeric/Big_Data/GALE/wrfout_d03_2024-06-09_00:00:00"
7m.var = "W"
8
9# define dimensions
10m.x = "136.,139." # computing over x interval
11m.y = -5. # setting a fixed y value
12m.z = None # leaving z as a free dimension
13m.t = [6.,9.,12.,15.,18.,21.,24.] # setting 4 fixed t values
14
15# define settings
16m.superpose = True # superpose 1D plots
17#m.verbose = True # making the programe verbose
18#m.out = "pdf" # output format
19m.colorb = "spectral" # color cycle according to a color map
20
21# get data and make plot with default settings
22m.getplot()
23
24# get potential temperature at same point.
25# don't plot it. do an operation on it.
26tpot = pp()
27tpot << m
28tpot.var = "T"
29tpot.get()
30tpot = tpot + 220.
31
32# get geopotential at same point.
33# don't plot it. do an operation on it (to get height).
34geop = pp()
35geop << m
36geop.var = "PHTOT"
37geop.get()
38z = geop/3.72/1000.
39
40# define potential temperature as a function of height
41S = tpot.func(z)
42
43# change a few plot settings
44for curve in S.p: 
45    curve.lstyle = "--"
46    curve.marker = ""
47S.p[0].swaplab = False
48S.p[0].ylabel="Geopotential height (km)"
49S.p[0].xlabel="Potential temperature (K)"
50S.filename = "meso_profile"
51S.colorb = None # come back to default color cycle
52
53# make the plot
54S.makeplot()
Note: See TracBrowser for help on using the repository browser.