@@ -74,8 +74,8 class ConfBase(): | |||
|
74 | 74 | def addParameter(self, name, value, format=None): |
|
75 | 75 | ''' |
|
76 | 76 | ''' |
|
77 | if os.path.isdir(value): | |
|
78 | self.parameters[name] = value | |
|
77 | if format is not None: | |
|
78 | self.parameters[name] = eval(format)(value) | |
|
79 | 79 | elif isinstance(value, str) and re.search(r'(\d+/\d+/\d+)', value): |
|
80 | 80 | self.parameters[name] = datetime.date(*[int(x) for x in value.split('/')]) |
|
81 | 81 | elif isinstance(value, str) and re.search(r'(\d+:\d+:\d+)', value): |
@@ -312,7 +312,7 class ReadUnitConf(ProcUnitConf): | |||
|
312 | 312 | self.datatype = datatype |
|
313 | 313 | self.err_queue = err_queue |
|
314 | 314 | |
|
315 | self.addParameter(name='path', value=path) | |
|
315 | self.addParameter(name='path', value=path, format='str') | |
|
316 | 316 | self.addParameter(name='startDate', value=startDate) |
|
317 | 317 | self.addParameter(name='endDate', value=endDate) |
|
318 | 318 | self.addParameter(name='startTime', value=startTime) |
@@ -620,18 +620,20 class WeatherPlot(Plot): | |||
|
620 | 620 | self.res_ele = numpy.mean(data['ele']) |
|
621 | 621 | ################# PLOTEO ################### |
|
622 | 622 | for i,ax in enumerate(self.axes): |
|
623 | self.zmin = self.zmin if self.zmin else 20 | |
|
624 | self.zmax = self.zmax if self.zmax else 80 | |
|
623 | 625 | if ax.firsttime: |
|
624 | 626 | plt.clf() |
|
625 |
cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin= |
|
|
627 | cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin=self.zmin, vmax=self.zmax) | |
|
626 | 628 | else: |
|
627 | 629 | plt.clf() |
|
628 |
cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin= |
|
|
630 | cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin=self.zmin, vmax=self.zmax) | |
|
629 | 631 | caax = cgax.parasites[0] |
|
630 | 632 | paax = cgax.parasites[1] |
|
631 | 633 | cbar = plt.gcf().colorbar(pm, pad=0.075) |
|
632 | 634 | caax.set_xlabel('x_range [km]') |
|
633 | 635 | caax.set_ylabel('y_range [km]') |
|
634 |
plt.text(1.0, 1.05, 'Azimuth '+str(thisDatetime)+" Step "+str(self.ini)+ " E |
|
|
636 | plt.text(1.0, 1.05, 'Azimuth '+str(thisDatetime)+" Step "+str(self.ini)+ " EL: "+str(round(self.res_ele, 1)), transform=caax.transAxes, va='bottom',ha='right') | |
|
635 | 637 | |
|
636 | 638 | self.ini= self.ini+1 |
|
637 | 639 | |
@@ -665,7 +667,7 class WeatherRHIPlot(Plot): | |||
|
665 | 667 | self.titles = ['{} Channel {}'.format(self.CODE.upper(), x) for x in range(self.nrows)] |
|
666 | 668 | print("self.titles",self.titles) |
|
667 | 669 | self.colorbar=False |
|
668 |
self.width = |
|
|
670 | self.width =12 | |
|
669 | 671 | self.height =8 |
|
670 | 672 | self.ini =0 |
|
671 | 673 | self.len_azi =0 |
@@ -1072,6 +1074,7 class WeatherRHIPlot(Plot): | |||
|
1072 | 1074 | ###print("self.res_ele",self.res_ele) |
|
1073 | 1075 | plt.clf() |
|
1074 | 1076 | subplots = [121, 122] |
|
1077 | cg={'angular_spacing': 20.} | |
|
1075 | 1078 | if self.ini==0: |
|
1076 | 1079 | self.data_ele_tmp = numpy.ones([self.nplots,int(var_ang)])*numpy.nan |
|
1077 | 1080 | self.res_weather= numpy.ones([self.nplots,int(var_ang),len(r_mask)])*numpy.nan |
@@ -1082,16 +1085,18 class WeatherRHIPlot(Plot): | |||
|
1082 | 1085 | self.res_azi = numpy.mean(data['azi']) |
|
1083 | 1086 | if i==0: |
|
1084 | 1087 | print("*****************************************************************************to plot**************************",self.res_weather[i].shape) |
|
1088 | self.zmin = self.zmin if self.zmin else 20 | |
|
1089 | self.zmax = self.zmax if self.zmax else 80 | |
|
1085 | 1090 | if ax.firsttime: |
|
1086 | 1091 | #plt.clf() |
|
1087 |
cgax, pm = wrl.vis.plot_rhi(self.res_weather[i],r=r,th=self.res_ele,ax=subplots[i], proj= |
|
|
1092 | cgax, pm = wrl.vis.plot_rhi(self.res_weather[i],r=r,th=self.res_ele,ax=subplots[i], proj=cg,vmin=self.zmin, vmax=self.zmax) | |
|
1088 | 1093 | #fig=self.figures[0] |
|
1089 | 1094 | else: |
|
1090 | 1095 | #plt.clf() |
|
1091 | 1096 | if i==0: |
|
1092 | 1097 | print(self.res_weather[i]) |
|
1093 | 1098 | print(self.res_ele) |
|
1094 |
cgax, pm = wrl.vis.plot_rhi(self.res_weather[i],r=r,th=self.res_ele,ax=subplots[i], proj= |
|
|
1099 | cgax, pm = wrl.vis.plot_rhi(self.res_weather[i],r=r,th=self.res_ele,ax=subplots[i], proj=cg,vmin=self.zmin, vmax=self.zmax) | |
|
1095 | 1100 | caax = cgax.parasites[0] |
|
1096 | 1101 | paax = cgax.parasites[1] |
|
1097 | 1102 | cbar = plt.gcf().colorbar(pm, pad=0.075) |
@@ -4059,23 +4059,28 class PedestalInformation(Operation): | |||
|
4059 | 4059 | return False, False |
|
4060 | 4060 | fileList = glob.glob(os.path.join(path, '*.h5')) |
|
4061 | 4061 | fileList.sort() |
|
4062 |
|
|
|
4063 | filename = fullname.split('/')[-1] | |
|
4064 | number = int(filename[4:14]) | |
|
4065 | if number <= timestamp: | |
|
4066 | return number, fullname | |
|
4067 | return False, False | |
|
4062 | print(fileList) | |
|
4063 | return fileList | |
|
4068 | 4064 | |
|
4069 | 4065 | def find_next_file(self): |
|
4070 | 4066 | |
|
4071 | 4067 | while True: |
|
4068 | if self.utctime < self.utcfile: | |
|
4069 | self.flagNoData = True | |
|
4070 | break | |
|
4071 | self.flagNoData = False | |
|
4072 | 4072 | file_size = len(self.fp['Data']['utc']) |
|
4073 | 4073 | if self.utctime < self.utcfile+file_size*self.interval: |
|
4074 | 4074 | break |
|
4075 | self.utcfile += file_size*self.interval | |
|
4075 | dt = datetime.datetime.utcfromtimestamp(self.utcfile) | |
|
4076 | if dt.second > 0: | |
|
4077 | self.utcfile -= dt.second | |
|
4078 | self.utcfile += self.samples*self.interval | |
|
4076 | 4079 | dt = datetime.datetime.utcfromtimestamp(self.utctime) |
|
4077 | 4080 | path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00')) |
|
4078 | self.filename = os.path.join(path, 'pos@{}.000.h5'.format(self.utcfile)) | |
|
4081 | self.filename = os.path.join(path, 'pos@{}.000.h5'.format(int(self.utcfile))) | |
|
4082 | print('ACQ time: ', self.utctime, 'POS time: ', self.utcfile) | |
|
4083 | print('Next file: ', self.filename) | |
|
4079 | 4084 | if not os.path.exists(self.filename): |
|
4080 | 4085 | log.warning('Waiting for position files...', self.name) |
|
4081 | 4086 | |
@@ -4088,8 +4093,11 class PedestalInformation(Operation): | |||
|
4088 | 4093 | |
|
4089 | 4094 | def get_values(self): |
|
4090 | 4095 | |
|
4091 | index = int((self.utctime-self.utcfile)/self.interval) | |
|
4092 | return self.fp['Data']['azi_pos'][index], self.fp['Data']['ele_pos'][index] | |
|
4096 | if self.flagNoData: | |
|
4097 | return numpy.nan, numpy.nan | |
|
4098 | else: | |
|
4099 | index = int((self.utctime-self.utcfile)/self.interval) | |
|
4100 | return self.fp['Data']['azi_pos'][index], self.fp['Data']['ele_pos'][index] | |
|
4093 | 4101 | |
|
4094 | 4102 | def setup(self, dataOut, path, conf, samples, interval, wr_exp): |
|
4095 | 4103 | |
@@ -4097,22 +4105,24 class PedestalInformation(Operation): | |||
|
4097 | 4105 | self.conf = conf |
|
4098 | 4106 | self.samples = samples |
|
4099 | 4107 | self.interval = interval |
|
4100 |
|
|
|
4108 | filelist = self.find_file(dataOut.utctime) | |
|
4101 | 4109 | |
|
4102 |
if not |
|
|
4110 | if not filelist: | |
|
4103 | 4111 | log.error('No position files found in {}'.format(path), self.name) |
|
4104 | 4112 | raise IOError('No position files found in {}'.format(path)) |
|
4105 | 4113 | else: |
|
4114 | self.filename = filelist[0] | |
|
4115 | self.utcfile = int(self.filename.split('/')[-1][4:14]) | |
|
4106 | 4116 | log.log('Opening file: {}'.format(self.filename), self.name) |
|
4107 | 4117 | self.fp = h5py.File(self.filename, 'r') |
|
4108 | 4118 | |
|
4109 | def run(self, dataOut, path, conf=None, samples=1500, interval=0.04, wr_exp=None): | |
|
4119 | def run(self, dataOut, path, conf=None, samples=1500, interval=0.04, wr_exp=None, offset=0): | |
|
4110 | 4120 | |
|
4111 | 4121 | if not self.isConfig: |
|
4112 | 4122 | self.setup(dataOut, path, conf, samples, interval, wr_exp) |
|
4113 | 4123 | self.isConfig = True |
|
4114 | 4124 | |
|
4115 | self.utctime = dataOut.utctime | |
|
4125 | self.utctime = dataOut.utctime + offset | |
|
4116 | 4126 | |
|
4117 | 4127 | self.find_next_file() |
|
4118 | 4128 |
General Comments 0
You need to be logged in to leave comments.
Login now