In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm
import glob
import weather_symbol
from mpl_toolkits.basemap import Basemap
In [44]:
all_files = glob.glob('data_files/*.csv')
location_list =[]
lat_list = []
lon_list = []
for line in open('location_data.txt'):
col = line.split()
location_list.append(col[0])
lat_list.append(float(col[1]))
lon_list.append(float(col[2]))
print lon_list
This code makes the basemap and plots the locations
In [56]:
plt.figure(figsize=[12,12])
map = Basemap(projection='merc', lat_0=55, lon_0=1.5,
resolution='l', area_thresh=100.0,
llcrnrlon=-10.55, llcrnrlat=49.5,
urcrnrlon=3.55, urcrnrlat=59.5)
map.drawcoastlines()
map.drawcountries()
map.bluemarble()
Out[56]:
In [ ]:
weather_list = ['']
for xx in range(len(all_files)):
fname = all_files[xx]
array = np.loadtxt(fname, dtype=str, delimiter=',')
time = int(array[8,5])
color, sym , weather= weather_symbol.w_s(time)
x,y = map(lon_list[xx], lat_list[xx])
map.plot(x,y,color=color,marker=sym,markersize=13, label=weather)
plt.text(x+20000,y+20000,location_list[xx], color='white')
plt.legend()
til = 'Met Office Forecast for time step '
time_step = int(array[10,5])/ 60
plt.title(til+str(time_step)+':00')
plt.show()
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
lons.df = DataFrame(lons)
Join additional data to location data fram
In [4]:
import pandas as pd
forcast_1 = pd.merge(loc_df, DATA, on='Location', how='Outer')
In [ ]:
In [ ]: