##// END OF EJS Templates
UPDATE TEST ZDR
avaldezp -
r1586:8b29f13d0a2c
parent child
Show More
@@ -1,356 +1,362
1 import numpy,os,time
1 import numpy,os,time
2 import matplotlib
2 import matplotlib
3 import argparse
3 import argparse
4 import matplotlib.pyplot as plt
4 import matplotlib.pyplot as plt
5 from wradlib.io import read_generic_hdf5
5 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
9
10 for name, cb_table in sophy_cb_tables:
10 for name, cb_table in sophy_cb_tables:
11 ncmap = matplotlib.colors.ListedColormap(cb_table, name=name)
11 ncmap = matplotlib.colors.ListedColormap(cb_table, name=name)
12 matplotlib.pyplot.register_cmap(cmap=ncmap)
12 matplotlib.pyplot.register_cmap(cmap=ncmap)
13 '''
13 '''
14 NOTA:
14 NOTA:
15 - python3.10
15 - python3.10
16 - Conda environment:
16 - Conda environment:
17 WR_CONDA_JUN14 * /home/soporte/anaconda3/envs/WR_CONDA_JUN14
17 WR_CONDA_JUN14 * /home/soporte/anaconda3/envs/WR_CONDA_JUN14
18 export WRADLIB_DATA = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"
18 export WRADLIB_DATA = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"
19 - Update de plotting_codes
19 - Update de plotting_codes
20 '''
20 '''
21 PARAM = {
21 PARAM = {
22 'S': {'var': 'power','vmin': -45, 'vmax': -15, 'cmap': 'jet', 'label': 'Power','unit': 'dBm'},
22 'S': {'var': 'power','vmin': -45, 'vmax': -15, 'cmap': 'jet', 'label': 'Power','unit': 'dBm'},
23 'V': {'var': 'velocity', 'vmin': -10, 'vmax': 10 , 'cmap': 'sophy_v', 'label': 'Velocity','unit': 'm/s'},
23 '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'},
24 'Z': {'var': 'reflectivity','vmin': -20, 'vmax': 80 , 'cmap': 'sophy_z','label': 'Reflectivity','unit': 'dBZ'},
25 'W': {'var': 'spectral_width', 'vmin': 0 , 'vmax': 12 , 'cmap': 'sophy_w','label': 'Spectral Width','unit': 'm/s'},
25 'W': {'var': 'spectral_width', 'vmin': 0 , 'vmax': 12 , 'cmap': 'sophy_w','label': 'Spectral Width','unit': 'm/s'},
26 'R': {'var':'rhoHV','vmin': 0.2, 'vmax': 1, 'cmap': 'sophy_r','label': 'RhoHV', 'unit': ' '},
26 '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'}
27 'D': {'var': 'differential_reflectivity','vmin': -9, 'vmax': 12, 'cmap': 'sophy_d','label': 'ZDR' , 'unit': 'dB'}
28 }
28 }
29
29
30 class Readsophy():
30 class Readsophy():
31 def __init__(self):
31 def __init__(self):
32 self.list_file = None
32 self.list_file = None
33 self.grado = None
33 self.grado = None
34 self.variable = None
34 self.variable = None
35 self.save = None
35 self.save = None
36 self.range = None
36 self.range = None
37 def setup(self, path_file,mode,type,grado,range,r_min,variable,save):
37 def setup(self, path_file,mode,type,grado,range,r_min,variable,save):
38 self.path_file = path_file
38 self.path_file = path_file
39 self.mode = mode
39 self.mode = mode
40 self.range = range
40 self.range = range
41 self.grado = grado
41 self.grado = grado
42 self.r_min = r_min
42 self.r_min = r_min
43 self.variable = variable
43 self.variable = variable
44 self.save = save
44 self.save = save
45 self.type_ = type
45 self.type_ = type
46 self.list_file = self.read_files(path_file=self.path_file,mode=self.mode,grado=self.grado, variable=self.variable)
46 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)
47 print("self.list_file",self.list_file)
48
48
49 def read_files(self,path_file,mode=None,grado=None, variable=None):
49 def read_files(self,path_file,mode=None,grado=None, variable=None):
50 if mode =='PPI':
50 if mode =='PPI':
51 filter= "_E"+str(grado)+".0_"+variable
51 filter= "_E"+str(grado)+".0_"+variable
52 else:
52 else:
53 filter= "_A"+str(grado)+".0_"+variable
53 filter= "_A"+str(grado)+".0_"+variable
54 print("Filter :",filter)
54 print("Filter :",filter)
55 validFilelist = []
55 validFilelist = []
56 fileList= os.listdir(path_file)
56 fileList= os.listdir(path_file)
57 for thisFile in fileList:
57 for thisFile in fileList:
58 #print(thisFile)
58 #print(thisFile)
59 if not os.path.splitext(thisFile)[0][-7:] in filter:
59 if not os.path.splitext(thisFile)[0][-7:] in filter:
60 print("s_:",os.path.splitext(thisFile)[0][-7:])
60 print("s_:",os.path.splitext(thisFile)[0][-7:])
61 continue
61 continue
62 validFilelist.append(thisFile)
62 validFilelist.append(thisFile)
63 validFilelist.sort()
63 validFilelist.sort()
64 return validFilelist
64 return validFilelist
65
65
66 def readAttributes(self,obj,variable):
66 def readAttributes(self,obj,variable):
67 var = PARAM[variable]['var']
67 var = PARAM[variable]['var']
68 unit = PARAM[variable]['unit']
68 unit = PARAM[variable]['unit']
69 cmap = PARAM[variable]['cmap']
69 cmap = PARAM[variable]['cmap']
70 vmin = PARAM[variable]['vmin']
70 vmin = PARAM[variable]['vmin']
71 vmax = PARAM[variable]['vmax']
71 vmax = PARAM[variable]['vmax']
72 label = PARAM[variable]['label']
72 label = PARAM[variable]['label']
73 var_ = 'Data/'+var+'/H'
73 var_ = 'Data/'+var+'/H'
74 data_arr = numpy.array(obj[var_]['data']) # data
74 data_arr = numpy.array(obj[var_]['data']) # data
75 utc_time = numpy.array(obj['Data/time']['data'])
75 utc_time = numpy.array(obj['Data/time']['data'])
76 data_azi = numpy.array(obj['Metadata/azimuth']['data']) # th
76 data_azi = numpy.array(obj['Metadata/azimuth']['data']) # th
77 data_ele = numpy.array(obj["Metadata/elevation"]['data'])
77 data_ele = numpy.array(obj["Metadata/elevation"]['data'])
78 heightList = numpy.array(obj["Metadata/range"]['data']) # r
78 heightList = numpy.array(obj["Metadata/range"]['data']) # r
79 return data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label
79 return data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label
80
80
81 def selectHeights(self,heightList,minHei,maxHei):
81 def selectHeights(self,heightList,minHei,maxHei):
82
82
83 if minHei and maxHei:
83 if minHei and maxHei:
84 if (minHei < heightList[0]):
84 if (minHei < heightList[0]):
85 minHei = heightList[0]
85 minHei = heightList[0]
86 if (maxHei > heightList[-1]):
86 if (maxHei > heightList[-1]):
87 maxHei = heightList[-1]
87 maxHei = heightList[-1]
88 minIndex = 0
88 minIndex = 0
89 maxIndex = 0
89 maxIndex = 0
90 heights = heightList
90 heights = heightList
91
91
92 inda = numpy.where(heights >= minHei)
92 inda = numpy.where(heights >= minHei)
93 indb = numpy.where(heights <= maxHei)
93 indb = numpy.where(heights <= maxHei)
94
94
95 try:
95 try:
96 minIndex = inda[0][0]
96 minIndex = inda[0][0]
97 except:
97 except:
98 minIndex = 0
98 minIndex = 0
99
99
100 try:
100 try:
101 maxIndex = indb[0][-1]
101 maxIndex = indb[0][-1]
102 except:
102 except:
103 maxIndex = len(heights)
103 maxIndex = len(heights)
104
104
105 new_heightList= self.selectHeightsByIndex(heightList=heightList,minIndex=minIndex, maxIndex=maxIndex)
105 new_heightList= self.selectHeightsByIndex(heightList=heightList,minIndex=minIndex, maxIndex=maxIndex)
106
106
107 return new_heightList, minIndex,maxIndex
107 return new_heightList, minIndex,maxIndex
108
108
109 def selectHeightsByIndex(self,heightList,minIndex, maxIndex):
109 def selectHeightsByIndex(self,heightList,minIndex, maxIndex):
110
110
111 if (minIndex < 0) or (minIndex > maxIndex):
111 if (minIndex < 0) or (minIndex > maxIndex):
112 raise ValueError("Height index range (%d,%d) is not valid" % (minIndex, maxIndex))
112 raise ValueError("Height index range (%d,%d) is not valid" % (minIndex, maxIndex))
113
113
114 if (maxIndex >= len(heightList)):
114 if (maxIndex >= len(heightList)):
115 maxIndex = len(heightList)
115 maxIndex = len(heightList)
116
116
117 new_h = heightList[minIndex:maxIndex]
117 new_h = heightList[minIndex:maxIndex]
118 return new_h
118 return new_h
119
119
120 def plot_RTI_PPI_RHI(self,count,x,y,z,cmap,my_time,vmin,vmax,label,unit,mode,grado):
120 def plot_RTI_PPI_RHI(self,count,x,y,z,cmap,my_time,vmin,vmax,label,unit,mode,grado):
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 + ']')
134
134
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)
143 plt.ylabel('Height(Km)')
143 plt.ylabel('Height(Km)')
144 if self.variable=="R":
144 if self.variable=="R":
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)
154 plt.ylabel('Height(Km)')
156 plt.ylabel('Height(Km)')
155 if self.variable=="R":
157 if self.variable=="R":
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:
162 filename = "SOPHY"+"_"+time_save+"_"+self.mode+"_"+self.grado+"_"+self.variable+str(self.range)+".png"
166 filename = "SOPHY"+"_"+time_save+"_"+self.mode+"_"+self.grado+"_"+self.variable+str(self.range)+".png"
163 dir =self.variable+"_"+self.mode+self.grado+"CH0/"
167 dir =self.variable+"_"+self.mode+self.grado+"CH0/"
164 filesavepath = os.path.join(self.path_file,dir)
168 filesavepath = os.path.join(self.path_file,dir)
165 try:
169 try:
166 os.mkdir(filesavepath)
170 os.mkdir(filesavepath)
167 except:
171 except:
168 pass
172 pass
169 else:
173 else:
170 dir =self.variable+"_"+self.mode+self.grado+"CH0/"
174 dir =self.variable+"_"+self.mode+self.grado+"CH0/"
171 filesavepath = os.path.join(self.path_file,dir)
175 filesavepath = os.path.join(self.path_file,dir)
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)
179 min_index_CC = numpy.zeros(len_Z)
184 min_index_CC = numpy.zeros(len_Z)
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
207 len_files = len(self.list_file)
254 len_files = len(self.list_file)
208 SAVE_PARAM= []
255 SAVE_PARAM= []
209 for thisFile in self.list_file:
256 for thisFile in self.list_file:
210 count= count +1
257 count= count +1
211 print("Count :", count)
258 print("Count :", count)
212 fullpathfile = self.path_file + thisFile
259 fullpathfile = self.path_file + thisFile
213 filename = get_wradlib_data_file(fullpathfile)
260 filename = get_wradlib_data_file(fullpathfile)
214 test_hdf5 = read_generic_hdf5(filename)
261 test_hdf5 = read_generic_hdf5(filename)
215 # LECTURA
262 # LECTURA
216 data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label = self.readAttributes(obj= test_hdf5,variable=self.variable)
263 data_arr, utc_time, data_azi,data_ele, heightList,unit,cmap,vmin,vmax,label = self.readAttributes(obj= test_hdf5,variable=self.variable)
217 len_X= data_arr.shape[0]
264 len_X= data_arr.shape[0]
218 # SELECCION DE ALTURAS
265 # SELECCION DE ALTURAS
219 if self.range==0:
266 if self.range==0:
220 self.range == heightList[-1]
267 self.range == heightList[-1]
221 if self.r_min==0:
268 if self.r_min==0:
222 self.r_min = 0.01
269 self.r_min = 0.01
223 new_heightList,minIndex,maxIndex = self.selectHeights(heightList,self.r_min,self.range)
270 new_heightList,minIndex,maxIndex = self.selectHeights(heightList,self.r_min,self.range)
224 # TIEMPO
271 # TIEMPO
225 utc_time[0] = utc_time[0]+60*60*5
272 utc_time[0] = utc_time[0]+60*60*5
226 my_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(utc_time[0]))
273 my_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(utc_time[0]))
227 time_save = 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]))
228 data_arr= data_arr[:,minIndex:maxIndex].transpose()
275 data_arr= data_arr[:,minIndex:maxIndex].transpose()
229 # VARIABLES
276 # VARIABLES
230 x=numpy.linspace(1,len_X,len_X)
277 x=numpy.linspace(1,len_X,len_X)
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)
304 plt.clf()
307 plt.clf()
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
313 def main(args):
319 def main(args):
314 grado = args.grado
320 grado = args.grado
315 parameters = args.parameters
321 parameters = args.parameters
316 r_min = args.r_min
322 r_min = args.r_min
317 save = args.save
323 save = args.save
318 range = args.range
324 range = args.range
319 mode = args.mode
325 mode = args.mode
320 type = args.type
326 type = args.type
321 obj = Readsophy()
327 obj = Readsophy()
322 print("MODE :", mode)
328 print("MODE :", mode)
323 if not mode =='PPI' and not mode =='RHI':
329 if not mode =='PPI' and not mode =='RHI':
324 print("Error - Choose Mode RHI or PPI")
330 print("Error - Choose Mode RHI or PPI")
325 return None
331 return None
326 for param in parameters:
332 for param in parameters:
327 print("Parameters : ", param)
333 print("Parameters : ", param)
328 if mode =='PPI':
334 if mode =='PPI':
329 PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_PPI_EL_"+str(grado)+".0/"
335 PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_PPI_EL_"+str(grado)+".0/"
330 else:
336 else:
331 PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_RHI_AZ_"+str(grado)+".0/"
337 PATH = "/media/soporte/TOSHIBAEXT/sophy/HYO_CC4_CC64_COMB@2022-12-26T00-00-32/param-EVENTO/"+str(param)+"_RHI_AZ_"+str(grado)+".0/"
332 print("Path : ",PATH)
338 print("Path : ",PATH)
333 obj.setup(path_file =PATH,mode=mode,type=type,grado = grado,range=range,r_min=r_min, variable=param,save=int(save))
339 obj.setup(path_file =PATH,mode=mode,type=type,grado = grado,range=range,r_min=r_min, variable=param,save=int(save))
334 print("SETUP OK")
340 print("SETUP OK")
335 obj.run()
341 obj.run()
336
342
337 if __name__ == '__main__':
343 if __name__ == '__main__':
338
344
339 parser = argparse.ArgumentParser(description='Script to process SOPHy data.')
345 parser = argparse.ArgumentParser(description='Script to process SOPHy data.')
340 parser.add_argument('--parameters', nargs='*', default=['S'],
346 parser.add_argument('--parameters', nargs='*', default=['S'],
341 help='Variables to process: P, Z, V ,W,D')
347 help='Variables to process: P, Z, V ,W,D')
342 parser.add_argument('--grado', default=2,
348 parser.add_argument('--grado', default=2,
343 help='Angle in Elev to plot')
349 help='Angle in Elev to plot')
344 parser.add_argument('--mode',default='PPI',
350 parser.add_argument('--mode',default='PPI',
345 help='MODE PPI or RHI')
351 help='MODE PPI or RHI')
346 parser.add_argument('--save', default=0,
352 parser.add_argument('--save', default=0,
347 help='Save plot')
353 help='Save plot')
348 parser.add_argument('--range', default=0, type=float,
354 parser.add_argument('--range', default=0, type=float,
349 help='Max range to plot')
355 help='Max range to plot')
350 parser.add_argument('--r_min', default=0, type=float,
356 parser.add_argument('--r_min', default=0, type=float,
351 help='Min range to plot')
357 help='Min range to plot')
352 parser.add_argument('--type', default='RTI',
358 parser.add_argument('--type', default='RTI',
353 help='TYPE Profile or RTI')
359 help='TYPE Profile or RTI')
354 args = parser.parse_args()
360 args = parser.parse_args()
355
361
356 main(args)
362 main(args)
General Comments 0
You need to be logged in to leave comments. Login now