%%time
import datashader as ds
import datashader.transfer_functions as tf
import pandas as pd
#df = pd.read_hdf('TEST.hdf5', '/coordinates/csv', columns=['x', 'y'])
df = pd.read_csv('TEST.csv', usecols= ['x', 'y'])
df.tail()
%%time
World = (( -180, 180), (-90, 90))
x_range,y_range = World
plot_width = int(1700)
#plot_height = int(plot_width*7.0/12)
plot_height = int(1000)
background = "black"
%%time
from functools import partial
from datashader.utils import export_image
from datashader.colors import colormap_select, Greys9
from colorcet import fire
from IPython.core.display import HTML, display
export = partial(export_image, background = background, export_path="export")
cm = partial(colormap_select, reverse=(background!="black"))
display(HTML("<style>.container { width:100% !important; }</style>"))
%%time
cvs = ds.Canvas(plot_width, plot_height, *World)
agg = cvs.points(df, 'x', 'y')
%%time
export(tf.shade(agg, cmap = cm(fire,0.2), how='eq_hist'),"TEST")