0

Good day to all

I have 3 1D arrays of data, let’s say lat=[28.9, 30.2, 27.5], lon=[18.0, 17.6, 18.85], Temp=[22.22, 20.1, 20.1]. Please notice that none of them is in ascending or descending order of values. How can I make the required 2D arrays to plot them over a basemap with contourf of matplotlib? I understand that I first have to arrange the lon and lat arrays in ascending order (using sort) and then create the meshgrid. My problem is how to create the related 2D array of Temp.

Thank you in advance Sakis

athakarag
  • 1
  • 1
  • Dear sir. I really don't think the 3 answers you suggest answer to my question. My question is how to form the new grid. I do not want to interpolate and my need for plotting the grid is secondary. Could you please explain where exactly I could look for the answer? I am really sorry for wasting your time. Kind regards. Sakis – athakarag Mar 14 '20 at 10:37
  • Well, if you want to create a contourf, as your post title suggests, you should forget about wanting to put the points on a grid, and use tricontourf. – JohanC Mar 14 '20 at 10:44
  • If your goal is to create a regular grid, without a need for contourf, use scipy.interpolate.griddata as explained in one of the linked answers. – JohanC Mar 14 '20 at 10:52

0 Answers0