Update para identificar canales si ha sido seleccionada la operacion plot_D, algunos directorios son estaticos, actualizar si se instala en otro equipo.
@@ -6,25 +6,33 from wradlib.io import read_generic_hdf5 | |||||
6 | from wradlib.util import get_wradlib_data_file |
|
6 | from wradlib.util import get_wradlib_data_file | |
7 | from plotting_codes import sophy_cb_tables |
|
7 | from plotting_codes import sophy_cb_tables | |
8 | from scipy import stats |
|
8 | from scipy import stats | |
|
9 | import wradlib | |||
|
10 | from wradlib.io import read_generic_hdf5 | |||
|
11 | from wradlib.util import get_wradlib_data_file | |||
|
12 | import warnings | |||
|
13 | ||||
|
14 | warnings.filterwarnings('ignore') | |||
9 |
|
15 | |||
10 | for name, cb_table in sophy_cb_tables: |
|
16 | for name, cb_table in sophy_cb_tables: | |
11 | ncmap = matplotlib.colors.ListedColormap(cb_table, name=name) |
|
17 | ncmap = matplotlib.colors.ListedColormap(cb_table, name=name) | |
12 | matplotlib.pyplot.register_cmap(cmap=ncmap) |
|
18 | matplotlib.pyplot.register_cmap(cmap=ncmap) | |
13 | ''' |
|
19 | ''' | |
14 | NOTA: |
|
20 | NOTA: | |
|
21 | #python test_zdr.py --parameters Z --grado 90 --mode 'PPI' --range 10 --type plot_WR --channel H | |||
|
22 | ||||
15 | - python3.10 |
|
23 | - python3.10 | |
16 | - Conda environment: |
|
24 | - Conda environment: | |
17 | WR_CONDA_JUN14 * /home/soporte/anaconda3/envs/WR_CONDA_JUN14 |
|
25 | WR_CONDA_JUN14 * /home/soporte/anaconda3/envs/WR_CONDA_JUN14 | |
18 |
export WRADLIB_DATA |
|
26 | export WRADLIB_DATA="/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/" | |
19 | - Update de plotting_codes |
|
27 | - Update de plotting_codes | |
20 | ''' |
|
28 | ''' | |
21 | PARAM = { |
|
29 | PARAM = { | |
22 |
'S': {'var': 'power','vmin': -45, 'vmax': -15, 'cmap': 'jet', |
|
30 | 'S': {'var': 'power' ,'vmin': -45, 'vmax': -15, 'cmap': 'jet' ,'label': 'Power' ,'unit': 'dBm'}, | |
23 |
'V': {'var': 'velocity', |
|
31 | 'V': {'var': 'velocity' ,'vmin': -10, 'vmax': 10 , 'cmap': 'sophy_v','label': 'Velocity' ,'unit': 'm/s'}, | |
24 | 'Z': {'var': 'reflectivity','vmin': -20, 'vmax': 80 , 'cmap': 'sophy_z','label': 'Reflectivity','unit': 'dBZ'}, |
|
32 | 'Z': {'var': 'reflectivity' ,'vmin': -20, 'vmax': 80 , 'cmap': 'sophy_z','label': 'Reflectivity' ,'unit': 'dBZ'}, | |
25 |
'W': {'var': 'spectral_width', |
|
33 | 'W': {'var': 'spectral_width' ,'vmin': 0 , 'vmax': 12 , 'cmap': 'sophy_w','label': 'Spectral Width','unit': 'm/s'}, | |
26 |
'R': {'var':'rhoHV','vmin': 0.2, |
|
34 | 'R': {'var': 'rhoHV' ,'vmin': 0.2, 'vmax': 1 , 'cmap': 'sophy_r','label': 'RhoHV' , 'unit': ' '}, | |
27 | 'D': {'var': 'differential_reflectivity','vmin': -9, 'vmax': 12, 'cmap': 'sophy_d','label': 'ZDR' , 'unit': 'dB'} |
|
35 | 'D': {'var': 'differential_reflectivity','vmin': -9 , 'vmax': 12 , 'cmap': 'sophy_d','label': 'ZDR' , 'unit': 'dB'} | |
28 | } |
|
36 | } | |
29 |
|
37 | |||
30 | class Readsophy(): |
|
38 | class Readsophy(): | |
@@ -34,9 +42,10 class Readsophy(): | |||||
34 | self.variable = None |
|
42 | self.variable = None | |
35 | self.save = None |
|
43 | self.save = None | |
36 | self.range = None |
|
44 | self.range = None | |
37 | def setup(self, path_file,mode,type,grado,range,r_min,variable,save): |
|
45 | def setup(self, path_file,mode,channel,type,grado,range,r_min,variable,save): | |
38 | self.path_file = path_file |
|
46 | self.path_file = path_file | |
39 | self.mode = mode |
|
47 | self.mode = mode | |
|
48 | self.channel = channel | |||
40 | self.range = range |
|
49 | self.range = range | |
41 | self.grado = grado |
|
50 | self.grado = grado | |
42 | self.r_min = r_min |
|
51 | self.r_min = r_min | |
@@ -44,39 +53,48 class Readsophy(): | |||||
44 | self.save = save |
|
53 | self.save = save | |
45 | self.type_ = type |
|
54 | self.type_ = type | |
46 | self.list_file = self.read_files(path_file=self.path_file,mode=self.mode,grado=self.grado, variable=self.variable) |
|
55 | self.list_file = self.read_files(path_file=self.path_file,mode=self.mode,grado=self.grado, variable=self.variable) | |
47 | print("self.list_file",self.list_file) |
|
56 | #print("self.list_file",self.list_file) | |
48 |
|
57 | |||
49 | def read_files(self,path_file,mode=None,grado=None, variable=None): |
|
58 | def read_files(self,path_file,mode=None,grado=None, variable=None): | |
50 | if mode =='PPI': |
|
59 | if mode =='PPI': | |
51 | filter= "_E"+str(grado)+".0_"+variable |
|
60 | filter= "_E"+str(grado)+".0_"+variable | |
52 | else: |
|
61 | else: | |
53 | filter= "_A"+str(grado)+".0_"+variable |
|
62 | filter= "_A"+str(grado)+".0_"+variable | |
54 | print("Filter :",filter) |
|
63 | #print("Filter :",filter) | |
55 | validFilelist = [] |
|
64 | validFilelist = [] | |
56 | fileList= os.listdir(path_file) |
|
65 | fileList= os.listdir(path_file) | |
57 | for thisFile in fileList: |
|
66 | for thisFile in fileList: | |
58 | #print(thisFile) |
|
67 | #print(thisFile) | |
59 | if not os.path.splitext(thisFile)[0][-7:] in filter: |
|
68 | if not os.path.splitext(thisFile)[0][-7:] in filter: | |
60 | print("s_:",os.path.splitext(thisFile)[0][-7:]) |
|
69 | #print("s_:",os.path.splitext(thisFile)[0][-7:]) | |
61 | continue |
|
70 | continue | |
62 | validFilelist.append(thisFile) |
|
71 | validFilelist.append(thisFile) | |
63 | validFilelist.sort() |
|
72 | validFilelist.sort() | |
64 | return validFilelist |
|
73 | return validFilelist | |
65 |
|
74 | |||
66 | def readAttributes(self,obj,variable): |
|
75 | def readAttributes(self,obj,variable,channel,type_): | |
67 | var = PARAM[variable]['var'] |
|
76 | var = PARAM[variable]['var'] | |
68 | unit = PARAM[variable]['unit'] |
|
77 | unit = PARAM[variable]['unit'] | |
69 | cmap = PARAM[variable]['cmap'] |
|
78 | cmap = PARAM[variable]['cmap'] | |
70 | vmin = PARAM[variable]['vmin'] |
|
79 | vmin = PARAM[variable]['vmin'] | |
71 | vmax = PARAM[variable]['vmax'] |
|
80 | vmax = PARAM[variable]['vmax'] | |
72 | label = PARAM[variable]['label'] |
|
81 | label = PARAM[variable]['label'] | |
73 | var_ = 'Data/'+var+'/H' |
|
82 | ||
74 | data_arr = numpy.array(obj[var_]['data']) # data |
|
|||
75 | utc_time = numpy.array(obj['Data/time']['data']) |
|
83 | utc_time = numpy.array(obj['Data/time']['data']) | |
76 | data_azi = numpy.array(obj['Metadata/azimuth']['data']) # th |
|
84 | data_azi = numpy.array(obj['Metadata/azimuth']['data']) # th | |
77 | data_ele = numpy.array(obj["Metadata/elevation"]['data']) |
|
85 | data_ele = numpy.array(obj["Metadata/elevation"]['data']) | |
78 | heightList = numpy.array(obj["Metadata/range"]['data']) # r |
|
86 | heightList = numpy.array(obj["Metadata/range"]['data']) # r | |
|
87 | if type_ =='Diagonal': | |||
|
88 | var_H = 'Data/'+var+'/'+str('H') | |||
|
89 | var_V = 'Data/'+var+'/'+str('V') | |||
|
90 | data_arr_H = numpy.array(obj[var_H]['data']) # data | |||
|
91 | data_arr_V = numpy.array(obj[var_V]['data']) # data | |||
|
92 | data_arr = numpy.array([data_arr_H ,data_arr_V]) | |||
|
93 | else: | |||
|
94 | var_ = 'Data/'+var+'/'+str(channel) | |||
|
95 | data_arr = numpy.array(obj[var_]['data']) # data | |||
79 | return data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label |
|
96 | return data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label | |
|
97 | ||||
80 |
|
98 | |||
81 | def selectHeights(self,heightList,minHei,maxHei): |
|
99 | def selectHeights(self,heightList,minHei,maxHei): | |
82 |
|
100 | |||
@@ -162,18 +180,24 class Readsophy(): | |||||
162 | plt.xlim(-20,80) |
|
180 | plt.xlim(-20,80) | |
163 |
|
181 | |||
164 | def save_PIC(self,count,time_save): |
|
182 | def save_PIC(self,count,time_save): | |
|
183 | print("save",count) | |||
|
184 | if self.channel=='H': | |||
|
185 | ch_='0' | |||
|
186 | else: | |||
|
187 | ch_='1' | |||
165 | if count ==1: |
|
188 | if count ==1: | |
166 | filename = "SOPHY"+"_"+time_save+"_"+self.mode+"_"+self.grado+"_"+self.variable+str(self.range)+".png" |
|
189 | #filename = "SOPHY"+"_"+time_save+"_"+self.mode+"_"+self.grado+"_"+self.variable+str(self.range)+".png" | |
167 | dir =self.variable+"_"+self.mode+self.grado+"CH0/" |
|
190 | filename = "SOPHY"+"_"+time_save+"_"+"E."+self.grado+"_"+self.variable+" "+self.channel+" "+str(self.range)+".png" | |
|
191 | dir =self.variable+"_"+self.mode+"_"+self.grado+"_"+"CH"+ch_+"/" | |||
168 | filesavepath = os.path.join(self.path_file,dir) |
|
192 | filesavepath = os.path.join(self.path_file,dir) | |
169 | try: |
|
193 | try: | |
170 | os.mkdir(filesavepath) |
|
194 | os.mkdir(filesavepath) | |
171 | except: |
|
195 | except: | |
172 | pass |
|
196 | pass | |
173 | else: |
|
197 | else: | |
174 |
dir =self.variable+"_"+self.mode+self.grado+" |
|
198 | dir =self.variable+"_"+self.mode+"_"+self.grado+"_"+"CH"+ch_+"/" | |
175 | filesavepath = os.path.join(self.path_file,dir) |
|
199 | filesavepath = os.path.join(self.path_file,dir) | |
176 | filename = "SOPHY"+"_"+time_save+"_"+"E."+self.grado+"_"+self.variable+str(self.range)+".png" |
|
200 | filename = "SOPHY"+"_"+time_save+"_"+"E."+self.grado+"_"+self.variable+" "+self.channel+" "+str(self.range)+".png" | |
177 | plt.savefig(filesavepath+filename) |
|
201 | plt.savefig(filesavepath+filename) | |
178 |
|
202 | |||
179 | def seleccion_roHV_min(self,count,z,y,arr_): |
|
203 | def seleccion_roHV_min(self,count,z,y,arr_): | |
@@ -196,14 +220,14 class Readsophy(): | |||||
196 | for i in range(len_Z): |
|
220 | for i in range(len_Z): | |
197 | if min_CC[i]>moda_[0]+0.15 or min_CC[i]<moda_[0]-0.15: |
|
221 | if min_CC[i]>moda_[0]+0.15 or min_CC[i]<moda_[0]-0.15: | |
198 | min_CC[i]=numpy.nan |
|
222 | min_CC[i]=numpy.nan | |
199 | print("MIN_CC",min_CC) |
|
223 | #print("MIN_CC",min_CC) | |
200 | print("y[0]",y[0]) |
|
224 | #print("y[0]",y[0]) | |
201 | min_index_CC=((min_CC-y[0])/0.06) |
|
225 | min_index_CC=((min_CC-y[0])/0.06) | |
202 | if count == 0: |
|
226 | if count == 0: | |
203 | arr_ = min_index_CC |
|
227 | arr_ = min_index_CC | |
204 | else: |
|
228 | else: | |
205 | arr_ = numpy.append(arr_,min_index_CC) |
|
229 | arr_ = numpy.append(arr_,min_index_CC) | |
206 | print("arr_",min_index_CC) |
|
230 | #print("arr_",min_index_CC) | |
207 | return arr_ |
|
231 | return arr_ | |
208 | else: |
|
232 | else: | |
209 | print("Operation JUST for roHV - EXIT ") |
|
233 | print("Operation JUST for roHV - EXIT ") | |
@@ -219,8 +243,6 class Readsophy(): | |||||
219 | print("There is no file") |
|
243 | print("There is no file") | |
220 | exit() |
|
244 | exit() | |
221 |
|
245 | |||
222 | #print(min_CC.shape,len_X) |
|
|||
223 | #print(min_CC) |
|
|||
224 | if count ==1: |
|
246 | if count ==1: | |
225 | c_min = 0 |
|
247 | c_min = 0 | |
226 | c_max = c_max+ len_X |
|
248 | c_max = c_max+ len_X | |
@@ -248,6 +270,81 class Readsophy(): | |||||
248 | prom_List.append(numpy.nanmean(bb)) |
|
270 | prom_List.append(numpy.nanmean(bb)) | |
249 | return c_max |
|
271 | return c_max | |
250 |
|
272 | |||
|
273 | def plot_WR(self,count,fig,z,r,az,rf,my_time,label,unit,cmap,vmin,vmax): | |||
|
274 | if count ==1: | |||
|
275 | plt.rcParams['axes.facecolor']='black' | |||
|
276 | cgax, pm = wradlib.vis.plot_ppi(data=z,r=r,az=az,rf=1,fig=fig,ax=111,proj='cg',cmap=cmap,vmin=vmin,vmax=vmax) | |||
|
277 | caax = cgax.parasites[0] | |||
|
278 | title = 'Sophy Plot'+"-"+label+"-"+ my_time+" "+self.mode+"_"+self.channel+"_"+self.grado+"_"+" NΒ° "+str(count) | |||
|
279 | t = plt.title(title, fontsize=10,y=1.05) | |||
|
280 | cbar = plt.gcf().colorbar(pm,ax=cgax,shrink=0.7) | |||
|
281 | plt.text(1.0, 1.05, 'azimuth', transform=caax.transAxes, va='bottom',ha='right') | |||
|
282 | cbar.set_label(label+'[' + unit + ']') | |||
|
283 | caax.set_xlabel('x_range [km]') | |||
|
284 | caax.set_ylabel('y_range [km]') | |||
|
285 | gh = cgax.get_grid_helper() | |||
|
286 | ||||
|
287 | else: | |||
|
288 | cgax, pm = wradlib.vis.plot_ppi(data=z,r=r,az=az,rf=1,fig=fig,ax=111,proj='cg',cmap=cmap,vmin=vmin,vmax=vmax) | |||
|
289 | caax = cgax.parasites[0] | |||
|
290 | title = 'Sophy Plot'+"-"+label+"-"+ my_time+" "+self.mode+"_"+self.channel+"_"+self.grado+"_"+" NΒ° "+str(count) | |||
|
291 | t = plt.title(title, fontsize=10,y=1.05) | |||
|
292 | cbar = plt.gcf().colorbar(pm,ax=cgax,shrink=0.7) | |||
|
293 | plt.text(1.0, 1.05, 'azimuth', transform=caax.transAxes, va='bottom',ha='right') | |||
|
294 | cbar.set_label(label+'[' + unit + ']') | |||
|
295 | caax.set_xlabel('x_range [km]') | |||
|
296 | caax.set_ylabel('y_range [km]') | |||
|
297 | gh = cgax.get_grid_helper() | |||
|
298 | ||||
|
299 | def plot_D(self,count,h,x,y,my_time,label,mode,grado): | |||
|
300 | if count==1: | |||
|
301 | fig =plt.figure(figsize=(16,8)) | |||
|
302 | ax1=plt.subplot(1,2,1) | |||
|
303 | ax2=plt.subplot(1,2,2) | |||
|
304 | ax1.plot(h,x,"bo",color="red", linestyle="dotted", lw=3,label='Zh') | |||
|
305 | ax1.plot(h,y,"bo",color="blue", linestyle="dotted", lw=3,label='Zv') | |||
|
306 | title = 'Sophy Plot '+ "Zh Zv"+"-"+ my_time+" "+mode+" "+grado+" NΒ° "+str(count) | |||
|
307 | fig.suptitle(title, fontsize=18) | |||
|
308 | #plt.ylim(0,self.range+1) | |||
|
309 | ax1.legend(loc=1,prop={'size': 16}) | |||
|
310 | ax1.set_title("Z- Reflectividad vs H(Km)", fontsize=15) | |||
|
311 | ax1.set_ylabel('Z Reflectivity') | |||
|
312 | ax1.set_xlabel('H(Km)') | |||
|
313 | ax1.set_ylim(-20,70) | |||
|
314 | ||||
|
315 | m= numpy.arange(100)-20 | |||
|
316 | ax2.plot(x,y,"bo",color="red", linestyle="dotted", lw=3,label='Zh') | |||
|
317 | ax2.plot(m,m,"bo",color="green", linestyle="dotted", lw=0.5,label='Zh') | |||
|
318 | ax2.set_title('ZV vs ZH', fontsize=16) | |||
|
319 | ax2.set_xlabel('Zh dBZ') | |||
|
320 | ax2.set_xlim(-20,70) | |||
|
321 | ax2.set_ylim(-20,70) | |||
|
322 | ax2.set_ylabel('Zv dBZ') | |||
|
323 | ax2.set_xlabel('Zh dBZ') | |||
|
324 | ax2.legend(loc=1,prop={'size': 16}) | |||
|
325 | else: | |||
|
326 | ax1=plt.subplot(1,2,1) | |||
|
327 | ax2=plt.subplot(1,2,2) | |||
|
328 | ax1.plot(h,x,"bo",color="red", linestyle="dotted", lw=3,label='Zh') | |||
|
329 | ax1.plot(h,y,"bo",color="blue", linestyle="dotted", lw=3,label='Zv') | |||
|
330 | title = 'Sophy Plot '+ "Zh Zv"+"-"+ my_time+" "+mode+" "+grado+" NΒ° "+str(count) | |||
|
331 | plt.suptitle(title, fontsize=18) | |||
|
332 | ax1.legend(loc=1,prop={'size': 16}) | |||
|
333 | ax1.set_title("Z- Reflectividad vs H(Km)", fontsize=15) | |||
|
334 | ax1.set_ylabel('Z Reflectivity') | |||
|
335 | ax1.set_xlabel('H(Km)') | |||
|
336 | ax1.set_ylim(-20,70) | |||
|
337 | m= numpy.arange(100)-20 | |||
|
338 | ax2.plot(x,y,"bo",color="red", linestyle="dotted", lw=3,label='Zv vs Zh') | |||
|
339 | ax2.plot(m,m,"bo",color="green", linestyle="dotted", lw=0.5,label='Zh=Zv') | |||
|
340 | ax2.set_title('ZV vs ZH', fontsize=16) | |||
|
341 | ax2.set_xlim(-20,70) | |||
|
342 | ax2.set_ylim(-20,70) | |||
|
343 | ax2.set_ylabel('Zv dBZ') | |||
|
344 | ax2.set_xlabel('Zh dBZ') | |||
|
345 | ax2.legend(loc=1,prop={'size': 16}) | |||
|
346 | ||||
|
347 | #plt.gcf() | |||
251 |
|
348 | |||
252 | def run(self): |
|
349 | def run(self): | |
253 | count = 0 |
|
350 | count = 0 | |
@@ -260,8 +357,8 class Readsophy(): | |||||
260 | filename = get_wradlib_data_file(fullpathfile) |
|
357 | filename = get_wradlib_data_file(fullpathfile) | |
261 | test_hdf5 = read_generic_hdf5(filename) |
|
358 | test_hdf5 = read_generic_hdf5(filename) | |
262 | # LECTURA |
|
359 | # LECTURA | |
263 | data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label = self.readAttributes(obj= test_hdf5,variable=self.variable) |
|
360 | data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label = self.readAttributes(obj= test_hdf5,variable=self.variable,channel=self.channel,type_=self.type_) | |
264 | len_X= data_arr.shape[0] |
|
361 | ||
265 | # SELECCION DE ALTURAS |
|
362 | # SELECCION DE ALTURAS | |
266 | if self.range==0: |
|
363 | if self.range==0: | |
267 | self.range == heightList[-1] |
|
364 | self.range == heightList[-1] | |
@@ -272,12 +369,19 class Readsophy(): | |||||
272 | utc_time[0] = utc_time[0]+60*60*5 |
|
369 | utc_time[0] = utc_time[0]+60*60*5 | |
273 | my_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(utc_time[0])) |
|
370 | my_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(utc_time[0])) | |
274 | time_save = time.strftime('%Y%m%d_%H%M%S',time.localtime(utc_time[0])) |
|
371 | time_save = time.strftime('%Y%m%d_%H%M%S',time.localtime(utc_time[0])) | |
275 | data_arr= data_arr[:,minIndex:maxIndex].transpose() |
|
|||
276 | # VARIABLES |
|
372 | # VARIABLES | |
277 | x=numpy.linspace(1,len_X,len_X) |
|
373 | if self.type_=='Diagonal': | |
278 | y= new_heightList |
|
374 | x= numpy.nanmean(data_arr[0][:,minIndex:maxIndex].transpose(),1) | |
279 | z=data_arr |
|
375 | y= numpy.nanmean(data_arr[1][:,minIndex:maxIndex].transpose(),1) | |
280 | profile = numpy.mean(z,1) |
|
376 | h= new_heightList | |
|
377 | else: | |||
|
378 | len_X= data_arr.shape[0] | |||
|
379 | data_arr_= data_arr[:,minIndex:maxIndex].transpose() | |||
|
380 | x=numpy.linspace(1,len_X,len_X) | |||
|
381 | y= new_heightList | |||
|
382 | z=data_arr_ | |||
|
383 | profile = numpy.mean(z,1) | |||
|
384 | ||||
281 | if count ==1: |
|
385 | if count ==1: | |
282 | if self.type_ =="PROFILE": |
|
386 | if self.type_ =="PROFILE": | |
283 | self.plot_PROFILE(count=count ,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado) |
|
387 | self.plot_PROFILE(count=count ,z=z,y=y,my_time=my_time,label=label,mode=self.mode,grado=self.grado) | |
@@ -288,6 +392,11 class Readsophy(): | |||||
288 | if self.type_ =='pp_BB': |
|
392 | 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) |
|
393 | 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) |
|
394 | c_max = self.pp_BB(count=count,x=x,y=y,z=z,filename='index.npy',c_max=0,prom_List=SAVE_PARAM) | |
|
395 | if self.type_ == "plot_WR": | |||
|
396 | fig =plt.figure(figsize=(10,8)) | |||
|
397 | self.plot_WR(count=count,fig=fig,z=data_arr[:,minIndex:maxIndex],r=y,az=data_azi,rf=1,my_time=my_time,label=label,unit=unit,cmap=cmap,vmin=vmin,vmax=vmax) | |||
|
398 | if self.type_ =="Diagonal": | |||
|
399 | self.plot_D(count=count,h=h,x=x,y=y,my_time=my_time,label="Zv vs Zh",mode=self.mode,grado=self.grado) | |||
291 | else: |
|
400 | else: | |
292 | if self.type_=="RTI": |
|
401 | if self.type_=="RTI": | |
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) |
|
402 | 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,17 +409,21 class Readsophy(): | |||||
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) |
|
409 | 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: |
|
410 | if c_max ==0: | |
302 | count=len_files |
|
411 | count=len_files | |
303 |
|
412 | if self.type_ == "plot_WR": | ||
|
413 | self.plot_WR(count=count,fig=fig,z=data_arr[:,minIndex:maxIndex],r=y,az=data_azi,rf=1,my_time=my_time,label=label,unit=unit,cmap=cmap,vmin=vmin,vmax=vmax) | |||
|
414 | if self.type_ =="Diagonal": | |||
|
415 | self.plot_D(count=count,h=h,x=x,y=y,my_time=my_time,label="Zv vs Zh",mode=self.mode,grado=self.grado) | |||
|
416 | ||||
304 | if self.save == 1: |
|
417 | if self.save == 1: | |
305 | self.save_PIC(count=count,time_save=time_save) |
|
418 | self.save_PIC(count=count,time_save=time_save) | |
306 | plt.pause(1) |
|
419 | plt.pause(1) | |
307 | plt.clf() |
|
420 | plt.clf() | |
308 | if count == len_files: |
|
421 | if count == len_files: | |
309 | if self.type_ =='roHV_MIN': |
|
422 | if self.type_ =='roHV_MIN': | |
310 |
numpy.save("/ |
|
423 | numpy.save("/media/soporte/DATA/soporte/WRJAN2023/schain/schainpy/scripts/index.npy",arr_) | |
311 | if self.type_ =='pp_BB': |
|
424 | if self.type_ =='pp_BB': | |
312 |
numpy.save("/ |
|
425 | numpy.save("/media/soporte/DATA/soporte/WRJAN2023/schain/schainpy/scripts/index_"+self.variable+"_prom.npy",SAVE_PARAM) | |
313 |
print("----- |
|
426 | print("---------------------END---------------------") | |
314 | plt.close() |
|
427 | plt.close() | |
315 | exit() |
|
428 | exit() | |
316 | plt.show() |
|
429 | plt.show() | |
@@ -324,19 +437,26 def main(args): | |||||
324 | range = args.range |
|
437 | range = args.range | |
325 | mode = args.mode |
|
438 | mode = args.mode | |
326 | type = args.type |
|
439 | type = args.type | |
|
440 | channel = args.channel | |||
327 | obj = Readsophy() |
|
441 | obj = Readsophy() | |
|
442 | print("------------------START-------------------") | |||
328 | print("MODE :", mode) |
|
443 | print("MODE :", mode) | |
329 | if not mode =='PPI' and not mode =='RHI': |
|
444 | if not mode =='PPI' and not mode =='RHI': | |
330 | print("Error - Choose Mode RHI or PPI") |
|
445 | print("Error - Choose Mode RHI or PPI") | |
331 | return None |
|
446 | return None | |
332 | for param in parameters: |
|
447 | for param in parameters: | |
333 | print("Parameters : ", param) |
|
448 | print("Parameters : ", param) | |
|
449 | DIR_ = "NORMAL" | |||
334 | if mode =='PPI': |
|
450 | if mode =='PPI': | |
335 | PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_PPI_EL_"+str(grado)+".0/" |
|
451 | #PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_PPI_EL_"+str(grado)+".0/" | |
|
452 | #PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-27T00-00-32/param-FIXIT/"+str(param)+"_PPI_EL_"+str(grado)+".0/" | |||
|
453 | PATH = "/media/soporte/DATA/sophy/HYO_CC4_CC64_COMB@2022-12-27T00-00-32/param-"+DIR_+"/"+str(param)+"_PPI_EL_"+str(grado)+".0/" | |||
336 | else: |
|
454 | else: | |
337 | PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_RHI_AZ_"+str(grado)+".0/" |
|
455 | #PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_RHI_AZ_"+str(grado)+".0/" | |
|
456 | PATH = "/media/soporte/DATA/sophy/HYO_CC4_CC64_COMB@2022-12-27T00-00-32/param-"+DIR_+"/"+str(param)+"_PPI_EL_"+str(grado)+".0/" | |||
|
457 | ||||
338 | print("Path : ",PATH) |
|
458 | print("Path : ",PATH) | |
339 | obj.setup(path_file =PATH,mode=mode,type=type,grado = grado,range=range,r_min=r_min, variable=param,save=int(save)) |
|
459 | obj.setup(path_file =PATH,mode=mode,channel=channel,type=type,grado = grado,range=range,r_min=r_min, variable=param,save=int(save)) | |
340 | print("SETUP OK") |
|
460 | print("SETUP OK") | |
341 | obj.run() |
|
461 | obj.run() | |
342 |
|
462 | |||
@@ -357,6 +477,11 if __name__ == '__main__': | |||||
357 | help='Min range to plot') |
|
477 | help='Min range to plot') | |
358 | parser.add_argument('--type', default='RTI', |
|
478 | parser.add_argument('--type', default='RTI', | |
359 | help='TYPE Profile or RTI') |
|
479 | help='TYPE Profile or RTI') | |
|
480 | parser.add_argument('--channel', default='H', | |||
|
481 | help='Choose H or V') | |||
|
482 | ||||
360 | args = parser.parse_args() |
|
483 | args = parser.parse_args() | |
361 |
|
484 | |||
362 | main(args) |
|
485 | main(args) | |
|
486 | ||||
|
487 | #python test_zdr.py --parameters Z --grado 90 --mode 'PPI' --range 6 --r_min 0.5 --type plot_WR --channel H --save 1 No newline at end of file |
General Comments 1
You need to be logged in to leave comments.
Login now