Changeset 2027 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Aug 6, 2018, 3:47:02 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `inf_operSlist': Function to provide information from a string as a list separated by a given character followig a given operation and a set of values
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic.py

    r1919 r2027  
    2727# grid_combinations: Function to provide all the possible grid points combination for a given pair of values
    2828#   x,y= pair of grid points
     29# inf_operSlist: Function to provide information from a string as a list separated by
     30#   a given character followig a given operation and a set of values
    2931# interpolate_locs: Function to provide interpolate locations on a given axis
    3032# PolyArea: Function to compute the area of the polygon following 'Shoelace formula'
     
    5254operations=['ASCIIfile_stats', 'coincident_CFtimes', 'count_cond',                   \
    5355  'datetimeStr_conversion',                                                          \
    54   'grid_combinations',                                                               \
     56  'grid_combinations', 'inf_operSlist',                                              \
    5557  'interpolate_locs', 'latex_fig_array', 'list_operations', 'PolyArea',              \
    5658  'radial_points', 'radius_dist',                                                    \
     
    8688## e.g. # generic.py -o WRFsetup -S '/home/lluis/estudios/RELAMPAGO/SimCoor/UBA/namelist.input@/home/lluis/estudios/RELAMPAGO/SimCoor/SMN/namelist.input@/home/lluis/estudios/RELAMPAGO/SimCoor/NOA-IERSD/namelist.input@/home/lluis/estudios/RELAMPAGO/SimCoor/UBAmili/namelist.input,basic,textabrow'
    8789## e.g. # generic.py -o ASCIIfile_stats -S times_CDXWRF1.dat,#,R
     90## e.g. # generic.py -o inf_operSlist -S '-98.21:1.2:3.45:100.1:34321.1,threshold,:,3.'
    8891
    8992operationnames = "'" + gen.numVector_String(operations, "', '") + "'"
     
    211214        objf.close()
    212215 
     216elif oper == 'inf_operSlist':
     217    Nvals = 4
     218    vals = opts.values.split(cS)
     219    if vals[0] == 'h':
     220        print gen.inf_operSlist.__doc__
     221        quit(-1)
     222    else:
     223        if len(vals) != Nvals:
     224            print errormsg
     225            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
     226              len(vals), ' has passed!!'
     227            print gen.inf_operSlist.__doc__
     228            quit(-1)
     229        vals0 = vals[0]
     230        vals1 = vals[1]
     231        vals2 = vals[2]
     232        vals3 = vals[3]
     233
     234        print gen.inf_operSlist(vals0, vals1, char=vals2, values=vals3)
     235 
    213236elif oper == 'interpolate_locs':
    214237    Nvals = 3
Note: See TracChangeset for help on using the changeset viewer.