Changeset 1774 in lmdz_wrf for trunk/tools/generic_tools.py


Ignore:
Timestamp:
Feb 13, 2018, 10:12:31 PM (7 years ago)
Author:
lfita
Message:

Testing to solve unsync problems....

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r1771 r1774  
    4949
    5050####### Content
    51 # angle_DegMinSec: Function to transform an angle to Degrees Minutes Seconds
    5251# ASCII_LaTeX: Function to transform from an ASCII character to LaTeX codification
    5352# ASCII_to: Function to provide the equivalence text to a given lenguage omitting certain characters
     
    7473# DateTimeStr_date: Function to transform a string date-time ([YYYY][MM][DD][HH][MI][SS] format) to a date object
    7574# datetimeStr_datetime: Function to transform a string date-time ([YYYY]-[MM]-[DD]_[HH]:[MI]:[SS] format) to a date object
    76 # DegMinSec_angle: Function to transform Degrees Minutes Seconds to an angle
    7775# dictionary_key: Function to provide the first key in a dictionay with a given value
    7876# dictionary_key_list: Function to provide the first key in a dictionary of lists with a given value
     
    149147# unitsdsDate: Function to know how many units of time are from a given pair of dates
    150148# vals_around: Function to provide the 3x3 values around a given j,i point
     149# xtrm_nx: Function to provide the extreme (a percentage above min,max) of a series of values
    151150
    152151def searchInlist(listname, nameFind):
     
    1261212611    return values
    1261312612
    12614 def angle_DegMinSec(angle):
    12615    """ Function to transform an angle to Degrees Minutes Seconds
    12616      angle= decimal angle to transform
    12617      >>> angle_DegMinSec(3.98765)
    12618      3 59 15.54
    12619      >>> angle_DegMinSec(-23.0025)
    12620      -23 0 9.0                         
    12621    """
    12622    fname = 'angle_DegMinSec'
    12623                                      
    12624    degv = int(abs(angle))
    12625    minv = int((abs(angle) - degv*1.)*60.)
    12626    secv = (abs(angle) - degv*1. - minv/60.)*3600.
    12627                                                  
    12628    if angle < 0.:
    12629        return -degv, minv, secv
    12630    else:
    12631        return degv, minv, secv
    12632 
    12633 def DegMinSec_angle(degv, minv, secv):
    12634    """ Function to transform Degrees Minutes Seconds to an angle
    12635      degv: value in degrees
    12636      minv: minutes of arc
    12637      secv: seconds of arc
    12638      >>> DegMinSec_angle(-23, 0, 9.0)
    12639      -23.0025
    12640    """
    12641    fname = 'DegMinSec_angle'
    12642                                      
    12643    angle = np.abs(degv) + np.abs(minv)/60. + np.abs(secv)/3600.
    12644                                                  
    12645    if degv < 0.:
    12646        return -angle
    12647    else:
    12648        return angle
    12649 
    1265012613#quit()
    1265112614
     12615
Note: See TracChangeset for help on using the changeset viewer.