iris animation error

57 views
Skip to first unread message

박기병

unread,
Nov 25, 2013, 8:02:47 PM11/25/13
to scitoo...@googlegroups.com

import iris
import iris.quickplot as qplt
import iris.plot as iplt
import matplotlib.pyplot as plt
import matplotlib.animation as animate
import matplotlib.animation as animation

fname1 = 'qwumgla_pb000'

cubes = iris.load(fname)
#print cubes

kb=cubes[3]

pkb=kb[0,19,:,:]

cube_iter = pkb.slices(('longitude', 'latitude'))
ani = animate(cube_iter, qplt.contourf)
plt.show()
Photo of the error code.

Python code running above August

What is wrong?
 
에니매이션애러.bmp

Andrew Dawson

unread,
Nov 26, 2013, 4:39:46 AM11/26/13
to scitoo...@googlegroups.com
Hi

There are a couple of errors here. You really should be using the animation feature provided with Iris rather than the one built-in to matplotlib. Try this:

import iris
import iris.quickplot as qplt
from iris.experimental.animate import animate
import matplotlib.pyplot as plt


fname1
= 'qwumgla_pb000'
cubes
= iris.load(fname)

kb
= cubes[3]
pkb
= kb[0, 19, :, :]  # I think this might be wrong


cube_iter
= pkb.slices(('longitude', 'latitude'))
ani
= animate(cube_iter, qplt.contourf)
plt
.show()

Remember that you need to have more than one latitude-longitude slice in order to animate it. I suspect you might want something like:

pkb = kb[:, 19, :, :]

Let us know if you still have problems.

Andrew Dawson

unread,
Nov 26, 2013, 4:40:45 AM11/26/13
to scitoo...@googlegroups.com
Also, see the documentation here http://scitools.org.uk/iris/docs/latest/iris/iris/experimental/animate.html for further reference.

박기병

unread,
Nov 27, 2013, 1:58:46 AM11/27/13
to scitoo...@googlegroups.com
Thank you for answer.

Suggests the same error code.

Example, could the same thing?
 
Thanks.

Andrew Dawson

unread,
Nov 27, 2013, 4:01:50 AM11/27/13
to scitoo...@googlegroups.com
This problem is solved but I forgot to reply to the group. There was a follow-up question, pasted below. I don't work at the Met Office so I can't help, but I'm sure some one who does will get back to you.

Can I ask a few more?
 
Had seen the Blay, Byron asked. 
 
kma computer's iris option is
 
cartopy-0.7.0
 
graphviz-2.30.1
 
Imaging-1.1.7
 
iris-1.5.1
 
matplotlib-1.2.1
 
mock 1.0.1
 
netcdf4-1.0.2
 
nose-1.3.0
 
numpy-1.7.1
 
pyke-1.1.1
 
scipy-0.12.0
 
setuptools-0.6c11
 
Shapely-master
 
udunits-2.1.24
 
unpack-030712
 
What is the met-office iris's options?
 
Thanks a lot.
Reply all
Reply to author
Forward
0 new messages