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='column for y axis') parser.add_option('-s', '--skip', action='store', dest='skiprows', type="int", default=0, help='skip first rows in file(s)') parser.add_option('-u', '--unique', action='store_true', dest='unique', default=False, help='case with one column only') parser = ppplot.opt(parser) # common options for plots parser = ppplot.opt1d(parser) # common options for plots (opt, args) = parser.parse_args() # plot object + options pl = ppplot.plot1d() # for all input files count = 0 for fff in args: # transfer options to plot object pl.transopt(opt, num=count) # load data var = np.transpose(np.loadtxt(fff, skiprows=opt.skiprows))
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
# inputs and options parser = OptionParser() parser.usage = \ ''' asciiplot.py [options] text file(s) -- default is col2 for field and col1 for coord -- this can be set with -x and -y options (or use --swap if applicable) -- one-column files are also supported ''' parser.add_option('-x','--colx',action='store',dest='colx',type="int",default=1,help='column for x axis') parser.add_option('-y','--coly',action='store',dest='coly',type="int",default=2,help='column for y axis') parser.add_option('-s','--skip',action='store',dest='skiprows',type="int",default=0,help='skip first rows in file(s)') parser.add_option('-u','--unique',action='store_true',dest='unique',default=False,help='case with one column only') parser = ppplot.opt(parser) # common options for plots parser = ppplot.opt1d(parser) # common options for plots (opt,args) = parser.parse_args() # plot object + options pl = ppplot.plot1d() # for all input files count = 0 for fff in args: # transfer options to plot object pl.transopt(opt,num=count) # load data var = np.transpose(np.loadtxt(fff,skiprows=opt.skiprows))