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