Changeset 350 for trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/myplot.py
- Timestamp:
- Nov 6, 2011, 9:28:12 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/myplot.py
r349 r350 68 68 output = input 69 69 error = False 70 ### this is needed to cope the case where d4,d3,d2,d1 are single integers and not arrays70 #### this is needed to cope the case where d4,d3,d2,d1 are single integers and not arrays 71 71 if d4 is not None and not isinstance(d4, np.ndarray): d4=[d4] 72 72 if d3 is not None and not isinstance(d3, np.ndarray): d3=[d3] … … 77 77 if d2 >= shape[0]: error = True 78 78 elif d1 >= shape[1]: error = True 79 elif d1 is not None and d2 is not None: output = input[d2,d1]80 elif d1 is not None: output = input[:,d1]81 elif d2 is not None: output = input[d2,:]79 elif d1 is not None and d2 is not None: output = mean(input[d2,:],axis=0); output = mean(output[d1],axis=0) 80 elif d1 is not None: output = mean(input[:,d1],axis=1) 81 elif d2 is not None: output = mean(input[d2,:],axis=0) 82 82 elif dimension == 3: 83 83 if max(d4) >= shape[0]: error = True 84 84 elif max(d2) >= shape[1]: error = True 85 85 elif max(d1) >= shape[2]: error = True 86 elif d4 is not None and d2 is not None and d1 is not None: output = input[d4,d2,d1] 86 elif d4 is not None and d2 is not None and d1 is not None: 87 output = mean(input[d4,:,:],axis=0); output = mean(output[d2,:],axis=0); output = mean(output[d1],axis=0) 87 88 elif d4 is not None and d2 is not None: output = mean(input[d4,:,:],axis=0); output=mean(output[d2,:],axis=0) 88 89 elif d4 is not None and d1 is not None: output = mean(input[d4,:,:],axis=0); output=mean(output[:,d1],axis=1) … … 96 97 elif max(d2) >= shape[2]: error = True 97 98 elif max(d1) >= shape[3]: error = True 98 elif d4 is not None and d3 is not None and d2 is not None and d1 is not None: output = input[d4,d3,d2,d1] 99 elif d4 is not None and d3 is not None and d2 is not None: output = input[d4,d3,d2,:] 100 elif d4 is not None and d3 is not None and d1 is not None: output = input[d4,d3,:,d1] 101 elif d4 is not None and d2 is not None and d1 is not None: output = input[d4,:,d2,d1] 102 elif d3 is not None and d2 is not None and d1 is not None: output = input[:,d3,d2,d1] 99 elif d4 is not None and d3 is not None and d2 is not None and d1 is not None: 100 output = mean(input[d4,:,:,:],axis=0); output = mean(output[d3,:,:],axis=0); output = mean(output[d2,:],axis=0); output = mean(output[d1],axis=0) 101 elif d4 is not None and d3 is not None and d2 is not None: 102 output = mean(input[d4,:,:,:],axis=0); output = mean(output[d3,:,:],axis=0); output = mean(output[d2,:],axis=0) 103 elif d4 is not None and d3 is not None and d1 is not None: 104 output = mean(input[d4,:,:,:],axis=0); output = mean(output[d3,:,:],axis=0); output = mean(output[:,d1],axis=1) 105 elif d4 is not None and d2 is not None and d1 is not None: 106 output = mean(input[d4,:,:,:],axis=0); output = mean(output[:,d2,:],axis=1); output = mean(output[:,d1],axis=1) 107 elif d3 is not None and d2 is not None and d1 is not None: 108 output = mean(input[:,d3,:,:],axis=1); output = mean(output[:,d2,:],axis=1); output = mean(output[:,d1],axis=1) 103 109 elif d4 is not None and d3 is not None: output = mean(input[d4,:,:,:],axis=0); output = mean(output[d3,:,:],axis=0) 104 110 elif d4 is not None and d2 is not None: output = mean(input[d4,:,:,:],axis=0); output = mean(output[:,d2,:],axis=1) … … 107 113 elif d3 is not None and d1 is not None: output = mean(input[:,d3,:,:],axis=1); output = mean(output[:,:,d1],axis=0) 108 114 elif d2 is not None and d1 is not None: output = mean(input[:,:,d2,:],axis=2); output = mean(output[:,:,d1],axis=2) 109 elif d1 is not None: output = input[:,:,:,d1]110 elif d2 is not None: output = input[:,:,d2,:]111 elif d3 is not None: output = input[:,d3,:,:]112 elif d4 is not None: output = input[d4,:,:,:]115 elif d1 is not None: output = mean(input[:,:,:,d1],axis=3) 116 elif d2 is not None: output = mean(input[:,:,d2,:],axis=2) 117 elif d3 is not None: output = mean(input[:,d3,:,:],axis=1) 118 elif d4 is not None: output = mean(input[d4,:,:,:],axis=0) 113 119 dimension = np.array(output).ndim 114 120 shape = np.array(output).shape … … 801 807 shape = what_I_plot.shape 802 808 if indextime is None: 809 print "axis is time" 803 810 x = time 804 811 count = count+1 805 812 if indexlon is None: 813 print "axis is lon" 806 814 if count == 0: x = lon 807 815 else: y = lon 808 816 count = count+1 809 817 if indexlat is None: 818 print "axis is lat" 810 819 if count == 0: x = lat 811 820 else: y = lat 812 821 count = count+1 813 822 if indexvert is None and dim0 is 4: 823 print "axis is vert" 814 824 if vertmode == 0: # vertical axis is as is (GCM grid) 815 825 if count == 0: x=range(len(vert)) … … 822 832 x = array(x) 823 833 y = array(y) 834 print "what_I_plot.shape", what_I_plot.shape 835 print "x.shape, y.shape", x.shape, y.shape 824 836 if len(shape) == 1: 825 if shape != len(x): 837 print shape[0] 838 if shape[0] != len(x): 826 839 print "WARNING HERE !!!" 827 840 x = y
Note: See TracChangeset
for help on using the changeset viewer.