-1
I tried two codes, but both generates the error:
IndexError: list index out of range
I want to score points on the world map, of drift buoys. This data is in a csv file, with the lat and Lon column with their position. I think the problem is that, as much as they are moving (the buoys), there is a lot of repeated data, because their movement is slow, in relation to the time of data collection. I wonder if anyone can help me?
Um dos códigos:
#!/usr/bin/env python3
# Plota dados de estaço
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
# Carrega as variáveis em listas
lat, lon, temp = np.loadtxt('teste.csv', usecols=(0,1,2), unpack=True) ####ERRO AQUI
# Define os limites da grade do mapa
lon_left = np.min(lon)-0.5
lon_right = np.max(lon)+0.5
lat_low = np.min(lat)-0.95
lat_high = np.max(lat)+0.95
# Define as configuraçes do mapa
m = Basemap(projection='mill', resolution='l', llcrnrlon=lon_left, llcrnrlat=lat_low, urcrnrlon=lon_right, urcrnrlat=lat_high)
m.readshapefile('/Shapefile - Estados_do_Brasil-20190820T220437Z-001/Shapefile - Estados_do_Brasil/Brasil','Brasil',linewidth=0.1)
m.drawmeridians(np.arange(lon_left,lon_right,1.0),labels=[0,0,0,1], color='black', fontsize=10, linewidth=0.1, fmt='%1.1f')
m.drawparallels(np.arange(lat_low,lat_high,1.0),labels=[1,0,0,0], color='black', fontsize=10, linewidth=0.1, fmt='%1.1f')
m.drawcountries()
# Plota os dados de estaço
x, y = m(lon, lat)
plt.scatter(x, y, c=temp, cmap ='RdYlGn_r')
for label, xpt, ypt in zip(temp, x, y):
plt.text(xpt-15000, ypt+7000, label)
# Plota barra de cores e titulo
plt.colorbar()
plt.title('Temperatura Máxima')
plt.tight_layout()
plt.show()
Filing cabinet CSV.
Thank you