Changeset 1520 in lmdz_wrf
- Timestamp:
- Apr 12, 2017, 12:58:12 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1513 r1520 10166 10166 'pot': powering with matB (matA ** matB) 10167 10167 'potc',[modval1]: [val] ** [modval1] 10168 'repl',[modval1]: replace values of matA with values from matB except matB = [modval1] 10169 'replbig',[modval1]: replace values of matA with values from matB except matB > [modval1] 10170 'repless',[modval1]: replace values of matA with values from matB except matB < [modval1] 10168 10171 'sub': substracting matB to matA (matA - matB) 10169 10172 'subc',[modval1]: remove [modval1] … … 10293 10296 Lopn = {'add': '+', 'addc': '+', 'div': '/', 'divc': '/', 'inv': '^(-1)', \ 10294 10297 'lowthres': '<', 'mul': '*', 'mulc': '*', 'pot': '^', 'potc': '^', \ 10295 'sub': '-', 'subc': '-', 'upthres': '<'} 10298 'repl': 'repl_excpt', 'replbig': 'repl_excpt_bigger', \ 10299 'repless': 'repl_excpt_less', 'sub': '-', 'subc': '-', 'upthres': '<'} 10300 # Operations by constant value 10296 10301 Lopnc = {'addc': '+', 'divc': '/', 'inv': '^{-1)', 'mulc': '*', 'potc': '^', \ 10297 'subc': '-'} 10298 10302 'repl': 'repl_excpt', 'replbig': 'repl_excpt_bigger', \ 10303 'repless': 'repl_excpt_less', 'subc': '-'} 10304 10305 # Available operations 10299 10306 opavail = ['add', 'addc', 'centerderiv', 'div', 'divc', 'forwrdderiv', 'inv', \ 10300 'lowthres', 'lowthres@oper', 'mul', 'mulc', 'pot', 'potc', ' sub', 'subc',\10301 ' upthres', 'upthres@oper']10307 'lowthres', 'lowthres@oper', 'mul', 'mulc', 'pot', 'potc', 'repl', 'replbig', \ 10308 'repless', 'sub', 'subc', 'upthres', 'upthres@oper'] 10302 10309 opavailc = ['addc', 'divc', 'inv', 'mulc', 'potc', 'subc'] 10303 10310 … … 10387 10394 value1 = retype(opN.split(',')[1], valtype) 10388 10395 Lopn['potc'] = '^' + str(value1) 10396 elif opN[0:4] == 'repl' and opN.split(',')[0] == 'repl': 10397 opn = 'repl' 10398 value1 = retype(opN.split(',')[1], valtype) 10399 Lopn['repl'] = 'repl_excpt(' + str(value1) + ')' 10400 elif opN[0:7] == 'replbig': 10401 opn = 'replbig' 10402 value1 = retype(opN.split(',')[1], valtype) 10403 Lopn['replbig'] = 'repl_excpt(<' + str(value1) + ')' 10404 elif opN[0:7] == 'repless': 10405 opn = 'repless' 10406 value1 = retype(opN.split(',')[1], valtype) 10407 Lopn['repless'] = 'repl_excpt(>' + str(value1) + ')' 10389 10408 elif opN[0:4] == 'subc': 10390 10409 opn = 'subc' … … 10587 10606 elif opn == 'potc': 10588 10607 newmat = matA ** value1 10608 elif opn == 'repl': 10609 newmat = np.where(matB == value1, matA, matB) 10610 elif opn == 'replbig': 10611 newmat = np.where(matB > value1, matA, matB) 10612 elif opn == 'repless': 10613 newmat = np.where(matB < value1, matA, matB) 10589 10614 elif opn == 'sub': 10590 10615 newmat = matA - matB
Note: See TracChangeset
for help on using the changeset viewer.