##// END OF EJS Templates
UPDATE TEST ZDR
avaldezp -
r1586:8b29f13d0a2c
parent child
Show More
@@ -121,13 +121,13 class Readsophy():
121 121 if count==1:
122 122 fig = plt.figure(figsize=(8,6))
123 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 125 t = plt.title(title, fontsize=12,y=1.05)
126 126 cbar = plt.colorbar()
127 127 cbar.set_label(label+'[' + unit + ']')
128 128 else:
129 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 131 t = plt.title(title, fontsize=12,y=1.05)
132 132 cbar = plt.colorbar()
133 133 cbar.set_label(label+'[' + unit + ']')
@@ -135,8 +135,8 class Readsophy():
135 135 def plot_PROFILE(self,count,z,y,my_time,label,mode,grado):
136 136 if count==1:
137 137 fig = plt.figure(figsize=(8,6))
138 plt.plot(z,y)
139 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado
138 plt.plot(numpy.nanmean(z,1),y)
139 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado+" N° "+str(count)
140 140 t = plt.title(title, fontsize=12,y=1.05)
141 141 plt.ylim(0,self.range+1)
142 142 plt.xlabel(label)
@@ -145,9 +145,11 class Readsophy():
145 145 plt.xlim(-1,3)
146 146 if self.variable=='D':
147 147 plt.xlim(-10,10)
148 if self.variable=='Z':
149 plt.xlim(-20,80)
148 150 else:
149 plt.plot(z,y)
150 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado
151 plt.plot(numpy.nanmean(z,1),y)
152 title = 'Sophy Plot '+label+"-"+ my_time+" "+mode+" "+grado+" N° "+str(count)
151 153 t = plt.title(title, fontsize=12,y=1.05)
152 154 plt.ylim(0,self.range+1)
153 155 plt.xlabel(label)
@@ -156,6 +158,8 class Readsophy():
156 158 plt.xlim(-1,3)
157 159 if self.variable=='D':
158 160 plt.xlim(-10,10)
161 if self.variable=='Z':
162 plt.xlim(-20,80)
159 163
160 164 def save_PIC(self,count,time_save):
161 165 if count ==1:
@@ -172,7 +176,8 class Readsophy():
172 176 filename = "SOPHY"+"_"+time_save+"_"+"E."+self.grado+"_"+self.variable+str(self.range)+".png"
173 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 181 if self.variable=='R':
177 182 len_Z= z.shape[1]
178 183 min_CC=numpy.zeros(len_Z)
@@ -180,27 +185,69 class Readsophy():
180 185 for i in range(len_Z):
181 186 tmp=numpy.nanmin(z[:,i])
182 187 tmp_index = numpy.nanargmin((z[:,i]))
183
184 if tmp <0.6:
188 if tmp <0.5:
185 189 tmp_index= numpy.nan
186 190 value = numpy.nan
187 191 else:
188 value= new_heightList[tmp_index]
192 value= y[tmp_index]
189 193 min_CC[i] =value
190 194 moda_,count_m_ = stats.mode(min_CC)
191 print(moda_)
195 #print("MODA",moda_)
192 196 for i in range(len_Z):
193 197 if min_CC[i]>moda_[0]+0.15 or min_CC[i]<moda_[0]-0.15:
194 198 min_CC[i]=numpy.nan
195
196 min_index_CC=min_CC/0.06
199 print("MIN_CC",min_CC)
200 print("y[0]",y[0])
201 min_index_CC=((min_CC-y[0])/0.06)
197 202 if count == 0:
198 203 arr_ = min_index_CC
199 204 else:
200 205 arr_ = numpy.append(arr_,min_index_CC)
206 print("arr_",min_index_CC)
201 207 return arr_
202 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 252 def run(self):
206 253 count = 0
@@ -231,73 +278,29 class Readsophy():
231 278 y= new_heightList
232 279 z=data_arr
233 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 281 if count ==1:
275 282 if self.type_ =="PROFILE":
276 283 self.plot_PROFILE(count=count ,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado)
277 284 if self.type_ =="RTI":
278 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 286 if self.type_ =='roHV_MIN':
280 arr_= self.seleccion_roHV_min(count=count,z=z,arr_= 0)
281 #arr_ = min_index_CC
282 cota_min = 0
283 cota_max= len_X
284 #plt.plot(x,min_CC[0:len_X]*0.06,'yo')
285
287 arr_= self.seleccion_roHV_min(count=count,z=z,y=y,arr_= 0)
288 if self.type_ =='pp_BB':
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)
290 c_max = self.pp_BB(count=count,x=x,y=y,z=z,filename='index.npy',c_max=0,prom_List=SAVE_PARAM)
286 291 else:
287 #arr_ = numpy.append(arr_,min_index_CC)
288 292 if self.type_=="RTI":
289 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 294 if self.type_ =="PROFILE":
291 295 self. plot_PROFILE(count=count,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado)
292 296 if self.type_ =='roHV_MIN':
293 arr_= self.seleccion_roHV_min(count=count,z=z,arr_= arr_)
294
297 arr_= self.seleccion_roHV_min(count=count,z=z,y=y,arr_= arr_)
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 304 if self.save == 1:
302 305 self.save_PIC(count=count,time_save=time_save)
303 306 plt.pause(1)
@@ -305,8 +308,11 class Readsophy():
305 308 if count == len_files:
306 309 if self.type_ =='roHV_MIN':
307 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 314 plt.close()
315 exit()
310 316 plt.show()
311 317
312 318
General Comments 0
You need to be logged in to leave comments. Login now