Changeset 2519 in lmdz_wrf
- Timestamp:
- May 9, 2019, 12:53:46 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2517 r2519 182 182 # characteristics of the number 183 183 # Ntchar: Function to repeat a number of times a given string 184 # ntimesHval_inlist: Function to count how many times a list have a value with a giving header 184 185 # num_chainSnum: Function to pass a value to a `ChainStrNum' number 185 186 # num_ordinal: Function to provide the ordinal of a given number, language, format and gender … … 16699 16700 return newtimevals 16700 16701 16702 def ntimesHval_inlist(listv,Hval): 16703 """ Function to count how many times a list have a value with a giving header 16704 listv: list of values 16705 Hval: headr to check 16706 >>> ntimesHval_inlist(['ABC1', 'AB1', 'ABC2', 'ABC3'], 'ABC') 16707 3 16708 """ 16709 fname = 'ntimesHval_inlist' 16710 16711 Ntimes = 0 16712 16713 LHval=len(Hval) 16714 16715 for lv in listv: 16716 if lv[0:LHval] == Hval: Ntimes = Ntimes + 1 16717 16718 return Ntimes 16719 16701 16720 #quit() 16702 16721
Note: See TracChangeset
for help on using the changeset viewer.