Example #1
0
    def test_cube_animation(self):
        # This follows :meth:`~matplotlib.animation.FuncAnimation.save`
        # to ensure that each frame corresponds to known accepted frames for
        # the animation.
        cube_iter = self.cube.slices(("latitude", "longitude"))

        ani = animate.animate(cube_iter, iplt.contourf)

        # Disconnect the first draw callback to stop the animation
        ani._fig.canvas.mpl_disconnect(ani._first_draw_id)

        ani = [ani]
        # Extract frame data
        for data in zip(*[a.new_saved_frame_seq() for a in ani]):
            # Draw each frame
            for anim, d in zip(ani, data):
                anim._draw_next_frame(d, blit=False)
                self.check_graphic()
Example #2
0
    def test_cube_animation(self):
        # This follows :meth:`~matplotlib.animation.FuncAnimation.save`
        # to ensure that each frame corresponds to known accepted frames for
        # the animation.
        cube_iter = self.cube.slices(('latitude', 'longitude'))

        ani = animate.animate(cube_iter, iplt.contourf)

        # Disconnect the first draw callback to stop the animation
        ani._fig.canvas.mpl_disconnect(ani._first_draw_id)

        ani = [ani]
        # Extract frame data
        for data in itertools.izip(*[a.new_saved_frame_seq() for a in ani]):
            # Draw each frame
            for anim, d in zip(ani, data):
                anim._draw_next_frame(d, blit=False)
                self.check_graphic()
Example #3
0
def main(path):
    fdirs = os.path.join(path, 'pressure/*')

    pressure = iris.load_cube(fdirs, 'mslpressure')

    pressure_slices = pressure.slices(['projection_y_coordinate',
                                       'projection_x_coordinate'])
    # Subsample the cube, correct units and convert to millibars
    pressure_slices = [slice[::10, ::10] for slice in pressure_slices]
    for slice in pressure_slices:
        slice.units = 'mb/10'
        slice.convert_units('mb')

    ani = animate(pressure_slices, custom_contour)

    print 'saving...'
    ani.save('wind_simple.avi', bitrate=1000)
    print 'completed'
    plt.show()
Example #4
0
def main(path):
    fdirs = os.path.join(path, 'pressure/*')

    pressure = iris.load_cube(fdirs, 'mslpressure')

    pressure_slices = pressure.slices(['projection_y_coordinate',
                                       'projection_x_coordinate'])
    # Subsample the cube, correct units and convert to millibars
    pressure_slices = [slice[::10, ::10] for slice in pressure_slices]
    for slice in pressure_slices:
        slice.units = 'mb/10'
        slice.convert_units('mb')

    ani = animate(pressure_slices, custom_contour)

    print 'saving...'
    ani.save('wind_simple.avi', bitrate=1000)
    print 'completed'
    plt.show()
Example #5
0
    def test_cube_animation(self):
        # This follows :meth:`~matplotlib.animation.FuncAnimation.save`
        # to ensure that each frame corresponds to known accepted frames for
        # the animation.
        cube_iter = self.cube.slices(("latitude", "longitude"))

        ani = animate.animate(cube_iter, iplt.contourf)

        # Disconnect the first draw callback to stop the animation.
        ani._fig.canvas.mpl_disconnect(ani._first_draw_id)
        # Update flag to indicate drawing happens.  Without this, a warning is
        # thrown when the ani object is destroyed, and this warning sometimes
        # interferes with unrelated tests (#4330).
        ani._draw_was_started = True

        ani = [ani]
        # Extract frame data
        for data in zip(*[a.new_saved_frame_seq() for a in ani]):
            # Draw each frame
            for anim, d in zip(ani, data):
                anim._draw_next_frame(d, blit=False)
                self.check_graphic()