Changeset 2733 in lmdz_wrf
- Timestamp:
- Oct 25, 2019, 6:34:17 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2732 r2733 175 175 # a list of type of values 176 176 # list_norepeatcombos: Function to all possible (Num-1)-combinations of a Num values without repetitions 177 # list_rmchar: Function to remove a list of characters from its values 177 178 # lstring_values: Function to provide a new list-string from a string which is a list of word separated by a character if some values are repeated they are not included 178 179 # lonlat_dist: Function to provide the distance in m between two lon,lat coordinates … … 17378 17379 return stations 17379 17380 17381 def list_rmchar(listv, rmchr): 17382 """ Function to remove a list of characters from its values 17383 listv: list of values 17384 rmchr: list of characters to remove 17385 >>> list_rmchar([' ', ' ', ' Ezeiza', ' Aero '], [' ']) 17386 ['Ezeiza', 'Aero'] 17387 """ 17388 fname = 'list_rmchar' 17389 17390 newlist = [] 17391 Nl = len(listv) 17392 Nrm = len(rmchr) 17393 for iv in range(Nl): 17394 Sv = str(listv[iv]) 17395 for ic in range(Nrm): 17396 Sv = Sv.replace(rmchr[ic],'') 17397 if len(Sv) > 0: newlist.append(Sv) 17398 17399 return newlist 17400 17380 17401 #quit() 17381 17402
Note: See TracChangeset
for help on using the changeset viewer.