Changeset 932 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 23, 2016, 5:48:46 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing_tools.py
r931 r932 4032 4032 4033 4033 newvals = vals.copy() 4034 dv = False4034 dvx = False 4035 4035 if dxv is not None: 4036 4036 newdxv = dxv.copy() 4037 dvx = True 4038 else: 4039 newdxv = None 4040 dvy = False 4041 if dyv is not None: 4037 4042 newdyv = dyv.copy() 4038 dv = True 4039 else: 4040 newdxv = None 4043 dvy = True 4044 else: 4041 4045 newdyv = None 4042 4046 4043 dt = False4047 dtx = False 4044 4048 if dxt is not None: 4045 4049 newdxt = dxt.copy() 4050 dtx = True 4051 else: 4052 newdxt = None 4053 dty = False 4054 if dyt is not None: 4046 4055 newdyt = dyt.copy() 4047 dt = True 4048 else: 4049 newdxt = None 4056 dty = True 4057 else: 4050 4058 newdyt = None 4051 4059 4052 dl = False4060 dlx = False 4053 4061 if dxt is not None: 4054 4062 newdxl = list(dxl) 4063 dlx = True 4064 else: 4065 newdxl = None 4066 dly = False 4067 if dyt is not None: 4055 4068 newdyl = list(dyl) 4056 dl = True 4057 else: 4058 newdxl = None 4069 dly = True 4070 else: 4059 4071 newdyl = None 4060 4072 4061 dT = False4073 dTx = False 4062 4074 if dxt is not None: 4063 4075 newdxtit = str(dxtit) 4076 dTx = True 4077 else: 4078 newdxtit = None 4079 dTy = False 4080 if dyt is not None: 4064 4081 newdytit = str(dytit) 4065 dT = True 4066 else: 4067 newdxtit = None 4082 dTy = True 4083 else: 4068 4084 newdytit = None 4069 4085 … … 4074 4090 if transform == 'transpose': 4075 4091 newvals = np.transpose(newvals) 4076 if dv :4092 if dvx and dvy: 4077 4093 copy = newdxv.copy() 4078 4094 newdxv = np.transpose(newdyv) 4079 4095 newdyv = np.transpose(copy) 4080 if dt: 4096 else: 4097 print errormsg 4098 print ' ' + fname + ": it can not be '" + transform + "' without " +\ 4099 ' both dimxvals:', dxv, ' and dimyvals:', dyv, ' !!' 4100 quit(-1) 4101 if dtx and dtx: 4081 4102 copy = newdxt.copy() 4082 4103 newdxt = np.transpose(newdyt) 4083 4104 newdyt = np.transpose(copy) 4084 if dl: 4105 else: 4106 print errormsg 4107 print ' ' + fname + ": it can not be '" + transform + "' without " +\ 4108 ' both dimxtickvals:', dxt, ' and dimytickvals:', dyt, ' !!' 4109 quit(-1) 4110 if dlx and dly: 4085 4111 copy = list(newdxl) 4086 4112 newdxl = list(newdyl[::-1]) 4087 4113 newdyl = list(copy[::-1]) 4088 if dT: 4114 else: 4115 print errormsg 4116 print ' ' + fname + ": it can not be '" + transform + "' without " +\ 4117 ' both dimxlabels:', dxl, ' and dimylabels:', dyl, ' !!' 4118 quit(-1) 4119 if dTx and dTy: 4089 4120 copy = str(newdxtit) 4090 4121 newdxtit = str(newdytit) 4091 4122 newdytit = str(copy) 4123 else: 4124 print errormsg 4125 print ' ' + fname + ": it can not be '" + transform + "' without " +\ 4126 ' both dimx title:', dxtit, ' and dimytitle:', dytit, ' !!' 4127 quit(-1) 4092 4128 4093 4129 elif transform[0:4] == 'flip': … … 4117 4153 4118 4154 return newvals, newdxv, newdyv, newdxt, newdyt, newdxl, newdyl, newdxtit, newdytit 4155 4156 #mat = np.arange(15).reshape(3,5) 4157 #xvals = np.zeros((3,5), dtype=np.float) 4158 #yvals = np.zeros((3,5), dtype=np.float) 4159 #for i in range(5): 4160 # xvals[:,i] = -1.25 + i*0.5 4161 #for j in range(3): 4162 # yvals[j,:] = 40.25 + j*0.5 4163 #xticks = np.array([-1.25, -0.25, 0.25]) 4164 #yticks = np.array([40.25, 41.25]) 4165 #xticklab = ['1.25 W', '0.25 W', '0,25 E'] 4166 #yticklab = ['40.25 N', '41.25 N'] 4167 #xtit = 'Longitude' 4168 #ytit = 'Latitude' 4169 #nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT = transform(mat, 'transpose', \ 4170 # xvals, yvals, xticks, yticks, xticklab, yticklab, xtit, ytit) 4171 4172 #print nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT 4173 #quit() 4119 4174 4120 4175 def plot_2D_shadow_time(varsv,vnames,dimxv,dimyv,dimxu,dimyu,dimn,colorbar,vs,uts, \ … … 4606 4661 timlab = labes at the axis time 4607 4662 valu = units at the axes which is not time 4608 timeu = units at the axes which is nottime4663 timeu = units at the axes which is time 4609 4664 axist = which is the axis time 4610 4665 dimn= dimension names to plot … … 4638 4693 ## mpl.use('Agg') 4639 4694 ## import matplotlib.pyplot as plt 4640 fname = 'plot_2D_shadow_contour '4695 fname = 'plot_2D_shadow_contour_time' 4641 4696 4642 4697 if varsv == 'h': 4643 4698 print fname + '_____________________________________________________________' 4644 print plot_2D_shadow_contour .__doc__4699 print plot_2D_shadow_contour_time.__doc__ 4645 4700 quit() 4646 4701 4647 4702 if axist == 'x': 4648 dimxv = timv.copy() 4649 dimyv = valv.copy() 4650 else: 4651 dimxv = valv.copy() 4652 dimyv = timv.copy() 4703 dimxv0 = timv.copy() 4704 dimyv0 = valv.copy() 4705 dimxt0 = list(timpos) 4706 dimyt0 = None 4707 dimxl0 = list(timlab) 4708 dimyl0 = None 4709 else: 4710 dimxv0 = valv.copy() 4711 dimyv0 = timv.copy() 4712 dimxt0 = None 4713 dimyt0 = list(timpos) 4714 dimxl0 = None 4715 dimyl0 = list(timlab) 4716 4717 varsv, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl, dimxT, dimyT = transform(varsv, \ 4718 reva, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl) 4653 4719 4654 4720 if reva[0:4] == 'flip':
Note: See TracChangeset
for help on using the changeset viewer.