![]() ![]() I came to this post some time ago when trying to do something similar, this is, reprojecting polar data into a cartesian grid and vice-versa. Just posting the code in case it is useful to anyone else. Which is not strictly re-gridding, but works fine for what I need. # Interpolate polar grid to cartesian grid (cubic spline)Īx.imshow(polar2cartesian(r, t, z, x, y, order=3), interpolation='nearest') # Interpolate polar grid to cartesian grid (nearest neighbor)Īx.imshow(polar2cartesian(r, t, z, x, y, order=0), interpolation='nearest') Ir = interp1d(r, np.arange(len(r)), bounds_error=False) ![]() Thanks for your answers - after thinking a bit more about this I came up with the following code: import numpy as npįrom scipy.ndimage import map_coordinatesĭef polar2cartesian(r, t, grid, x, y, order=3): ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |