Changeset 2490 in lmdz_wrf


Ignore:
Timestamp:
May 1, 2019, 4:28:49 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `coldec_hex': Function to pas a decimal ([r,g,b]; [0.,1.]) color to hexadecimal (#[RR][GG][BB], 00-64, 0A-FF)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic.py

    r2489 r2490  
    2323# ASCIIfile_stats: Function to provide the statistics of a series of values from an ASCII file
    2424# coincident_CFtimes: Function to make coincident times for two different sets of CFtimes
     25# coldec_hex: Function to pas a decimal ([r,g,b]; [0.,1.]) color to hexadecimal (#[RR][GG][BB], 00-64, 0A-FF)
    2526# count_cond: Function to count values of a variable which attain a condition
    2627# create_LateX_figs: Function to create a LaTeX from a folder with multiple plots from different values
     
    5455
    5556# List of available operations
    56 operations=['ASCIIfile_stats', 'coincident_CFtimes', 'count_cond',                   \
     57operations=['ASCIIfile_stats', 'coincident_CFtimes', 'coldec_hex', 'count_cond',     \
    5758  'create_LateX_figs', 'datetimeStr_conversion', 'get_right_CFtimeunits',            \
    5859  'grid_combinations', 'inf_operSlist',                                              \
     
    9394## e.g. # generic.py -o create_LateX_figs -S '/home/lluis/estudios/FPS_ALPS/additional/IOP/analysis/figs,WindRose_obs_@SkewT-logP_obs_ta-tda@SkewT-logP_obs_evol@WindRose_obs-sim_step@SkewT-logP_obs-sim_step@SkewT-logP_obs-sim_evol,10868@16080@16144@16546,png'
    9495## e.g. # generic.py -o get_right_CFtimeunits -S 'minutes!since!1-1-1'
     96## e.g. # generic.py -o coldec_hex -S 0.545,0.352,0.
    9597
    9698operationnames = "'" + gen.numVector_String(operations, "', '") + "'"
     
    153155        print gen.coincident_CFtimes(vals0, vals[1], vals[2])
    154156
     157elif oper == 'coldec_hex':
     158    Nvals = 3
     159    vals = opts.values.split(cS)
     160    if vals[0] == 'h':
     161        print gen.coldec_hex.__doc__
     162        quit(-1)
     163    else:
     164        if len(vals) != Nvals:
     165            print errormsg
     166            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
     167              len(vals), ' has passed!!'
     168            print gen.coldec_hex.__doc__
     169            quit(-1)
     170        valsF = np.array(vals, dtype=np.float)
     171        print gen.coldec_hex(valsF)
     172
    155173elif oper == 'count_cond':
    156174    Nvals = 3
     
    169187        print gen.count_cond(np.array(vals[0].split(cV), dtype=np.float),           \
    170188          np.float(vals[1]), vals[2])
    171 
    172189
    173190elif oper == 'create_LateX_figs':
Note: See TracChangeset for help on using the changeset viewer.