source: trunk/UTIL/PYTHON/planetoplot_v2/pp_reload.py @ 943

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

UTIL PYTHON planetoplot_v2. handling time for mesoscale files. added -E
to pp_reload to loop on several colormaps to try. corrected a bug for 1D

plots with linestyle and colors. added a functionality to easily add te

xt (or crosses, dots, etc...) on a map through a text file add_text.txt

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#! /usr/bin/env python
2# -----------------------------------------------------------------------
3# A very simple script to reload a previously saved plot array in ppclass
4# ... for a demo, try "pp_reload.py demo_data/*"
5# Author: A. Spiga 03/2013
6# -----------------------------------------------------------------------
7from optparse import OptionParser ### TBR by argparse
8from ppclass import pp
9# -----------------------------------------------------------------------
10parser = OptionParser()
11parser.add_option('-O','--out',action='store',dest='out',type="string",default="gui",help='Specify a new output format')
12parser.add_option('-T','--title',action='store',dest='title',type="string",default=None,help='Give a new title')
13parser.add_option('-K','--marker',action='store',dest='marker',type="string",default=None,help="[1D] Define a new marker")
14parser.add_option('-P','--proj',action='store',dest='proj',type="string",default=None,help='[2D] Define a new map projection')
15parser.add_option('-C','--colorb',action='store',dest='colorb',type="string",default=None,help="[2D] Define a new colormap")
16parser.add_option('-E','--explore',action='store_true',dest='explore',default=False,help="[2D] Try many colormaps")
17(opt,args) = parser.parse_args()
18# -----------------------------------------------------------------------
19clb = ["Greys","Blues","YlOrRd",\
20       "jet","spectral","hot",\
21       "RdBu","RdYlBu","Paired",\
22       "gist_ncar","gist_rainbow","gist_stern"]
23# -----------------------------------------------------------------------
24
25for files in args:
26
27    yeah = pp()
28    yeah.defineplot(loadfile=files)
29    yeah.out = opt.out
30
31    if opt.proj is not None:
32      for plot in yeah.p:
33        plot.proj = opt.proj
34    if opt.colorb is not None:
35      for plot in yeah.p:
36        plot.colorb = opt.colorb
37    if opt.marker is not None:
38      for plot in yeah.p:
39        plot.marker = opt.marker
40    if opt.title is not None:
41      for plot in yeah.p:
42        plot.title = opt.title
43
44    if opt.explore:
45      for cm in clb:
46       for plot in yeah.p:
47         plot.colorb = cm
48         plot.title = cm
49       yeah.makeplot()
50    else:         
51      yeah.makeplot()
52
Note: See TracBrowser for help on using the repository browser.