@@ -434,8 +434,10 class PlotData(Operation, Process): | |||
|
434 | 434 | try: |
|
435 | 435 | self.plot() |
|
436 | 436 | self.format() |
|
437 | except: | |
|
437 | except Exception as e: | |
|
438 | 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 | 442 | for n, fig in enumerate(self.figures): |
|
441 | 443 | if self.nrows == 0 or self.nplots == 0: |
@@ -451,8 +453,8 class PlotData(Operation, Process): | |||
|
451 | 453 | |
|
452 | 454 | if self.save and (self.data.ended or not self.data.buffering): |
|
453 | 455 | |
|
454 | if self.labels: | |
|
455 | labels = self.labels | |
|
456 | if self.save_labels: | |
|
457 | labels = self.save_labels | |
|
456 | 458 | else: |
|
457 | 459 | labels = range(self.nrows) |
|
458 | 460 | |
@@ -1003,26 +1005,37 class PlotPolarMapData(PlotData): | |||
|
1003 | 1005 | self.nplots = self.data.shape(self.CODE)[0] |
|
1004 | 1006 | self.nrows = self.nplots |
|
1005 | 1007 | self.channels = range(self.nplots) |
|
1006 | self.xlabel = 'Zonal Distance (km)' | |
|
1007 |
self. |
|
|
1008 | if self.data.meta['mode'] == 'E': | |
|
1009 | self.xlabel = 'Zonal Distance (km)' | |
|
1010 | self.ylabel = 'Meridional Distance (km)' | |
|
1011 | else: | |
|
1012 | self.xlabel = 'Range (km)' | |
|
1013 | self.ylabel = 'Height (km)' | |
|
1008 | 1014 | self.bgcolor = 'white' |
|
1015 | self.cb_labels = self.data.meta['units'] | |
|
1016 | # self.polar = True | |
|
1009 | 1017 | |
|
1010 | 1018 | def plot(self): |
|
1011 | 1019 | |
|
1012 | 1020 | for n, ax in enumerate(self.axes): |
|
1013 | 1021 | data = self.data['param'][self.channels[n]] |
|
1014 | 1022 | |
|
1015 |
zeniths = numpy. |
|
|
1016 | azimuths = -numpy.radians(self.data.heights)+numpy.pi/2 | |
|
1023 | zeniths = numpy.linspace(0, self.data.meta['max_range'], data.shape[1]) | |
|
1024 | if self.data.meta['mode'] == 'E': | |
|
1025 | azimuths = -numpy.radians(self.data.heights)+numpy.pi/2 | |
|
1026 | r, theta = numpy.meshgrid(zeniths, azimuths) | |
|
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) | |
|
1030 | r, theta = numpy.meshgrid(zeniths, azimuths) | |
|
1031 | x, y = r*numpy.cos(theta), r*numpy.sin(theta) | |
|
1017 | 1032 | self.y = zeniths |
|
1018 | ||
|
1019 | r, theta = numpy.meshgrid(zeniths, azimuths) | |
|
1020 | x, y = r*numpy.cos(theta), r*numpy.sin(theta) | |
|
1021 | 1033 | |
|
1022 | 1034 | if ax.firsttime: |
|
1023 | 1035 | if self.zlimits is not None: |
|
1024 | 1036 | self.zmin, self.zmax = self.zlimits[n] |
|
1025 |
ax.plt = ax.pcolormesh( |
|
|
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 | 1039 | vmin=self.zmin, |
|
1027 | 1040 | vmax=self.zmax, |
|
1028 | 1041 | cmap=self.cmaps[n]) |
@@ -1030,13 +1043,43 class PlotPolarMapData(PlotData): | |||
|
1030 | 1043 | if self.zlimits is not None: |
|
1031 | 1044 | self.zmin, self.zmax = self.zlimits[n] |
|
1032 | 1045 | ax.collections.remove(ax.collections[0]) |
|
1033 |
ax.plt = ax.pcolormesh( |
|
|
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 | 1048 | vmin=self.zmin, |
|
1035 | 1049 | vmax=self.zmax, |
|
1036 | 1050 | cmap=self.cmaps[n]) |
|
1037 | 1051 | |
|
1038 | ||
|
1039 |
|
|
|
1040 | ||
|
1041 | self.titles = [self.data.parameters[x] for x in self.channels] | |
|
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'])) | |
|
1080 | ||
|
1081 | self.save_labels = ['{}-{}'.format(lbl, label) for lbl in self.labels] | |
|
1082 | self.titles = ['{} {}'.format(self.data.parameters[x], title) for x in self.channels] | |
|
1042 | 1083 | self.saveTime = self.max_time |
|
1084 | ||
|
1085 |
General Comments 0
You need to be logged in to leave comments.
Login now