[910] | 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 | # ----------------------------------------------------------------------- |
---|
| 7 | from optparse import OptionParser ### TBR by argparse |
---|
| 8 | from ppclass import pp |
---|
[977] | 9 | from ppplot import rainbow |
---|
[910] | 10 | # ----------------------------------------------------------------------- |
---|
| 11 | parser = OptionParser() |
---|
[917] | 12 | parser.add_option('-O','--out',action='store',dest='out',type="string",default="gui",help='Specify a new output format') |
---|
[933] | 13 | parser.add_option('-T','--title',action='store',dest='title',type="string",default=None,help='Give a new title') |
---|
[923] | 14 | parser.add_option('-K','--marker',action='store',dest='marker',type="string",default=None,help="[1D] Define a new marker") |
---|
| 15 | parser.add_option('-P','--proj',action='store',dest='proj',type="string",default=None,help='[2D] Define a new map projection') |
---|
[1050] | 16 | parser.add_option('-C','--colorbar',action='store',dest='colorbar',type="string",default=None,help="[2D] Define a new colormap") |
---|
[942] | 17 | parser.add_option('-E','--explore',action='store_true',dest='explore',default=False,help="[2D] Try many colormaps") |
---|
[910] | 18 | (opt,args) = parser.parse_args() |
---|
| 19 | # ----------------------------------------------------------------------- |
---|
[942] | 20 | clb = ["Greys","Blues","YlOrRd",\ |
---|
| 21 | "jet","spectral","hot",\ |
---|
| 22 | "RdBu","RdYlBu","Paired",\ |
---|
| 23 | "gist_ncar","gist_rainbow","gist_stern"] |
---|
| 24 | # ----------------------------------------------------------------------- |
---|
| 25 | |
---|
[910] | 26 | for files in args: |
---|
[942] | 27 | |
---|
[910] | 28 | yeah = pp() |
---|
[960] | 29 | yeah.quiet = True |
---|
[910] | 30 | yeah.defineplot(loadfile=files) |
---|
| 31 | yeah.out = opt.out |
---|
[942] | 32 | |
---|
[917] | 33 | if opt.proj is not None: |
---|
| 34 | for plot in yeah.p: |
---|
| 35 | plot.proj = opt.proj |
---|
[1050] | 36 | if opt.colorbar is not None: |
---|
| 37 | yeah.colorbar = opt.colorbar |
---|
[923] | 38 | for plot in yeah.p: |
---|
[1050] | 39 | plot.colorbar = opt.colorbar |
---|
[923] | 40 | if opt.marker is not None: |
---|
| 41 | for plot in yeah.p: |
---|
| 42 | plot.marker = opt.marker |
---|
[933] | 43 | if opt.title is not None: |
---|
| 44 | for plot in yeah.p: |
---|
| 45 | plot.title = opt.title |
---|
[910] | 46 | |
---|
[942] | 47 | if opt.explore: |
---|
| 48 | for cm in clb: |
---|
| 49 | for plot in yeah.p: |
---|
[1050] | 50 | plot.colorbar = cm |
---|
[942] | 51 | plot.title = cm |
---|
| 52 | yeah.makeplot() |
---|
| 53 | else: |
---|
| 54 | yeah.makeplot() |
---|
| 55 | |
---|