[SciPy-User] Problem with creating a raster image like regular grid using SciPy

Artur Bercik vbubbly21 at gmail.com
Wed Nov 5 10:58:29 EST 2014


Dear SciPy users:

I have the numpy arrays of longitudes, latitudes, and the data. As you see
the array of longitudes and latitudes, they are not in a regular grid. I
want to make a regular grid (like a raster image) from such scatterred data.

I have made it using interp2d function available in scipy.
However, when I read the docs of interp2d carefully, the docs says that the
x and y represent a regular grid. But my x(lons) and y (lats) are not
regular grid. So in this case, how can I make a raster image like regular
grid?

longitudes = np.array([[139.79391479492188, 140.51760864257812,
141.19119262695312, 141.82083129882812, 142.41165161132812],
        [139.79225158691406, 140.51416015625, 141.18606567382812,
141.8140869140625, 142.40338134765625],
        [139.78591918945312, 140.50637817382812, 141.17694091796875,
141.80377197265625, 142.3919677734375],
        [139.78387451171875, 140.50253295898438, 141.17147827148438,
141.79678344726562, 142.38360595703125],
        [139.77781677246094, 140.4949951171875, 141.16250610351562,
141.78646850585938, 142.37196350097656]],dtype=float)


latitudes =  np.array([[55.61929702758789, 55.621070861816406,
55.61888122558594, 55.613487243652344, 55.60547637939453],
             [55.53120040893555, 55.532840728759766, 55.53053665161133,
55.525047302246094, 55.5169677734375],
             [55.44305419921875, 55.444580078125, 55.44219207763672,
55.43663024902344, 55.42848587036133],
             [55.35470199584961, 55.356109619140625, 55.353614807128906,
55.34796905517578, 55.33975601196289],
             [55.26683807373047, 55.268131256103516, 55.26553726196289,
55.25981140136719, 55.25152587890625]],dtype=float)

data =  np.array([[10, 10, 10, 10, 10],
        [20, 20, 20, 20, 20],
        [30, 30, 30, 30, 30],
        [40, 40, 40, 40, 40],
        [50, 50, 50, 50, 50]],dtype=float)


I hope someone can help me.

Thanks in the advance.

Artur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20141106/a049d542/attachment.html>


More information about the SciPy-User mailing list