source: trunk/UTIL/PYTHON/myscript.py @ 578

Last change on this file since 578 was 569, checked in by acolaitis, 13 years ago

PYTHON
######

=========
myplot.py
=========

  • Added missing value handling for API files (+1e36)
  • Added check_localtime function that re-order the time axis in localtime mode

=========
planetoplot.py
=========

  • Corrected a problem when trying to plot a contour or unidim plot in localtime along a cyclic time axis (i.e. when the day was changing).

    one day is now numbered from 0 to 24 and the rest is either negative (below 0) or greater than 24.

  • Localtimes are no longer integers, which was causing problems when using files with more than 1 localtime per hour.
  • Corrected a very wierd bug where the asked value for --lon and --lat was changing when plotting along different files. This was due to a spooky pointer problem where the value of a variable was changing when an other one was changed !!!
  • Corrected a bug with localtimes where there was a drift in initial localtimes when using different files and when not using the --operation cat option.
  • Added the possibility to ask for the variable 'UV' (or 'uv' or 'uvmet' if using API) which will automatically compute the norm of horizontal winds 'U' and 'V' (or 'u' and 'v' or 'Um' and 'Vm' if using API). This also work when using reference file. This will only compute the norm if no variable with this name already exists in the file.
  • Added the possibility to call overcontours in plot with a reference file (--fref option) using the usual -w ... syntax. The overcontour will also be displayed on the "operation" plot, without being processed.
  • Added the possibility of specifying manually labels for unidim curves (see below)

=========
myscript.py
=========

  • New option --labels "label 1","label 2",......,"label N" will label in this order each curve of a multi-file unidim plot, with "label N" corresponding to file N.

=========
pp.py
=========

  • Added calls to API for reference file when using --fref so that the reference file is also processed.
File size: 8.8 KB
Line 
1def getparseroptions(parser):
2
3    ### I/O
4    parser.add_option('-f', '--file',   action='append',dest='file',     type="string",  default=None,  help='[NEEDED] filename. Append: different figures. Comma-separated: same figure (+ possible --operation). Regex OK: use -f "foo*" DONT FORGET QUOTES "" !!!!')
5    parser.add_option('--seevar',       action='store_true',dest='seevar',               default=False, help='display the list of variables in the file')
6    parser.add_option('-t', '--target', action='store',dest='tgt',       type="string",  default=None,  help='destination folder')
7    parser.add_option('-S', '--save',   action='store',dest='save',      type="string",  default="gui", help='save mode (gui,png,eps,svg,pdf,txt,html,avi) [gui]')
8    parser.add_option('-d', '--display',action='store_false',dest='display',             default=True,  help='do not pop up created images')
9    parser.add_option('-O','--output',  action='store',dest='out',       type="string",  default=None,  help='output file name')
10    parser.add_option('--rate',         action='store'     ,dest='rate', type="int",   default=None, help='output is a movie along Time dimension [None]')
11    parser.add_option('--quality',      action='store_true',dest='quality',            default=False,help='For movie mode: improves movie quality.(slower)')
12
13    ### WHAT I PLOT
14    parser.add_option('-v', '--var',    action='append',dest='var',      type="string",  default=None,  help='variable color-shaded')
15    parser.add_option('-w', '--with',   action='store',dest='var2',      type="string",  default=None,  help='variable contoured')
16    parser.add_option('-a', '--anomaly',action='store_true',dest='anomaly',              default=False, help='compute and plot relative anomaly in %')
17    parser.add_option('--mult',         action='store',dest='mult',      type="float",   default=1.,    help='multiplicative factor to plotted field (2718=log)')
18    parser.add_option('-m', '--min',    action='append',dest='vmin',     type="float",   default=None,  help='bounding minimum value [min]')   
19    parser.add_option('-M', '--max',    action='append',dest='vmax',     type="float",   default=None,  help='bounding maximum value [max]') 
20    parser.add_option('-H', '--hole',   action='store_true',dest='hole',                 default=False, help='holes above max and below min')
21    parser.add_option('--nolow',        action='store_true',dest='nolow',                default=False, help='do not plot low |values| [False]')
22    parser.add_option('--redope',       action='store',dest='redope',    type="string",  default=None,  help='REDuce OPErators: mint,maxt for the moment [None]')
23
24    ### VERTICAL INTERPOLATION
25    parser.add_option('-l', '--level',  action='store',dest='lvl',       type="string",  default="0",   help='level / start,stop,step (-i 2: p,Pa)(-i 3,4: z,km) [0]')
26    parser.add_option('-i', '--interp', action='store',dest='itp',       type="int",     default=None,  help='interpolation (2: p, 3: z-amr, 4:z-als, -1)')
27    parser.add_option('--intas',        action='store',dest='intas',     type="string",  default=None,  help='specify "mcs" or "tes" for gcm P interpolation grid')
28    parser.add_option('-N', '--no-api', action='store_true',dest='nocall',               default=False, help='do not recreate api file')
29
30    ### GENERIC GRAPHICS SETTINGS
31    parser.add_option('-c', '--color',  action='store',dest='clb',       type="string",  default="def", help='change colormap (also: nobar,onebar)')
32    parser.add_option('--div',          action='store',dest='ndiv',      type="int",     default=10,    help='number of divisions in colorbar [10]')
33    parser.add_option('--title',        action='store',dest='zetitle',   type="string",  default="fill",help='customize the whole title')
34    parser.add_option('-T', '--tiled',  action='store_true',dest='tile',                 default=False, help='draw a tiled plot (no blank zone)')
35    parser.add_option('--res',          action='store',dest='res',       type="float",   default=200.,  help='resolution for png outputs. --save png needed. [200.]')
36    parser.add_option('--trans',        action='store',dest='trans',     type="float",   default=1.,    help='shaded plot transparency, 0 to 1 (=opaque) [1]')
37    parser.add_option('--area',         action='store',dest='area',       type="string",   default=None,  help='area on the map to be plot [None]')
38    parser.add_option('--xlabel',       action='store',dest='xlab',       type="string",  default=None, help='customize the x-axis label')
39    parser.add_option('--ylabel',       action='store',dest='ylab',       type="string",  default=None, help='customize the y-axis label')
40    parser.add_option('--labels',       action='store',dest='labels',     type="string",  default=None, help='customize 1D curve labels. String separated by commas. [None]')
41
42    ### SPECIFIC FOR MAPPING [MAPMODE 1]
43    parser.add_option('-p', '--proj',   action='store',dest='proj',      type="string",  default=None,  help='projection')
44    parser.add_option('-b', '--back',   action='store',dest='back',      type="string",  default=None,  help='background image [None]')
45    parser.add_option('-W', '--winds',  action='store_true',dest='winds',                default=False, help='wind vectors [False]')
46    parser.add_option('-s', '--stride', action='store',dest='ste',       type="int",     default=3,     help='stride vectors [3]')
47    parser.add_option('-z', '--zoom',   action='store',dest='zoom',      type="float",   default=None,  help='zoom factor in %')
48    parser.add_option('--blat',         action='store',dest='blat',      type="int",     default=None,  help='reference lat (or bounding lat for stere) [computed]')
49    parser.add_option('--blon',         action='store',dest='blon',      type="int",     default=None,  help='reference lon [computed]')
50
51    ### SPECIFIC FOR SLICING [MAPMODE 0]
52    parser.add_option('--lat',          action='append',dest='slat',   type="string",  default=None, help='slices along lat. 2 comma-separated values: averaging')
53    parser.add_option('--lon',          action='append',dest='slon',   type="string",  default=None, help='slices along lon. 2 comma-separated values: averaging')
54    parser.add_option('--vert',         action='append',dest='svert',  type="string",  default=None, help='slices along vert. 2 comma-separated values: averaging') 
55    parser.add_option('--column',       action='store_true',dest='column',             default=False,help='changes --vert z1,z2 from MEAN to INTEGRATE along z')
56    parser.add_option('--time',         action='append',dest='stime',  type="string",  default=None, help='slices along time. 2 comma-separated values: averaging') 
57    parser.add_option('--xmax',         action='store',dest='xmax',    type="float",   default=None, help='max value for x-axis in contour-plots [max(xaxis)]')
58    parser.add_option('--ymax',         action='store',dest='ymax',    type="float",   default=None, help='max value for y-axis in contour-plots [max(yaxis)]')
59    parser.add_option('--xmin',         action='store',dest='xmin',    type="float",   default=None, help='min value for x-axis in contour-plots [min(xaxis)]')
60    parser.add_option('--ymin',         action='store',dest='ymin',    type="float",   default=None, help='min value for y-axis in contour-plots [min(yaxis)]')
61    parser.add_option('--inverty',      action='store_true',dest='inverty',            default=False,help='force decreasing values along y-axis (e.g. p-levels)')
62    parser.add_option('--logy',         action='store_true',dest='logy',               default=False,help='set y-axis to logarithmic')   
63    parser.add_option('--axtime',       action='store',dest='axtime',  type="string",  default=None, help='choose "ls","sol","lt" for time ref (1D or --time)')
64
65    ### OPERATIONS BETWEEN FILES
66    parser.add_option('--operation',    action='store',dest='operat',  type="string",  default=None,  help='operation to perform on input files given through -f. "+" or "-" acts on each input file by adding or substracting the ref file specified through --fref. "cat" acts on all input files in-a-row. "add_var" "sub_var" "mul_var" "div_var" acts on two variables.')
67    parser.add_option('--fref',         action='store',dest='fref',    type="string",  default=None,  help='reference namefile for the --operation option.')
68    parser.add_option('--mope',         action='store',dest='vminope', type="float",   default=0.,  help='bounding minimum value for inter-file operation')
69    parser.add_option('--Mope',         action='store',dest='vmaxope', type="float",   default=0.,  help='bounding maximum value for inter-file operation')
70    parser.add_option('--titleref',     action='store',dest='titref',  type="string",  default="fill",  help='title for the reference file. [title of fig (1)]')
71
72    ### SPECIAL
73    parser.add_option('--tsat',         action='store_true',dest='tsat',               default=False,help='convert temperature field T in Tsat-T using pressure')
74
75    return parser
Note: See TracBrowser for help on using the repository browser.