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

Last change on this file since 1242 was 1196, checked in by aslmd, 11 years ago

planetoplot. add changing resolution to ppreload options.

  • Property svn:executable set to *
File size: 2.4 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
9from ppplot import rainbow
10# -----------------------------------------------------------------------
11parser = OptionParser()
12parser.add_option('-O','--out',action='store',dest='out',type="string",default="gui",help='Specify a new output format')
13parser.add_option('-R','--res',action='store',dest='res',type="string",default=150.,help='Picture resolution')
14parser.add_option('-T','--title',action='store',dest='title',type="string",default=None,help='Give a new title')
15parser.add_option('-K','--marker',action='store',dest='marker',type="string",default=None,help="[1D] Define a new marker")
16parser.add_option('-P','--proj',action='store',dest='proj',type="string",default=None,help='[2D] Define a new map projection')
17parser.add_option('-C','--colorbar',action='store',dest='colorbar',type="string",default=None,help="[2D] Define a new colormap")
18parser.add_option('-E','--explore',action='store_true',dest='explore',default=False,help="[2D] Try many colormaps")
19(opt,args) = parser.parse_args()
20# -----------------------------------------------------------------------
21clb = ["Greys","Blues","YlOrRd",\
22       "jet","spectral","hot",\
23       "RdBu","RdYlBu","Paired",\
24       "gist_ncar","gist_rainbow","gist_stern"]
25# -----------------------------------------------------------------------
26
27for files in args:
28
29    yeah = pp()
30    yeah.quiet = True
31    yeah.defineplot(loadfile=files)
32    yeah.out = opt.out
33    yeah.res = opt.res
34
35    if opt.proj is not None:
36      for plot in yeah.p:
37        plot.proj = opt.proj
38    if opt.colorbar is not None:
39      yeah.colorbar = opt.colorbar
40      for plot in yeah.p:
41        plot.colorbar = opt.colorbar
42    if opt.marker is not None:
43      for plot in yeah.p:
44        plot.marker = opt.marker
45    if opt.title is not None:
46      for plot in yeah.p:
47        plot.title = opt.title
48
49    if opt.explore:
50      for cm in clb:
51       for plot in yeah.p:
52         plot.colorbar = cm
53         plot.title = cm
54       yeah.makeplot()
55    else:         
56      yeah.makeplot()
57
Note: See TracBrowser for help on using the repository browser.