Changeset 479 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 12, 2015, 11:42:21 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r469 r479 870 870 lowthres: if [val] < [modval1]; val = [modval2] 871 871 upthres: if [val] > [modval1]; val = [modval2] 872 lowthres@oper: if [val] < [modval1]; val = [oper] (operation as [modval2],[modval3]) 873 upthres@oper: if [val] > [modval1]; val = [oper] (operation as [modval2],[modval3]) 872 874 potc: [val] ** [modval1] 873 875 """ … … 897 899 varVal2 = np.where(varVal[:] > float(valsS[1]), float(valsS[2]), varVal[:]) 898 900 varVal[:] = varVal2 901 elif modins == 'lowthres@oper': 902 if valS[2] == 'sumc': varVal2 = np.where(varVal[:] < float(valsS[1]), \ 903 varVal[:] + float(valsS[2]), varVal[:]) 904 elif valS[2] == 'subc': varVal2 = np.where(varVal[:] < float(valsS[1]), \ 905 varVal[:] - float(valsS[2]), varVal[:]) 906 elif valS[2] == 'mulc': varVal2 = np.where(varVal[:] < float(valsS[1]), \ 907 varVal[:] * float(valsS[2]), varVal[:]) 908 elif valS[2] == 'divc': varVal2 = np.where(varVal[:] < float(valsS[1]), \ 909 varVal[:] / float(valsS[2]), varVal[:]) 910 elif valS[2] == 'potc': varVal2 = np.where(varVal[:] < float(valsS[1]), \ 911 varVal[:] ** float(valsS[2]), varVal[:]) 912 else: 913 print errormsg 914 print ' ' + fname + ": Operation to modify values '" + modins + \ 915 "' is not defined !!' 916 quit(-1) 917 elif modins == 'upthres@oper': 918 if valS[2] == 'sumc': varVal2 = np.where(varVal[:] > float(valsS[1]), \ 919 varVal[:] + float(valsS[2]), varVal[:]) 920 elif valS[2] == 'subc': varVal2 = np.where(varVal[:] > float(valsS[1]), \ 921 varVal[:] - float(valsS[2]), varVal[:]) 922 elif valS[2] == 'mulc': varVal2 = np.where(varVal[:] > float(valsS[1]), \ 923 varVal[:] * float(valsS[2]), varVal[:]) 924 elif valS[2] == 'divc': varVal2 = np.where(varVal[:] > float(valsS[1]), \ 925 varVal[:] / float(valsS[2]), varVal[:]) 926 elif valS[2] == 'potc': varVal2 = np.where(varVal[:] > float(valsS[1]), \ 927 varVal[:] ** float(valsS[2]), varVal[:]) 928 else: 929 print errormsg 930 print ' ' + fname + ": Operation to modify values '" + modins + \ 931 "' is not defined !!' 932 quit(-1) 899 933 elif modins == 'potc': 900 934 varVal[:] = varVal[:] ** modval 901 935 else: 902 936 print errormsg 903 print ' valmodoper: Operation to modify values ' + modins + ' is not defined !!!'904 print errormsg937 print ' ' + fname + ": Operation to modify values '" + modins + \ 938 "' is not defined !!' 905 939 quit(-1) 906 940
Note: See TracChangeset
for help on using the changeset viewer.