In [21]:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import matplotlib
from matplotlib import colors,colorbar
import matplotlib
%matplotlib inline
import csv 
import math
from math import radians, cos, sin, asin, sqrt

In [39]:
satellite_radius = 1500

def haversine(lon1, lat1, lon2, lat2):
    """
    Calculate the great circle distance between two points 
    on the earth (specified in decimal degrees)
    """
    # convert decimal degrees to radians 
    lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])

    # haversine formula 
    dlon = lon2 - lon1 
    dlat = lat2 - lat1 
    a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
    c = 2 * asin(sqrt(a)) 
    r = 6371 # Radius of earth in kilometers. Use 3956 for miles
    return c * r

def distance_between_boxes(lat_box_0,lon_box_0,lat_box_1,lon_box_1):
    lat1 = lat_box_0*5-90+2.5
    lat2 = lat_box_1*5-90+2.5
    lon1 = lon_box_0*5-180+2.5
    lon2 = lon_box_1*5-180+2.5
    return haversine(lon1, lat1, lon2, lat2)


lat_box_not = 30
lon_box_not = 0

grid_for_average = [ [[] for i in range(72)] for k in range(36)]
# grid_for_average[lat_box][lon_box] -- a list of the other values we should average across

for lat_box in range(36):
    for lon_box in range(72):        
        for i in range (36):
            for k in range (72):
                dist = distance_between_boxes(i,k,lat_box,lon_box)
                if dist < satellite_radius:
                    #print i*5-90+2.5, k*5-180+2.5, distance_between_boxes(i,k,lat_box_not,lon_box_not)
                    grid_for_average[lat_box][lon_box].append([i,k,1.])
                elif dist< 2*satellite_radius:
                    scale_factor = (2*satellite_radius - dist)/satellite_radius 
                    # we want this to be 0 2*satellite_radius and 1 at the satellite_radius
                    grid_for_average[lat_box][lon_box].append([i,k,scale_factor])
                # print i,k,lat_box_0,lon_box_0


#print grid_for_average[0][0]
#print grid_for_average[18][36]


[[0, 0, 1.0], [0, 1, 1.0], [0, 2, 1.0], [0, 3, 1.0], [0, 4, 1.0], [0, 5, 1.0], [0, 6, 1.0], [0, 7, 1.0], [0, 8, 1.0], [0, 9, 1.0], [0, 10, 1.0], [0, 11, 1.0], [0, 12, 1.0], [0, 13, 1.0], [0, 14, 1.0], [0, 15, 1.0], [0, 16, 1.0], [0, 17, 1.0], [0, 18, 1.0], [0, 19, 1.0], [0, 20, 1.0], [0, 21, 1.0], [0, 22, 1.0], [0, 23, 1.0], [0, 24, 1.0], [0, 25, 1.0], [0, 26, 1.0], [0, 27, 1.0], [0, 28, 1.0], [0, 29, 1.0], [0, 30, 1.0], [0, 31, 1.0], [0, 32, 1.0], [0, 33, 1.0], [0, 34, 1.0], [0, 35, 1.0], [0, 36, 1.0], [0, 37, 1.0], [0, 38, 1.0], [0, 39, 1.0], [0, 40, 1.0], [0, 41, 1.0], [0, 42, 1.0], [0, 43, 1.0], [0, 44, 1.0], [0, 45, 1.0], [0, 46, 1.0], [0, 47, 1.0], [0, 48, 1.0], [0, 49, 1.0], [0, 50, 1.0], [0, 51, 1.0], [0, 52, 1.0], [0, 53, 1.0], [0, 54, 1.0], [0, 55, 1.0], [0, 56, 1.0], [0, 57, 1.0], [0, 58, 1.0], [0, 59, 1.0], [0, 60, 1.0], [0, 61, 1.0], [0, 62, 1.0], [0, 63, 1.0], [0, 64, 1.0], [0, 65, 1.0], [0, 66, 1.0], [0, 67, 1.0], [0, 68, 1.0], [0, 69, 1.0], [0, 70, 1.0], [0, 71, 1.0], [1, 0, 1.0], [1, 1, 1.0], [1, 2, 1.0], [1, 3, 1.0], [1, 4, 1.0], [1, 5, 1.0], [1, 6, 1.0], [1, 7, 1.0], [1, 8, 1.0], [1, 9, 1.0], [1, 10, 1.0], [1, 11, 1.0], [1, 12, 1.0], [1, 13, 1.0], [1, 14, 1.0], [1, 15, 1.0], [1, 16, 1.0], [1, 17, 1.0], [1, 18, 1.0], [1, 19, 1.0], [1, 20, 1.0], [1, 21, 1.0], [1, 22, 1.0], [1, 23, 1.0], [1, 24, 1.0], [1, 25, 1.0], [1, 26, 1.0], [1, 27, 1.0], [1, 28, 1.0], [1, 29, 1.0], [1, 30, 1.0], [1, 31, 1.0], [1, 32, 1.0], [1, 33, 1.0], [1, 34, 1.0], [1, 35, 1.0], [1, 36, 1.0], [1, 37, 1.0], [1, 38, 1.0], [1, 39, 1.0], [1, 40, 1.0], [1, 41, 1.0], [1, 42, 1.0], [1, 43, 1.0], [1, 44, 1.0], [1, 45, 1.0], [1, 46, 1.0], [1, 47, 1.0], [1, 48, 1.0], [1, 49, 1.0], [1, 50, 1.0], [1, 51, 1.0], [1, 52, 1.0], [1, 53, 1.0], [1, 54, 1.0], [1, 55, 1.0], [1, 56, 1.0], [1, 57, 1.0], [1, 58, 1.0], [1, 59, 1.0], [1, 60, 1.0], [1, 61, 1.0], [1, 62, 1.0], [1, 63, 1.0], [1, 64, 1.0], [1, 65, 1.0], [1, 66, 1.0], [1, 67, 1.0], [1, 68, 1.0], [1, 69, 1.0], [1, 70, 1.0], [1, 71, 1.0], [2, 0, 1.0], [2, 1, 1.0], [2, 2, 1.0], [2, 3, 1.0], [2, 4, 1.0], [2, 5, 1.0], [2, 6, 1.0], [2, 7, 1.0], [2, 8, 1.0], [2, 9, 1.0], [2, 10, 1.0], [2, 11, 1.0], [2, 12, 1.0], [2, 13, 1.0], [2, 14, 1.0], [2, 15, 1.0], [2, 16, 1.0], [2, 17, 1.0], [2, 18, 1.0], [2, 19, 1.0], [2, 20, 1.0], [2, 21, 1.0], [2, 22, 0.9950309612822759], [2, 23, 0.9813351520158626], [2, 24, 0.9683537120656469], [2, 25, 0.9561574402606293], [2, 26, 0.9448108616260205], [2, 27, 0.9343723739738821], [2, 28, 0.9248943868072267], [2, 29, 0.9164234494487374], [2, 30, 0.9090003665137232], [2, 31, 0.9026602997098587], [2, 32, 0.8974328555380395], [2, 33, 0.8933421588509667], [2, 34, 0.8904069124489258], [2, 35, 0.8886404429957696], [2, 36, 0.8880507335544126], [2, 37, 0.8886404429957696], [2, 38, 0.8904069124489258], [2, 39, 0.8933421588509667], [2, 40, 0.8974328555380395], [2, 41, 0.9026602997098587], [2, 42, 0.9090003665137232], [2, 43, 0.9164234494487371], [2, 44, 0.9248943868072267], [2, 45, 0.9343723739738821], [2, 46, 0.9448108616260205], [2, 47, 0.9561574402606293], [2, 48, 0.9683537120656471], [2, 49, 0.9813351520158626], [2, 50, 0.9950309612822759], [2, 51, 1.0], [2, 52, 1.0], [2, 53, 1.0], [2, 54, 1.0], [2, 55, 1.0], [2, 56, 1.0], [2, 57, 1.0], [2, 58, 1.0], [2, 59, 1.0], [2, 60, 1.0], [2, 61, 1.0], [2, 62, 1.0], [2, 63, 1.0], [2, 64, 1.0], [2, 65, 1.0], [2, 66, 1.0], [2, 67, 1.0], [2, 68, 1.0], [2, 69, 1.0], [2, 70, 1.0], [2, 71, 1.0], [3, 0, 0.888050733554413], [3, 1, 0.8872319400239849], [3, 2, 0.8847852994240843], [3, 3, 0.8807397751983848], [3, 4, 0.8751428010260388], [3, 5, 0.8680590781089459], [3, 6, 0.8595689955248436], [3, 7, 0.8497667635985207], [3, 8, 0.8387583584640936], [3, 9, 0.8266593752546879], [3, 10, 0.8135928790416052], [3, 11, 0.7996873288759954], [3, 12, 0.785074633450246], [3, 13, 0.7698883792292244], [3, 14, 0.7542622552017844], [3, 15, 0.738328683899718], [3, 16, 0.7222176566834881], [3, 17, 0.7060557626780498], [3, 18, 0.6899653949821354], [3, 19, 0.6740641144787005], [3, 20, 0.6584641502514816], [3, 21, 0.6432720157592718], [3, 22, 0.6285882210759076], [3, 23, 0.614507063283683], [3, 24, 0.6011164792076139], [3, 25, 0.5884979468742634], [3, 26, 0.5767264242178429], [3, 27, 0.5658703155408703], [3, 28, 0.5559914580126564], [3, 29, 0.5471451220337494], [3, 30, 0.539380020606829], [3, 31, 0.5327383239470458], [3, 32, 0.5272556764579861], [3, 33, 0.5229612139180323], [3, 34, 0.5198775792920539], [3, 35, 0.5180209360310439], [3, 36, 0.5174009780725504], [3, 37, 0.5180209360310439], [3, 38, 0.5198775792920539], [3, 39, 0.5229612139180323], [3, 40, 0.5272556764579861], [3, 41, 0.5327383239470458], [3, 42, 0.539380020606829], [3, 43, 0.5471451220337494], [3, 44, 0.5559914580126564], [3, 45, 0.5658703155408703], [3, 46, 0.5767264242178429], [3, 47, 0.5884979468742632], [3, 48, 0.6011164792076139], [3, 49, 0.614507063283683], [3, 50, 0.6285882210759076], [3, 51, 0.6432720157592718], [3, 52, 0.6584641502514816], [3, 53, 0.6740641144787004], [3, 54, 0.6899653949821352], [3, 55, 0.7060557626780498], [3, 56, 0.7222176566834881], [3, 57, 0.738328683899718], [3, 58, 0.7542622552017844], [3, 59, 0.769888379229224], [3, 60, 0.7850746334502461], [3, 61, 0.7996873288759954], [3, 62, 0.8135928790416048], [3, 63, 0.8266593752546877], [3, 64, 0.8387583584640936], [3, 65, 0.8497667635985207], [3, 66, 0.8595689955248436], [3, 67, 0.8680590781089459], [3, 68, 0.8751428010260388], [3, 69, 0.8807397751983848], [3, 70, 0.8847852994240843], [3, 71, 0.8872319400239849], [4, 0, 0.51740097807255], [4, 1, 0.5166123681340611], [4, 2, 0.514254938017513], [4, 3, 0.5103537124838834], [4, 4, 0.5049498269198224], [4, 5, 0.49809969772013574], [4, 6, 0.489873916492541], [4, 7, 0.4803559177578818], [4, 8, 0.46964047638884465], [4, 9, 0.45783209333064256], [4, 10, 0.44504332648834194], [4, 11, 0.43139311872946473], [4, 12, 0.41700516764364054], [4, 13, 0.4020063730012344], [4, 14, 0.38652538867787734], [4, 15, 0.3706912969270858], [4, 16, 0.354632414852915], [4, 17, 0.3384752361122346], [4, 18, 0.3223435054243255], [4, 19, 0.3063574193927937], [4, 20, 0.2906329443501421], [4, 21, 0.2752812402497951], [4, 22, 0.26040817885347434], [4, 23, 0.24611394438833], [4, 24, 0.23249270528701768], [4, 25, 0.2196323464082634], [4, 26, 0.20761425212820178], [4, 27, 0.1965131317863276], [4, 28, 0.18639688008430827], [4, 29, 0.17732646611517247], [4, 30, 0.16935584570803378], [4, 31, 0.16253189268885398], [4, 32, 0.15689434547182615], [4, 33, 0.15247576610860233], [4, 34, 0.14930150953982685], [4, 35, 0.1473897013255076], [4, 36, 0.14675122259068757], [4, 37, 0.1473897013255076], [4, 38, 0.14930150953982685], [4, 39, 0.15247576610860233], [4, 40, 0.15689434547182615], [4, 41, 0.16253189268885398], [4, 42, 0.16935584570803378], [4, 43, 0.17732646611517217], [4, 44, 0.18639688008430796], [4, 45, 0.1965131317863276], [4, 46, 0.20761425212820178], [4, 47, 0.2196323464082631], [4, 48, 0.232492705287018], [4, 49, 0.24611394438833], [4, 50, 0.26040817885347434], [4, 51, 0.2752812402497951], [4, 52, 0.2906329443501421], [4, 53, 0.30635741939279343], [4, 54, 0.3223435054243255], [4, 55, 0.3384752361122346], [4, 56, 0.35463241485291475], [4, 57, 0.3706912969270858], [4, 58, 0.38652538867787706], [4, 59, 0.4020063730012344], [4, 60, 0.41700516764364054], [4, 61, 0.43139311872946473], [4, 62, 0.44504332648834194], [4, 63, 0.45783209333064256], [4, 64, 0.46964047638884465], [4, 65, 0.4803559177578818], [4, 66, 0.489873916492541], [4, 67, 0.49809969772013574], [4, 68, 0.5049498269198224], [4, 69, 0.5103537124838834], [4, 70, 0.514254938017513], [4, 71, 0.5166123681340611], [5, 0, 0.14675122259068787], [5, 1, 0.1459811034060349], [5, 2, 0.14367839264462873], [5, 3, 0.13986589630554166], [5, 4, 0.13458118189546167], [5, 5, 0.1278759332991728], [5, 6, 0.1198150833508198], [5, 7, 0.11047575662285514], [5, 8, 0.099946060048248], [5, 9, 0.08832376162089561], [5, 10, 0.07571489764146917], [5, 11, 0.06223234706159504], [5, 12, 0.047994407848354965], [5, 13, 0.03312340544462495], [5, 14, 0.01774435785474331], [5, 15, 0.0019837161155674037], [5, 57, 0.0019837161155674037], [5, 58, 0.017744357854743004], [5, 59, 0.03312340544462495], [5, 60, 0.047994407848354965], [5, 61, 0.06223234706159504], [5, 62, 0.07571489764146917], [5, 63, 0.08832376162089561], [5, 64, 0.099946060048248], [5, 65, 0.11047575662285514], [5, 66, 0.1198150833508198], [5, 67, 0.1278759332991728], [5, 68, 0.13458118189546167], [5, 69, 0.13986589630554166], [5, 70, 0.14367839264462873], [5, 71, 0.1459811034060349]]
[[13, 34, 0.010488623238872303], [13, 35, 0.11176118077684138], [13, 36, 0.14675122259068787], [13, 37, 0.11176118077684138], [13, 38, 0.010488623238872303], [14, 33, 0.15600529236766458], [14, 34, 0.34698704175943174], [14, 35, 0.4730118370963943], [14, 36, 0.5174009780725504], [14, 37, 0.4730118370963943], [14, 38, 0.34698704175943174], [14, 39, 0.15600529236766458], [15, 32, 0.15476955097002884], [15, 33, 0.43276360527014157], [15, 34, 0.6663661178100545], [15, 35, 0.8286885527574898], [15, 36, 0.8880507335544127], [15, 37, 0.8286885527574898], [15, 38, 0.6663661178100545], [15, 39, 0.43276360527014157], [15, 40, 0.15476955097002884], [16, 31, 0.007857581775801615], [16, 32, 0.3453749044582922], [16, 33, 0.6656708575043332], [16, 34, 0.9528132893801593], [16, 35, 1.0], [16, 36, 1.0], [16, 37, 1.0], [16, 38, 0.9528132893801593], [16, 39, 0.6656708575043332], [16, 40, 0.3453749044582922], [16, 41, 0.007857581775801615], [17, 31, 0.11062829765864747], [17, 32, 0.47222936060316684], [17, 33, 0.8282377579817017], [17, 34, 1.0], [17, 35, 1.0], [17, 36, 1.0], [17, 37, 1.0], [17, 38, 1.0], [17, 39, 0.8282377579817017], [17, 40, 0.47222936060316684], [17, 41, 0.11062829765864747], [18, 31, 0.1485435909873304], [18, 32, 0.5188265677496784], [18, 33, 0.8891151405398333], [18, 34, 1.0], [18, 35, 1.0], [18, 36, 1.0], [18, 37, 1.0], [18, 38, 1.0], [18, 39, 0.8891151405398333], [18, 40, 0.5188265677496784], [18, 41, 0.1485435909873304], [19, 31, 0.11766525752771426], [19, 32, 0.4777666406884588], [19, 33, 0.8322803918940164], [19, 34, 1.0], [19, 35, 1.0], [19, 36, 1.0], [19, 37, 1.0], [19, 38, 1.0], [19, 39, 0.8322803918940164], [19, 40, 0.4777666406884588], [19, 41, 0.11766525752771426], [20, 31, 0.021222776261397486], [20, 32, 0.3556122656848174], [20, 33, 0.6727772390903567], [20, 34, 0.95682214977948], [20, 35, 1.0], [20, 36, 1.0], [20, 37, 1.0], [20, 38, 0.95682214977948], [20, 39, 0.6727772390903567], [20, 40, 0.3556122656848174], [20, 41, 0.021222776261397486], [21, 32, 0.1685452810550411], [21, 33, 0.4418400996305233], [21, 34, 0.6710869024107696], [21, 35, 0.8300282375848871], [21, 36, 0.8880507335544127], [21, 37, 0.8300282375848871], [21, 38, 0.6710869024107696], [21, 39, 0.4418400996305233], [21, 40, 0.1685452810550411], [22, 33, 0.16628810368019337], [22, 34, 0.35206371332995967], [22, 35, 0.4743818241970903], [22, 36, 0.5174009780725504], [22, 37, 0.4743818241970903], [22, 38, 0.35206371332995967], [22, 39, 0.16628810368019337], [23, 34, 0.015759525196785945], [23, 35, 0.11314589169530337], [23, 36, 0.14675122259068787], [23, 37, 0.11314589169530337], [23, 38, 0.015759525196785945]]

In [5]:
def get_area(lat):
    lat_degree = 69 #miles
    # Convert latitude and longitude to 
    # spherical coordinates in radians.
    degrees_to_radians = math.pi/180.0        
    # phi = 90 - latitude
    phi = (lat+.05)*degrees_to_radians #plus 0.5 to get the middle
    lon_degree = math.cos(phi)*69 #miles
    # return 69*69*2.6
    return  lat_degree*lon_degree* 2.58999 #miles to square km

In [33]:
sourcedir = "../../data/density/"
filename = "density_2015.csv"


vessel_days = np.zeros(shape=(1800/50,3600/50)) #5 degree by 5 degree grid

with open(sourcedir + filename,'rU') as f:
    reader = csv.DictReader(f, delimiter=',')
    for row in reader:
        lat = int(row['lat_bin'])
        lon = int(row['lon_bin'])
        if lat<900 and lat>-900 and lon>-1800 and lon<1800:
            lat_index = (lat+900)/50
            lon_index = (lon+1800)/50
            days = int(row['number'])
            #area = get_area(lat/10) # area of 1 by 1 degree at a given lat
            vessel_days[lat_index][lon_index] += days/365. # vessels per 5x5 grid per day 
            # alternate math to get the amount per square km: (365* area*.1*.1)  #vessels per day per km

In [45]:
averages = np.zeros(shape=(36,72)) #5 degree by 5 degree grid

for i in range(36):
    for j in range(72):
        count = len(grid_for_average[i][j])
        total = 0
        for item in grid_for_average[i][j]:
            total += vessel_days[item[0]][item[1]]*item[2]
        averages[i][j]=total/4. 
        # divide by 4 because the satellite sees only 1/4 of the area that we're 
        #averaging over

In [61]:
tm = 1000. #this is just to scale the the following... this makes the colormap



colors = [["#FFFFFF",0,0],
          ['#894081', 5,5],
          ['#338ACA',10,10],
          ['#47AEC4',25,25],
          ['#49A578',50,50],
          ['#82B130',100,100],
          ['#F8C728',250,250],
          ['#EFA639',500,500],
          ['#E58230',1000,1000]]
                    
          
          
cdict = { 'red':tuple(   (color[2]/tm, int(color[0][1:3],16)/256.0, int(color[0][1:3],16)/256.0) for color in colors ),
          'green':tuple( (color[2]/tm, int(color[0][3:5],16)/256.0, int(color[0][3:5],16)/256.0) for color in colors ),
          'blue':tuple(  (color[2]/tm, int(color[0][5:7],16)/256.0, int(color[0][5:7],16)/256.0) for color in colors )}


tm = 1000.


cdict2 = { 'red':tuple(   (color[2]/tm, int(color[0][1:3],16)/256.0, int(color[0][1:3],16)/256.0) for color in colors ),
          'green':tuple( (color[2]/tm, int(color[0][3:5],16)/256.0, int(color[0][3:5],16)/256.0) for color in colors ),
          'blue':tuple(  (color[2]/tm, int(color[0][5:7],16)/256.0, int(color[0][5:7],16)/256.0) for color in colors )}#,
          #'alpha': ((0,0,0),(.00001,1,1),(1,1,1)) }



'''#I left the following in just to show the format of the colormap -- it is a series of tuples
cdict = {'red': ((0.0, 0.0, 0.0),
                  (0.5, 1.0, 0.7),
                  (1.0, 1.0, 1.0)),
          'green': ((0.0, 0.0, 0.0),
                    (0.5, 1.0, 0.0),
                    (1.0, 1.0, 1.0)),
          'blue': ((0.0, 0.0, 0.0),
                   (0.5, 1.0, 0.0),
                   (1.0, 0.5, 1.0))}
'''
my_cmap = matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict,256)
my_cmap.set_bad(alpha = 0.0)
    
my_cmap2 = matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict2,256)
my_cmap2.set_bad(alpha = 0.0)  

firstlat = 90
lastlat = -90
firstlon = -180
lastlon = 180
scale = .1

numlats = int((firstlat-lastlat)/scale+.5)
numlons = int((lastlon-firstlon)/scale+.5)
    
#     data_array = np.zeros((numlats, numlons)) #data_array is in format data_array[lat index][lon index]

lat_boxes = np.linspace(lastlat,firstlat,num=numlats,endpoint=False)
lon_boxes = np.linspace(firstlon,lastlon,num=numlons,endpoint=False)


fig = plt.figure()


m = Basemap(llcrnrlat=lastlat, urcrnrlat=firstlat,
          llcrnrlon=firstlon, urcrnrlon=lastlon, lat_ts=0, projection='mill',resolution="h")

m.drawmapboundary()
m.drawcoastlines(linewidth=.2)
#m.fillcontinents('#555555')#, lake_color, ax, zorder, alpha)


x = np.linspace(-180, 180, 360/5 )
y = np.linspace(lastlat, firstlat, (firstlat-lastlat)/5)
x, y = np.meshgrid(x, y)
converted_x, converted_y = m(x, y)
from matplotlib import colors,colorbar

norm = colors.LogNorm(vmin=1, vmax=1000)

m3 = 20

m.pcolormesh(converted_x, converted_y, averages, norm=norm, vmin=1, vmax=m3**3)

t = "Vessels per Day Averaged over Satellite Footprint, 2015"
plt.title(t)

# cbar = fig.colorbar(im)#, ticks=[-1, 0, 1])
# theticks = [i*100 for i in range(10)]
# cbar = fig.colorbar(im, cmap =my_cmap2, orientation='horizontal')

ax = fig.add_axes([0.15, 0.1, 0.4, 0.02]) #x coordinate , 
#ax.patch.set_alpha(0.0)
#ax.axis('off')
# my_cmap=choose_cmap('reds')
norm = colors.Normalize(vmin=0, vmax=1000)
norm = colors.LogNorm(vmin=1, vmax=1000)
lvls = np.logspace(0,3,7)

cb = colorbar.ColorbarBase(ax,norm = norm,
#                                     ticks=theticks,
                                   orientation='horizontal', ticks=lvls)

cb.ax.set_xticklabels(["<1" ,int(m3**.5), m3, int(m3**1.5), m3*m3,int(m3**2.5), str(int(m3**3))+"+"], fontsize=10)
#cb.set_label('Vessels per Day Averaged Over Satellite Footprint',labelpad=-40, y=0.45)

# plt.text(1.1, .15, 'Pixels with fewer than 20 boats per\nday in 2014 are shown in gray', fontsize = 10)
# plt.axis('off')



#plt.savefig("vessel_density_2015_morethan5.png",bbox_inches='tight',dpi=450,transparent=True,pad_inches=0)

plt.rcParams["figure.figsize"] = [12,8]

plt.show()

#plt.clf()



In [63]:
import bq  
client = bq.Client.Get()


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-63-c801bf82f845> in <module>()
----> 1 import bq
      2 client = bq.Client.Get()

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bq.py in <module>()
     31 import oauth2client.tools
     32 
---> 33 from google.apputils import app
     34 from google.apputils import appcommands
     35 import gflags as flags

ImportError: No module named google.apputils

In [ ]: