##// END OF EJS Templates
Add RHI plot mode to PlotPolarMapData
jespinoza -
r1141:2145c6c87174
parent child
Show More
@@ -434,8 +434,10 class PlotData(Operation, Process):
434 try:
434 try:
435 self.plot()
435 self.plot()
436 self.format()
436 self.format()
437 except:
437 except Exception as e:
438 log.warning('{} Plot could not be updated... check data'.format(self.CODE), self.name)
438 log.warning('{} Plot could not be updated... check data'.format(self.CODE), self.name)
439 log.error(str(e), '')
440 return
439
441
440 for n, fig in enumerate(self.figures):
442 for n, fig in enumerate(self.figures):
441 if self.nrows == 0 or self.nplots == 0:
443 if self.nrows == 0 or self.nplots == 0:
@@ -451,8 +453,8 class PlotData(Operation, Process):
451
453
452 if self.save and (self.data.ended or not self.data.buffering):
454 if self.save and (self.data.ended or not self.data.buffering):
453
455
454 if self.labels:
456 if self.save_labels:
455 labels = self.labels
457 labels = self.save_labels
456 else:
458 else:
457 labels = range(self.nrows)
459 labels = range(self.nrows)
458
460
@@ -1003,26 +1005,37 class PlotPolarMapData(PlotData):
1003 self.nplots = self.data.shape(self.CODE)[0]
1005 self.nplots = self.data.shape(self.CODE)[0]
1004 self.nrows = self.nplots
1006 self.nrows = self.nplots
1005 self.channels = range(self.nplots)
1007 self.channels = range(self.nplots)
1008 if self.data.meta['mode'] == 'E':
1006 self.xlabel = 'Zonal Distance (km)'
1009 self.xlabel = 'Zonal Distance (km)'
1007 self.ylabel = 'Meridional Distance (km)'
1010 self.ylabel = 'Meridional Distance (km)'
1011 else:
1012 self.xlabel = 'Range (km)'
1013 self.ylabel = 'Height (km)'
1008 self.bgcolor = 'white'
1014 self.bgcolor = 'white'
1015 self.cb_labels = self.data.meta['units']
1016 # self.polar = True
1009
1017
1010 def plot(self):
1018 def plot(self):
1011
1019
1012 for n, ax in enumerate(self.axes):
1020 for n, ax in enumerate(self.axes):
1013 data = self.data['param'][self.channels[n]]
1021 data = self.data['param'][self.channels[n]]
1014
1022
1015 zeniths = numpy.arange(data.shape[1])
1023 zeniths = numpy.linspace(0, self.data.meta['max_range'], data.shape[1])
1024 if self.data.meta['mode'] == 'E':
1016 azimuths = -numpy.radians(self.data.heights)+numpy.pi/2
1025 azimuths = -numpy.radians(self.data.heights)+numpy.pi/2
1017 self.y = zeniths
1026 r, theta = numpy.meshgrid(zeniths, azimuths)
1018
1027 x, y = r*numpy.cos(theta)*numpy.cos(numpy.radians(self.data.meta['elevation'])), r*numpy.sin(theta)*numpy.cos(numpy.radians(self.data.meta['elevation']))
1028 else:
1029 azimuths = numpy.radians(self.data.heights)
1019 r, theta = numpy.meshgrid(zeniths, azimuths)
1030 r, theta = numpy.meshgrid(zeniths, azimuths)
1020 x, y = r*numpy.cos(theta), r*numpy.sin(theta)
1031 x, y = r*numpy.cos(theta), r*numpy.sin(theta)
1032 self.y = zeniths
1021
1033
1022 if ax.firsttime:
1034 if ax.firsttime:
1023 if self.zlimits is not None:
1035 if self.zlimits is not None:
1024 self.zmin, self.zmax = self.zlimits[n]
1036 self.zmin, self.zmax = self.zlimits[n]
1025 ax.plt = ax.pcolormesh(x, y, numpy.ma.array(data, mask=numpy.isnan(data)),
1037 ax.plt = ax.pcolormesh(#r, theta, numpy.ma.array(data, mask=numpy.isnan(data)),
1038 x, y, numpy.ma.array(data, mask=numpy.isnan(data)),
1026 vmin=self.zmin,
1039 vmin=self.zmin,
1027 vmax=self.zmax,
1040 vmax=self.zmax,
1028 cmap=self.cmaps[n])
1041 cmap=self.cmaps[n])
@@ -1030,13 +1043,43 class PlotPolarMapData(PlotData):
1030 if self.zlimits is not None:
1043 if self.zlimits is not None:
1031 self.zmin, self.zmax = self.zlimits[n]
1044 self.zmin, self.zmax = self.zlimits[n]
1032 ax.collections.remove(ax.collections[0])
1045 ax.collections.remove(ax.collections[0])
1033 ax.plt = ax.pcolormesh(x, y, numpy.ma.array(data, mask=numpy.isnan(data)),
1046 ax.plt = ax.pcolormesh(# r, theta, numpy.ma.array(data, mask=numpy.isnan(data)),
1047 x, y, numpy.ma.array(data, mask=numpy.isnan(data)),
1034 vmin=self.zmin,
1048 vmin=self.zmin,
1035 vmax=self.zmax,
1049 vmax=self.zmax,
1036 cmap=self.cmaps[n])
1050 cmap=self.cmaps[n])
1037
1051
1052 if self.data.meta['mode'] == 'A':
1053 continue
1054 '''
1055 f = open('/data/workspace/schain_scripts/map_lima.csv')
1056
1057 lat1 = -11.96
1058 lon1 = -76.54
1059
1060 for line in f:
1061 label, x, y = [s.strip() for s in line.split(',') if s]
1062 lat2 = float(y)
1063 lon2 = float(x)
1064
1065 dx = (lon2-lon1)*40000*numpy.cos((lat1+lat2)*numpy.pi/360)/360
1066 dy = (lat1-lat2)*40000/360
1067 print label, dx, dy
1068 if label == 'map':
1069 print 'SDHSDHSDHSGHSDFHSDF'
1070 ax.plot([dx], [dy],'--k')
1071 else:
1072 ax.plot([dx], [dy],'.b', ms=2)
1073 '''
1074 if self.data.meta['mode'] == 'E':
1075 title = 'El={}$^\circ$'.format(self.data.meta['elevation'])
1076 label = 'E{:d}'.format(int(self.data.meta['elevation']))
1077 else:
1078 title = 'Az={}$^\circ$'.format(self.data.meta['azimuth'])
1079 label = 'A{:d}'.format(int(self.data.meta['azimuth']))
1038
1080
1039 title = ''
1081 self.save_labels = ['{}-{}'.format(lbl, label) for lbl in self.labels]
1040
1082 self.titles = ['{} {}'.format(self.data.parameters[x], title) for x in self.channels]
1041 self.titles = [self.data.parameters[x] for x in self.channels]
1042 self.saveTime = self.max_time
1083 self.saveTime = self.max_time
1084
1085
General Comments 0
You need to be logged in to leave comments. Login now