Anne Martin
Anne Martin

Reputation: 11

creating 2d array from single arrays

I have observation data from a satellite called Aeolus. The data are single arrays. So one 1D array for date and time, one for latitude information, one for longitude information and one for wind speed.

date_aeolus
lat_aeolus
lon_aeolus
wind_aeolus

In the end I would like to create a pcolormesh lat - lon plot of the wind speed. But therefore I need the wind speed as 2D:

wind_aeolus[lat,lon]

How can I create such an array?

Upvotes: 0

Views: 67

Answers (1)

CanadianCaleb
CanadianCaleb

Reputation: 136

if you are looking to just make a 2D array, a couple for loops should work fine.

lat = ['1', '2', '3']
lon = ['2', '3', '4']

Array = []

for i in range(0, len(lat)) :
    Array.append([lat[i]])

for i in range(0, len(Array)) :
    Array[i].append(lon[i])

The zip() function also works well in this situation, like @user2977071 said.

zip(lat, lon)

Upvotes: 0

Related Questions