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

Last change on this file since 969 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: 2.2 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.quiet = True
29    yeah.defineplot(loadfile=files)
30    yeah.out = opt.out
31
32    if opt.proj is not None:
33      for plot in yeah.p:
34        plot.proj = opt.proj
35    if opt.colorb is not None:
36      for plot in yeah.p:
37        plot.colorb = opt.colorb
38    if opt.marker is not None:
39      for plot in yeah.p:
40        plot.marker = opt.marker
41    if opt.title is not None:
42      for plot in yeah.p:
43        plot.title = opt.title
44
45    if opt.explore:
46      for cm in clb:
47       for plot in yeah.p:
48         plot.colorb = cm
49         plot.title = cm
50       yeah.makeplot()
51    else:         
52      yeah.makeplot()
53
Note: See TracBrowser for help on using the repository browser.