<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1:  2017 Hurricane Tracks
Demonstrates how to plot all the North American hurricane tracks in 2017, starting from the BigQuery public dataset.
Step2:  Plot one of the hurricanes
Let's just plot the track of Hurricane MARIA
Step3:  Plot all the hurricanes
Use line thickness based on the maximum category reached by the hurricane
<ASSISTANT_TASK:>
Python Code:
%bash
apt-get update
apt-get -y install python-mpltoolkits.basemap 
from mpl_toolkits.basemap import Basemap
import google.datalab.bigquery as bq
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
query=
#standardSQL
SELECT
  name,
  latitude,
  longitude,
  iso_time,
  usa_sshs
FROM
  `bigquery-public-data.noaa_hurricanes.hurricanes`
WHERE
  basin = 'NA'
  AND season = '2017'
df = bq.Query(query).execute().result().to_dataframe()
df.head()
Explanation: 2017 Hurricane Tracks
Demonstrates how to plot all the North American hurricane tracks in 2017, starting from the BigQuery public dataset.
End of explanation
maria = df[df['name'] == 'MARIA'].sort_values('iso_time')
m = Basemap(llcrnrlon=-100.,llcrnrlat=0.,urcrnrlon=-20.,urcrnrlat=57.,
            projection='lcc',lat_1=20.,lat_2=40.,lon_0=-60.,
            resolution ='l',area_thresh=1000.)
x, y = m(maria['longitude'].values,maria['latitude'].values)
m.plot(x,y,linewidth=5,color='r')
# draw coastlines, meridians and parallels.
m.drawcoastlines()
m.drawcountries()
m.drawmapboundary(fill_color='#99ffff')
m.fillcontinents(color='#cc9966',lake_color='#99ffff')
m.drawparallels(np.arange(10,70,20),labels=[1,1,0,0])
m.drawmeridians(np.arange(-100,0,20),labels=[0,0,0,1])
plt.title('Hurricane Maria (2017)');
Explanation: Plot one of the hurricanes
Let's just plot the track of Hurricane MARIA
End of explanation
names = df.name.unique()
names
m = Basemap(llcrnrlon=-100.,llcrnrlat=0.,urcrnrlon=-20.,urcrnrlat=57.,
            projection='lcc',lat_1=20.,lat_2=40.,lon_0=-60.,
            resolution ='l',area_thresh=1000.)
for name in names:
  if name != 'NOT_NAMED':
    named = df[df['name'] == name].sort_values('iso_time')
    x, y = m(named['longitude'].values,named['latitude'].values)
    maxcat = max(named['usa_sshs'])
    m.plot(x,y,linewidth=maxcat,color='b')
   
# draw coastlines, meridians and parallels.
m.drawcoastlines()
m.drawcountries()
m.drawmapboundary(fill_color='#99ffff')
m.fillcontinents(color='#cc9966',lake_color='#99ffff')
m.drawparallels(np.arange(10,70,20),labels=[1,1,0,0])
m.drawmeridians(np.arange(-100,0,20),labels=[0,0,0,1])
plt.title('Named North-Atlantic hurricanes (2017)');
Explanation: Plot all the hurricanes
Use line thickness based on the maximum category reached by the hurricane
End of explanation
<END_TASK>