matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
779 stars 392 forks source link

Is basemap.rotate_vector working correctly? #294

Open guziy opened 8 years ago

guziy commented 8 years ago

I have another indication that there might be something wrong in case of the rotpole projection, I'll try to make an example with that, later when I have some time. But for now please see the example below, should those to arrows be identical in this projection? (red is the rotated one and green is the original one) ...

figure_1


    import numpy as np
    from mpl_toolkits.basemap import Basemap
    import matplotlib.pyplot as plt

    u = np.array([0.5, ])
    v = np.array([0.5, ])

    lon = -84
    lat = 45

    lon = np.array([lon, ])
    lat = np.array([lat, ])

    b = Basemap(lon_0=0)

    urot, vrot = b.rotate_vector(u, v, lon, lat)
    xx, yy = b(lon, lat)

    b.quiver(xx, yy, urot, vrot, color="r")

    b.quiver(xx, yy, u, v, color="g")

    b.drawcoastlines()

Cheers

guziy commented 8 years ago

OK, sorry I was too soon to conclude about the rotpole, that one seems to be fine, my problem was the range of longitudes: I was using [0, 360] instead of [-180, 180] for rotation, and the results were weird...

The example above looks like an accuracy problem, which is understandable... So if it is OK with everyone I'll close the issue.

Cheers

WeatherGod commented 8 years ago

Is cylindrical direction-preserving? I wish there was a simple table that showed projection type (rows) and property (columns) and stated whether that property was preserved or not.

On Fri, May 6, 2016 at 11:57 AM, Huziy Oleksandr (Sasha) < notifications@github.com> wrote:

OK, sorry I was too soon to conclude about the rotpole, that one seems to be fine, my problem was the range of longitudes: I was using [0, 360] instead of [-180, 180] for rotation, and the results were weird...

The example below looks like an accuracy problem, which is understandable... So if it is OK with everyone I'll close the issue.

Cheers

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/matplotlib/basemap/issues/294#issuecomment-217483266

guziy commented 8 years ago

@WeatherGod the arrows are identical when either u or v component of the vector is 0, so I would expect it to be direction conserving...