Im experiencing very poor performance when using the 'quiver' function over relatively large grids.
Im using quiver to plot wind 'u,v' data over a lat/lon grid using basemap.
quiver performs decently over small lat/lon ranges, such as a bounding box of lat(0-30),lon(-120- -100), but when I try to plot larger areas (i.e. the entire globe), quiver causes a very large pause. through some debugging of quiver.py, I narrowed down the performance lag to the "set_vertices" function call within the "draw()" function in the quiver class. as a test, I printed 'len(vert)' in order to see the vertice array length that was causing problems...it seems that Im getting vertice counts in the high thousands, and quiver seems to struggle with this.
should quiver be able to easily handle such a large amount of vertices?
A secondary question:
the method Im using to create my X,Y,U,V arrays is creating 'larger-than-necessary' X,Y arrays; i.e., Im not plotting the U,V vectors at each lat&lon point, Im 'skipping' over 'every-nth-point', so my U,V arrays are equal in size to my X,Y arrays, but have many empty elements.
Unfortunately, the array data is being imported from an external program (named 'GRADS'), so I cannot prevent these arrays from being 'oversized' upon their creation.
example:
for a (10 degree lat)x(10 degree lon) area, I might have arrays like this:
X='[0,0.5,1.0,1.5,2.0,2.5,...10.0],[0,0.5,...10],...[0.0,0.5,...10.0]'
Y='[0,0.5,1.0,1.5,2.0,2.5,...10.0],[0,0.5,...10],...[0.0,0.5,...10.0]'
U='[--,--,0.40,--,--,0.15,...0.30],[--,--,0.25,--,--...,0.12],...[--,--,0.50,...10.0]'
V='[--,--,0.30,--,--,0.25,...0.40],[--,--,0.25,--,--...,0.12],...[--,--,0.50,...10.0]'
these values are completely inaccurate and are meant just to illustrate the fact that I have many 'skipped' values in my U,V arrays, and I have oversized X,Y arrays that cover the 10x10 lat/lon grid...
So, what I want to do is create NEW X,Y,U,V arrays or remove elements from these existing X,Y,U,V arrays, so that:
1) only valid, "non-empty" values will exist in my U,V arrays..and
2) the only values that exist in X,Y are those that correspond to valid points in the U,V arrays...
Im not very experienced with python/matplotlib, so I dont know what would be the best way to iterate over these 4 arrays and remove the empty invalid elements (or copy the valid elements into new arrays). How can I go about shortening these arrays?
Im hoping that with less points in my X,Y arrays, that quiver will perform faster since it isnt wasting time trying to process X,Y points where U,V are empty).
Please help,
P.Romero
···
_________________________________________________________________
Hotmail® is up to 70% faster. Now good news travels really fast.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009