Changeset 2706 in lmdz_wrf


Ignore:
Timestamp:
Sep 19, 2019, 1:39:07 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `DegMinSec_angle': Function to transform Degrees Minutes Seconds to an angle
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic.py

    r2490 r2706  
    2727# create_LateX_figs: Function to create a LaTeX from a folder with multiple plots from different values
    2828# datetimeStr_conversion: Function to transform a string date to an another date object
     29# DegMinSec_angle: Function to transform Degrees Minutes Seconds to an angle
    2930# get_right_CFtimeunits: Function to get the right CFtime units from any given format
    3031# grid_combinations: Function to provide all the possible grid points combination for a given pair of values
     
    5657# List of available operations
    5758operations=['ASCIIfile_stats', 'coincident_CFtimes', 'coldec_hex', 'count_cond',     \
    58   'create_LateX_figs', 'datetimeStr_conversion', 'get_right_CFtimeunits',            \
    59   'grid_combinations', 'inf_operSlist',                                              \
     59  'create_LateX_figs', 'datetimeStr_conversion', 'DegMinSec_angle',                  \
     60  'get_right_CFtimeunits', 'grid_combinations', 'inf_operSlist',                     \
    6061  'interpolate_locs', 'latex_fig_array', 'list_operations', 'PolyArea',              \
    6162  'radial_points', 'radius_dist',                                                    \
     
    9596## e.g. # generic.py -o get_right_CFtimeunits -S 'minutes!since!1-1-1'
    9697## e.g. # generic.py -o coldec_hex -S 0.545,0.352,0.
     98## e.g. # generic.py -o DegMinSec_angle  -S 35,10,21
    9799
    98100operationnames = "'" + gen.numVector_String(operations, "', '") + "'"
     
    251253#'days_period'
    252254
     255elif oper == 'DegMinSec_angle':
     256    Nvals = 3
     257    vals = opts.values.split(cS)
     258    if vals[0] == 'h':
     259        print gen.DegMinSec_angle.__doc__
     260        quit(-1)
     261    else:
     262        if len(vals) != Nvals:
     263            print errormsg
     264            print '  ' + main + ": operation '" + oper + "' requires", Nvals, 'and', \
     265              len(vals), ' has passed!!'
     266            print gen.DegMinSec_angle.__doc__
     267            quit(-1)
     268        vals0 = np.float(vals[0])
     269        vals1 = np.float(vals[1])
     270        vals2 = np.float(vals[2])
     271       
     272        print gen.DegMinSec_angle(vals0, vals1, vals2)
     273
    253274elif oper == 'get_right_CFtimeunits':
    254275    Nvals = 1
Note: See TracChangeset for help on using the changeset viewer.