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


[-1.54, -3.19, 0.0, -2.58, -4.25, -3.18, -2.23, -1.25, -3.53, -1.89, -1.6]

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]:
<matplotlib.image.AxesImage at 0x11c982f50>

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()
make a data fram to join additional data

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')


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-0c2e4d8fa13a> in <module>()
----> 1 drawmapscale(
      2     coords[0] + 0.08, coords[1] + 0.015,
      3     coords[0], coords[1],
      4     10.,
      5     barstyle='fancy', labelstyle='simple',

NameError: name 'drawmapscale' is not defined

In [ ]:


In [ ]: