##// END OF EJS Templates
UPDATE TEST ZDR
avaldezp -
r1586:8b29f13d0a2c
parent child
Show More
@@ -121,13 +121,13 class Readsophy():
121 if count==1:
121 if count==1:
122 fig = plt.figure(figsize=(8,6))
122 fig = plt.figure(figsize=(8,6))
123 plt.pcolormesh(x,y,z,cmap =cmap, vmin = vmin, vmax = vmax)
123 plt.pcolormesh(x,y,z,cmap =cmap, vmin = vmin, vmax = vmax)
124 title = 'Sophy Plot'+label+"-"+ my_time+" "+mode+" "+grado
124 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado+" NΒ° "+str(count)
125 t = plt.title(title, fontsize=12,y=1.05)
125 t = plt.title(title, fontsize=12,y=1.05)
126 cbar = plt.colorbar()
126 cbar = plt.colorbar()
127 cbar.set_label(label+'[' + unit + ']')
127 cbar.set_label(label+'[' + unit + ']')
128 else:
128 else:
129 plt.pcolormesh(x,y,z, cmap =cmap, vmin = vmin, vmax = vmax)
129 plt.pcolormesh(x,y,z, cmap =cmap, vmin = vmin, vmax = vmax)
130 title = 'Sophy Plot'+label+"-"+ my_time+" "+mode+" "+grado
130 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado+" NΒ° "+str(count)
131 t = plt.title(title, fontsize=12,y=1.05)
131 t = plt.title(title, fontsize=12,y=1.05)
132 cbar = plt.colorbar()
132 cbar = plt.colorbar()
133 cbar.set_label(label+'[' + unit + ']')
133 cbar.set_label(label+'[' + unit + ']')
@@ -135,8 +135,8 class Readsophy():
135 def plot_PROFILE(self,count,z,y,my_time,label,mode,grado):
135 def plot_PROFILE(self,count,z,y,my_time,label,mode,grado):
136 if count==1:
136 if count==1:
137 fig = plt.figure(figsize=(8,6))
137 fig = plt.figure(figsize=(8,6))
138 plt.plot(z,y)
138 plt.plot(numpy.nanmean(z,1),y)
139 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado
139 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado+" NΒ° "+str(count)
140 t = plt.title(title, fontsize=12,y=1.05)
140 t = plt.title(title, fontsize=12,y=1.05)
141 plt.ylim(0,self.range+1)
141 plt.ylim(0,self.range+1)
142 plt.xlabel(label)
142 plt.xlabel(label)
@@ -145,9 +145,11 class Readsophy():
145 plt.xlim(-1,3)
145 plt.xlim(-1,3)
146 if self.variable=='D':
146 if self.variable=='D':
147 plt.xlim(-10,10)
147 plt.xlim(-10,10)
148 if self.variable=='Z':
149 plt.xlim(-20,80)
148 else:
150 else:
149 plt.plot(z,y)
151 plt.plot(numpy.nanmean(z,1),y)
150 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado
152 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado+" NΒ° "+str(count)
151 t = plt.title(title, fontsize=12,y=1.05)
153 t = plt.title(title, fontsize=12,y=1.05)
152 plt.ylim(0,self.range+1)
154 plt.ylim(0,self.range+1)
153 plt.xlabel(label)
155 plt.xlabel(label)
@@ -156,6 +158,8 class Readsophy():
156 plt.xlim(-1,3)
158 plt.xlim(-1,3)
157 if self.variable=='D':
159 if self.variable=='D':
158 plt.xlim(-10,10)
160 plt.xlim(-10,10)
161 if self.variable=='Z':
162 plt.xlim(-20,80)
159
163
160 def save_PIC(self,count,time_save):
164 def save_PIC(self,count,time_save):
161 if count ==1:
165 if count ==1:
@@ -172,7 +176,8 class Readsophy():
172 filename = "SOPHY"+"_"+time_save+"_"+"E."+self.grado+"_"+self.variable+str(self.range)+".png"
176 filename = "SOPHY"+"_"+time_save+"_"+"E."+self.grado+"_"+self.variable+str(self.range)+".png"
173 plt.savefig(filesavepath+filename)
177 plt.savefig(filesavepath+filename)
174
178
175 def seleccion_roHV_min(self,count,z,arr):
179 def seleccion_roHV_min(self,count,z,y,arr_):
180 ##print("y",y)
176 if self.variable=='R':
181 if self.variable=='R':
177 len_Z= z.shape[1]
182 len_Z= z.shape[1]
178 min_CC=numpy.zeros(len_Z)
183 min_CC=numpy.zeros(len_Z)
@@ -180,27 +185,69 class Readsophy():
180 for i in range(len_Z):
185 for i in range(len_Z):
181 tmp=numpy.nanmin(z[:,i])
186 tmp=numpy.nanmin(z[:,i])
182 tmp_index = numpy.nanargmin((z[:,i]))
187 tmp_index = numpy.nanargmin((z[:,i]))
183
188 if tmp <0.5:
184 if tmp <0.6:
185 tmp_index= numpy.nan
189 tmp_index= numpy.nan
186 value = numpy.nan
190 value = numpy.nan
187 else:
191 else:
188 value= new_heightList[tmp_index]
192 value= y[tmp_index]
189 min_CC[i] =value
193 min_CC[i] =value
190 moda_,count_m_ = stats.mode(min_CC)
194 moda_,count_m_ = stats.mode(min_CC)
191 print(moda_)
195 #print("MODA",moda_)
192 for i in range(len_Z):
196 for i in range(len_Z):
193 if min_CC[i]>moda_[0]+0.15 or min_CC[i]<moda_[0]-0.15:
197 if min_CC[i]>moda_[0]+0.15 or min_CC[i]<moda_[0]-0.15:
194 min_CC[i]=numpy.nan
198 min_CC[i]=numpy.nan
195
199 print("MIN_CC",min_CC)
196 min_index_CC=min_CC/0.06
200 print("y[0]",y[0])
201 min_index_CC=((min_CC-y[0])/0.06)
197 if count == 0:
202 if count == 0:
198 arr_ = min_index_CC
203 arr_ = min_index_CC
199 else:
204 else:
200 arr_ = numpy.append(arr_,min_index_CC)
205 arr_ = numpy.append(arr_,min_index_CC)
206 print("arr_",min_index_CC)
201 return arr_
207 return arr_
202 else:
208 else:
203 print("Operation JUST for roHV ")
209 print("Operation JUST for roHV - EXIT ")
210 exit()
211
212 def pp_BB(self,count,x,y,z,filename,c_max,prom_List):
213 #print("z shape",z.shape)
214 len_Z = z.shape[1]
215 len_X = x.shape[0]
216 try:
217 min_CC = numpy.load(filename)
218 except:
219 print("There is no file")
220 exit()
221
222 #print(min_CC.shape,len_X)
223 #print(min_CC)
224 if count ==1:
225 c_min = 0
226 c_max = c_max+ len_X
227 plt.plot(x,y[0]+min_CC[c_min:c_max]*0.06,'yo')
228 else:
229 c_min = c_max
230 c_max = c_min+len_X
231 try:
232 plt.plot(x,y[0]+min_CC[c_min:c_max]*0.06,'yo')
233 except:
234 print("Check number of file")
235 return 0
236
237 bb = numpy.zeros(len_Z)
238 min_READ_CC = min_CC[c_min:c_max]
239 #print(min_READ_CC[0:50])
240 for i in range(len_Z):
241 if min_READ_CC[i]==numpy.nan:
242 bb[i]=numpy.nan
243 try:
244 bb[i]=z[int(min_READ_CC[i])][i]
245 except:
246 bb[i]=numpy.nan
247 print("bb _ prom_ZDR",numpy.nanmean(bb))
248 prom_List.append(numpy.nanmean(bb))
249 return c_max
250
204
251
205 def run(self):
252 def run(self):
206 count = 0
253 count = 0
@@ -231,73 +278,29 class Readsophy():
231 y= new_heightList
278 y= new_heightList
232 z=data_arr
279 z=data_arr
233 profile = numpy.mean(z,1)
280 profile = numpy.mean(z,1)
234 # Seleccion del arreglo
235 '''
236 len_Z= z.shape[1]
237 min_CC=numpy.zeros(len_Z)
238 min_index_CC = numpy.zeros(len_Z)
239 for i in range(len_Z):
240 tmp=numpy.nanmin(z[:,i])
241 tmp_index = numpy.nanargmin((z[:,i]))
242
243 if tmp <0.6:
244 tmp_index= numpy.nan
245 value = numpy.nan
246 else:
247 value= new_heightList[tmp_index]
248 min_CC[i] =value
249 moda_,count_m_ = stats.mode(min_CC)
250 print(moda_)
251 for i in range(len_Z):
252 if min_CC[i]>moda_[0]+0.15 or min_CC[i]<moda_[0]-0.15:
253 min_CC[i]=numpy.nan
254
255 min_index_CC=min_CC/0.06
256 #print(min_CC.shape,min_CC)
257 print("LONGITUD",min_index_CC.shape)
258 '''
259 len_Z= z.shape[1]
260 min_CC = numpy.zeros(len_Z)
261 min_CC = numpy.load("index.npy")
262 bb = numpy.zeros(len_Z)
263
264 for i in range(len_Z):
265 if min_CC[i]==numpy.nan:
266 bb[i]=numpy.nan
267 try:
268 bb[i]=z[int(min_CC[i]*0.06)][i]
269 except:
270 bb[i]=numpy.nan
271 #print("bb ",bb)
272 print("bb _ prom_ZDR",numpy.nanmean(bb))
273 SAVE_PARAM.append(numpy.nanmean(bb))
274 if count ==1:
281 if count ==1:
275 if self.type_ =="PROFILE":
282 if self.type_ =="PROFILE":
276 self.plot_PROFILE(count=count ,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado)
283 self.plot_PROFILE(count=count ,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado)
277 if self.type_ =="RTI":
284 if self.type_ =="RTI":
278 self.plot_RTI_PPI_RHI(count=count,x=x,y=y,z=z,cmap=cmap,my_time=my_time,vmin=vmin,vmax=vmax,label =label,unit=unit, mode=self.mode,grado=self.grado)
285 self.plot_RTI_PPI_RHI(count=count,x=x,y=y,z=z,cmap=cmap,my_time=my_time,vmin=vmin,vmax=vmax,label =label,unit=unit, mode=self.mode,grado=self.grado)
279 if self.type_ =='roHV_MIN':
286 if self.type_ =='roHV_MIN':
280 arr_= self.seleccion_roHV_min(count=count,z=z,arr_= 0)
287 arr_= self.seleccion_roHV_min(count=count,z=z,y=y,arr_= 0)
281 #arr_ = min_index_CC
288 if self.type_ =='pp_BB':
282 cota_min = 0
289 self.plot_RTI_PPI_RHI(count=count,x=x,y=y,z=z,cmap=cmap,my_time=my_time,vmin=vmin,vmax=vmax,label =label,unit=unit, mode=self.mode,grado=self.grado)
283 cota_max= len_X
290 c_max = self.pp_BB(count=count,x=x,y=y,z=z,filename='index.npy',c_max=0,prom_List=SAVE_PARAM)
284 #plt.plot(x,min_CC[0:len_X]*0.06,'yo')
285
286 else:
291 else:
287 #arr_ = numpy.append(arr_,min_index_CC)
288 if self.type_=="RTI":
292 if self.type_=="RTI":
289 self.plot_RTI_PPI_RHI(count=count,x=x,y=y,z=z,cmap=cmap,my_time=my_time,vmin=vmin,vmax=vmax,label =label,unit=unit, mode=self.mode,grado=self.grado)
293 self.plot_RTI_PPI_RHI(count=count,x=x,y=y,z=z,cmap=cmap,my_time=my_time,vmin=vmin,vmax=vmax,label =label,unit=unit, mode=self.mode,grado=self.grado)
290 if self.type_ =="PROFILE":
294 if self.type_ =="PROFILE":
291 self. plot_PROFILE(count=count,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado)
295 self. plot_PROFILE(count=count,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado)
292 if self.type_ =='roHV_MIN':
296 if self.type_ =='roHV_MIN':
293 arr_= self.seleccion_roHV_min(count=count,z=z,arr_= arr_)
297 arr_= self.seleccion_roHV_min(count=count,z=z,y=y,arr_= arr_)
294
298 if self.type_ =='pp_BB':
299 self.plot_RTI_PPI_RHI(count=count,x=x,y=y,z=z,cmap=cmap,my_time=my_time,vmin=vmin,vmax=vmax,label =label,unit=unit, mode=self.mode,grado=self.grado)
300 c_max = self.pp_BB(count=count,x=x,y=y,z=z,filename='index.npy',c_max=c_max,prom_List=SAVE_PARAM)
301 if c_max ==0:
302 count=len_files
295
303
296 #arr_ = numpy.append(arr_,min_index_CC)
297 cota_min= cota_min+len_X
298 cota_max= cota_min+len_X
299 #plt.plot(x,min_CC[cota_min:cota_max]*0.06,'yo')
300 print("Y",len_X)
301 if self.save == 1:
304 if self.save == 1:
302 self.save_PIC(count=count,time_save=time_save)
305 self.save_PIC(count=count,time_save=time_save)
303 plt.pause(1)
306 plt.pause(1)
@@ -305,8 +308,11 class Readsophy():
305 if count == len_files:
308 if count == len_files:
306 if self.type_ =='roHV_MIN':
309 if self.type_ =='roHV_MIN':
307 numpy.save("/home/soporte/WRJAN2023/schain/schainpy/scripts/index.npy",arr_)
310 numpy.save("/home/soporte/WRJAN2023/schain/schainpy/scripts/index.npy",arr_)
308 numpy.save("/home/soporte/WRJAN2023/schain/schainpy/scripts/index_"+self.variable+"_prom.npy",SAVE_PARAM)
311 if self.type_ =='pp_BB':
312 numpy.save("/home/soporte/WRJAN2023/schain/schainpy/scripts/index_"+self.variable+"_prom.npy",SAVE_PARAM)
313 print("-----ADIOS-------------------")
309 plt.close()
314 plt.close()
315 exit()
310 plt.show()
316 plt.show()
311
317
312
318
General Comments 0
You need to be logged in to leave comments. Login now