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

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

UTIL PYTHON planetoplot_v2

PPCLASS AND PPPLOT

  • added global plot settings in pp() objects
  • self is returned for each method to allow e.g. one-line get + attribution
  • added labeling of 1D plots
  • fine-tuning of plot appearance (e.g. vector key)
  • corrected a problem with plotin (same object can be referred to all along)
  • fixed meanarea for 1D requests

PP.PY

  • no more -f for pp.py (files are simply given as arguments!)
  • added missing options to pp.py
  • nice informative header

PP_RELOAD.PY

  • pp_reload.py can now change colorbars and 1D markers

EXAMPLES

  • general update of examples + few additions
  • added a nice example tide with mixed 2D+1D plots
  • Property svn:executable set to *
File size: 1.2 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.,12.,18.,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
19
20# get data and make plot with default settings
21m.getplot()
22
23# get potential temperature at same point.
24# don't plot it. do an operation on it.
25tpot = pp()
26tpot << m
27tpot.var = "T"
28tpot.get()
29tpot = tpot + 220.
30
31# get geopotential at same point.
32# don't plot it. do an operation on it (to get height).
33geop = pp()
34geop << m
35geop.var = "PHTOT"
36geop.get()
37z = geop/3.72/1000.
38
39# define potential temperature as a function of height
40S = tpot.f(z)
41
42# change a few plot settings
43for curve in S.p: 
44    curve.lstyle = "--"
45    curve.marker = ""
46S.p[0].swaplab = False
47S.p[0].ylabel="Geopotential height (km)"
48S.p[0].xlabel="Potential temperature (K)"
49S.filename = "meso_profile"
50
51# make the plot
52S.makeplot()
Note: See TracBrowser for help on using the repository browser.