Last change
on this file since 964 was
960,
checked in by aslmd, 12 years ago
|
UTIL PYTHON planetoplot_v2. MAJOR: created an easy way to load a variable from a netcdf file, see easy_get_field.py [note: now to avoid confusion with .f attributes containing field, .f() method is named .func()] ; MINOR: generic units keyword, quiet mode, dummy xy axis when not given in ppplot, bug fixes for one-value 0D requests.
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | from ppclass import pp |
---|
3 | |
---|
4 | # define object, file, var |
---|
5 | m = pp() |
---|
6 | m.file = "/home/aymeric/Big_Data/GALE/wrfout_d03_2024-06-09_00:00:00" |
---|
7 | m.var = "W" |
---|
8 | |
---|
9 | # define dimensions |
---|
10 | m.x = "136.,139." # computing over x interval |
---|
11 | m.y = -5. # setting a fixed y value |
---|
12 | m.z = None # leaving z as a free dimension |
---|
13 | m.t = [6.,12.,18.,24.] # setting 4 fixed t values |
---|
14 | |
---|
15 | # define settings |
---|
16 | m.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 |
---|
21 | m.getplot() |
---|
22 | |
---|
23 | # get potential temperature at same point. |
---|
24 | # don't plot it. do an operation on it. |
---|
25 | tpot = pp() |
---|
26 | tpot << m |
---|
27 | tpot.var = "T" |
---|
28 | tpot.get() |
---|
29 | tpot = tpot + 220. |
---|
30 | |
---|
31 | # get geopotential at same point. |
---|
32 | # don't plot it. do an operation on it (to get height). |
---|
33 | geop = pp() |
---|
34 | geop << m |
---|
35 | geop.var = "PHTOT" |
---|
36 | geop.get() |
---|
37 | z = geop/3.72/1000. |
---|
38 | |
---|
39 | # define potential temperature as a function of height |
---|
40 | S = tpot.func(z) |
---|
41 | |
---|
42 | # change a few plot settings |
---|
43 | for curve in S.p: |
---|
44 | curve.lstyle = "--" |
---|
45 | curve.marker = "" |
---|
46 | S.p[0].swaplab = False |
---|
47 | S.p[0].ylabel="Geopotential height (km)" |
---|
48 | S.p[0].xlabel="Potential temperature (K)" |
---|
49 | S.filename = "meso_profile" |
---|
50 | |
---|
51 | # make the plot |
---|
52 | S.makeplot() |
---|
Note: See
TracBrowser
for help on using the repository browser.