# Basemap transform_vector for decreasing latitudes

Greetings!

Relative newbie here.

I'm trying to plot wind vectors using basemap quiver and to fit my ortho
projection. This is essentially a hack of Jeff Whitaker's animate.py found
at

https://github.com/matplotlib/basemap/blob/master/examples/animate.py

The data source I'm connecting to, however, has the latitudes in decreasing
order, so I get the "lats and lons must be in increasing order!" exception
when trying to use the transform_vector method which seems to be required to
fit the vectors to the projection. (ugliness occurs when failing to
transform)

What would be the best way to transform latitudes (to increasing) as needed
by transform_vector, while also accounting for the data order of my u and v
grids?

-kevin.

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Basemap-transform-vector-for-decreasing-latitudes-tp41375.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

kmanross

July 2, 2013 12:42 PM

Greetings!

Relative newbie here.

I’m
trying to plot wind vectors using basemap quiver and to fit my ortho
projection.
This is essentially a hack of Jeff Whitaker’s animate.py found
at

The
data source I’m connecting to, however, has the latitudes in decreasingorder,
so I get the “lats and lons must be in increasing order!” exceptionwhen
trying to use the transform_vector method which seems to be required tofit
the vectors to the projection. (ugliness occurs when failing totransform)What
would be the best way to transform latitudes (to increasing) as neededby
transform_vector, while also accounting for the data order of my u and vgrids?-kevin.

Kevin:
Just flip the data around.

lats_flipped = lats[::-1,:]
data_flipeed
= data[::-1,:] # assuming 2d array shape (nlats,nlons)

-Jeff

···

https://github.com/matplotlib/basemap/blob/master/examples/animate.py

http://matplotlib.1069221.n5.nabble.com/Basemap-transform-vector-for-decreasing-latitudes-tp41375.html

http://p.sf.net/sfu/windows-dev2dev