Last change
on this file since 910 was
910,
checked in by aslmd, 12 years ago
|
PLANETOPLOT v2
- Spiga LMD/UPMC 24/03/2013
Contents
core
- ppclass.py --> main class with pp() objects (need ppplot and ppcompute)
- ppplot.py --> plot class (can be used independently, need ppcompute)
- ppcompute.py --> computation class (can be used independently)
scripts
- pp.py --> command line utility to use ppclass
- pp_reload.py --> command line utility to load saved plot objects *.ppobj
- example/* --> example scripts using ppclass
settings files
- set_area.txt --> setting file: predefined areas for plotting (can be omitted)
- set_back.txt --> setting file: predefined backgrounds for plotting (can be omitted)
- set_multiplot.txt --> setting file: predefined coefficients for multiplots (can be omitted)
- set_ppclass.txt --> setting file: predefined variables for x,y,z,t (can be omitted)
- set_var.txt --> setting file: predefined colorbars, format, labels, etc... for variables (can be omitted)
documentation
- README.TXT --> this README file
data
- demo_data/* --> plot objects for a demonstration tour and customizing tests
Requirements
python + numpy + matplotlib + netCDF4
- for mapping --> Basemap
- for scientific computations --> scipy
[recommended: Enthought Python Distribution (free for academics)]
Installation
- install required softwares and librairies in requirements
- add planetoplot_v2 in your PYTHONPATH environment variable (and in your PATH to use pp.py)
Take a demo tour
pp_reload.py demo_data/*
Improvements compared to v1
- code readability and structuration for future improvements
- modularity (class formulation)
+ easy definition/addition of attributes
- separation between data retrieval and plotting
- versatility
+ command line (pp.py)
--> for quick inspection
+ interactive session (ipython)
--> for testing and exploring
+ scripts
--> for powerful and fully customized results
- performance (overall and on large files)
+ memory consumption (only retrieve what is needed)
- saving/loading plot objects in/from *.ppobj
- plot aesthetics and customizing (see header in ppplot)
- multiplot flexibility with .plotin attribute
- easy definition of presets with set_*.txt files
- function: one field vs. another one
- emulation of + - / * operations on fields
(between two fields or between a field and a int/float)
- computations of min/max in addition to mean
- simple inspection of dimensions+variables in a file (pp.py -f file)
- verbose / non verbose mode
Acknowledgements
Thanks to A. Colaitis, T. Navarro, J. Leconte
for feedbacks and contributions on version 1
|
-
Property svn:executable set to
*
|
File size:
1.1 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.f(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 | |
---|
50 | # make the plot |
---|
51 | S.makeplot() |
---|
Note: See
TracBrowser
for help on using the repository browser.