self._emit('deselect', self.selected) if (self.i, ind) != self.selected: self.selected = (self.i, ind) self._emit('select', self.selected) else: self.selected = None self.fig.canvas.draw_idle() if __name__ == '__main__': from matplotlib.animation import FuncAnimation ncf = netcdf_file('KTLX_20100510_22Z.nc') data = ncf.variables['Reflectivity'] lats = ncf.variables['lat'] lons = ncf.variables['lon'] stormcells = storm_loader('polygons.shp') fig, ax = plt.subplots(1, 1) raddisp = RadarDisplay(ax, lats, lons) raddisp.update_display(data[0]) fig.colorbar(raddisp.im) polycolls = Stormcells(ax, stormcells) linecoll = Tracks(ax) # Turn on the first frame's polygons polycolls.toggle_polygons(0, True) ax.autoscale(True) ctrl_sys = ControlSys(fig, raddisp, data, polycolls, linecoll, stormcells) #anim = FuncAnimation(fig, lambda _: ctrl_sys.change_frame(1), # frames=data.shape[0], repeat=False)
if (self.i, ind) != self.selected: self.selected = (self.i, ind) self._emit('select', self.selected) else: self.selected = None self.fig.canvas.draw_idle() if __name__ == '__main__': from matplotlib.animation import FuncAnimation ncf = netcdf_file('KTLX_20100510_22Z.nc') data = ncf.variables['Reflectivity'] lats = ncf.variables['lat'] lons = ncf.variables['lon'] stormcells = storm_loader('polygons.shp') fig, ax = plt.subplots(1, 1) raddisp = RadarDisplay(ax, lats, lons) raddisp.update_display(data[0]) fig.colorbar(raddisp.im) polycolls = Stormcells(ax, stormcells) linecoll = Tracks(ax) # Turn on the first frame's polygons polycolls.toggle_polygons(0, True) ax.autoscale(True) ctrl_sys = ControlSys(fig, raddisp, data, polycolls, linecoll, stormcells) anim = FuncAnimation(fig, lambda _: ctrl_sys.change_frame(1),