type="int", default=1, help="Load data every sz grid points over z dimension") parser.add_option('--st', action='store', dest='st', type="int", default=1, help="Load data every st grid points over t dimension") parser.add_option('--useindex', action='store_true', dest="useindex", default=False, help="Use index for arrays and not values of dimensions") # plot options --> upper case. see ppplot. parser = ppplot.opt(parser) parser = ppplot.opt1d(parser) parser = ppplot.opt2d(parser) ########################### (opt, args) = parser.parse_args() # remains G R if (len(args) == 0): parser.print_version() ###################################### # get arguments (one or several files) ###################################### if args is None: print "Stop here! I need file(s) as argument(s)!" exit() else:
############## ## script options from optparse import OptionParser ### TBR by argparse parser = OptionParser() parser.add_option('-v','--var',action='store',dest='var',type="string",default="ps",help="var (default: ps)") parser.add_option('-y','--lat',action='store',dest='y',type="string",default="0.",help="y (lat, default: 0)") parser.add_option('-z','--vert',action='store',dest='z',type="string",default="0.",help="z (vert, default: 0)") parser.add_option('-u','--unit',action='store',dest='unit',type='string',default="time unit",help="time unit (spectra in UNIT^-1, default: time unit)") parser.add_option('-d','--dt',action='store',dest='dt',type="float",default=None,help="in FILE, one data point each time UNIT (default: 1)") parser.add_option('-o','--output',action='store',dest='output',type='string',default=None,help="name of png output (gui if None)") parser.add_option('--reldis',action='store_true',dest='reldis',default=False,help="add dispersion relationship") parser.add_option('--log',action='store_true',dest='log',default=False,help="set log field") ## get planetoplot-like options parser = ppplot.opt(parser) # common options for plots parser = ppplot.opt2d(parser) # common options for plots (opt,args) = parser.parse_args() ## input file infile = args[0] ## customize default behaviour for this script if opt.colorbar is None: opt.colorbar = "CMRmap" else: opt.colorbar = opt.colorbar[0] # if opt.ylabel is None: opt.ylabel = r"frequency $\sigma$ (cycles per "+opt.unit+")" #
parser.add_option('-i','--vecx',action='store',dest='vecx',type="string",default=None,help="one 'variable' for wind vector x component") parser.add_option('-j','--vecy',action='store',dest='vecy',type="string",default=None,help="one 'variable' for wind vector y component") parser.add_option('-m','--mult',action='store',dest='mult',type="float",default=None,help="multiplicative factor on field") parser.add_option('-a','--add',action='store',dest='add',type="float",default=None,help="additive factor on field") parser.add_option('-o','--output',action='store',dest='filename',type="string",default=None,help="name of output files") parser.add_option('-d','--directory',action='store',dest='folder',type="string",default="./",help="directory of output files") parser.add_option('-s','--changetime',action='store',dest='changetime',type="string",default=None,\ help="transformation on time axis : [None] | correctls | mars_sol2ls | mars_dayini | mars_meso_ls | mars_meso_sol | mars_meso_utc | mars_meso_lt ") parser.add_option('-p','--print',action='store_true',dest='savtxt',default=False,help="[1D] output field+coord in an ASCII file") parser.add_option('--sx',action='store',dest='sx',type="int",default=1,help="Load data every sx grid points over x dimension") parser.add_option('--sy',action='store',dest='sy',type="int",default=1,help="Load data every sy grid points over y dimension") parser.add_option('--sz',action='store',dest='sz',type="int",default=1,help="Load data every sz grid points over z dimension") parser.add_option('--st',action='store',dest='st',type="int",default=1,help="Load data every st grid points over t dimension") parser.add_option('--useindex',action='store_true',dest="useindex",default=False,help="Use index for arrays and not values of dimensions") # plot options --> upper case. see ppplot. parser = ppplot.opt(parser) parser = ppplot.opt1d(parser) parser = ppplot.opt2d(parser) ########################### (opt,args) = parser.parse_args() # remains G R if (len(args) == 0): parser.print_version() ###################################### # get arguments (one or several files) ###################################### if args is None: print "Stop here! I need file(s) as argument(s)!" ; exit() else: files = args
help="in FILE, one data point each time UNIT (default: 1)", ) parser.add_option( "-o", "--output", action="store", dest="output", type="string", default=None, help="name of png output (gui if None)", ) parser.add_option("--reldis", action="store_true", dest="reldis", default=False, help="add dispersion relationship") parser.add_option("--log", action="store_true", dest="log", default=False, help="set log field") ## get planetoplot-like options parser = ppplot.opt(parser) # common options for plots parser = ppplot.opt2d(parser) # common options for plots (opt, args) = parser.parse_args() ## input file infile = args[0] ## customize default behaviour for this script if opt.colorbar is None: opt.colorbar = "CMRmap" else: opt.colorbar = opt.colorbar[0] # if opt.ylabel is None: opt.ylabel = r"frequency $\sigma$ (cycles per " + opt.unit + ")" #