
# coding: utf-8

# In[3]:

from utils.colormap import RGBAColorMapper
from scipy.io import netcdf
import netCDF4
from bokeh.palettes import RdBu11
from bokeh.plotting import figure, output_notebook, show

data = netcdf.netcdf_file('Land_and_Ocean_LatLong1.nc', 'r')
t = data.variables['temperature']
colormap = RGBAColorMapper(-6, -6, RdBull)

def get_slice(t, year, month):
    i = (year - 1850)*12 + month -1
    return colormap.color(t[i, :, :])

output_notebook()

image = get_slice(t, 1950, 1)

p = figure(width=900, height=500, x_axis_type=None, y_axis_type=None, x_range=[-180, 180], y_range=[-90, 90])

p.image_rgba(
    image=[image],
    x=[-180], y=[-90],
    dw=[360], dh=[180], name='image'
)

show(p)


# In[ ]:



