<s> import math <EOL> from collections import OrderedDict <EOL> import flask <EOL> import pandas as pd <EOL> import netCDF4 <EOL> import numpy as np <EOL> from bokeh . embed import components <EOL> from bokeh . resources import INLINE <EOL> from bokeh . templates import RESOURCES <EOL> from bokeh . util . string import encode_utf8 <EOL> from bokeh . models import DatetimeTickFormatter , ColumnDataSource , HoverTool , Plot , Range1d <EOL> from bokeh . palettes import RdBu11 <EOL> from bokeh . models . glyphs import Text , Rect <EOL> from bokeh . plotting import figure , show , output_notebook , hplot , vplot <EOL> import utils . world_countries as wc <EOL> from utils . colormap import RGBAColorMapper <EOL> from viz2 import climate_map , timeseries , legend , title , get_slice <EOL> app = flask . Flask ( __name__ ) <EOL> colormap = RGBAColorMapper ( - <NUM_LIT:6> , <NUM_LIT:6> , RdBu11 ) <EOL> @ app . route ( "<STR_LIT:/>" ) <EOL> def index ( ) : <EOL> c_map = climate_map ( ) <EOL> ts = timeseries ( ) <EOL> l = legend ( ) <EOL> t = title ( ) <EOL> map_legend = hplot ( c_map , l ) <EOL> layout = vplot ( t , map_legend , ts ) <EOL> plot_resources = RESOURCES . render ( <EOL> js_raw = INLINE . js_raw , <EOL> css_raw = INLINE . css_raw , <EOL> js_files = INLINE . js_files , <EOL> css_files = INLINE . css_files , <EOL> ) <EOL> script , div = components ( layout , INLINE ) <EOL> html = flask . render_template ( <EOL> '<STR_LIT>' , <EOL> plot_script = script , <EOL> plot_div = div , <EOL> plot_resources = plot_resources , <EOL> ) <EOL> return encode_utf8 ( html ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> app . run ( debug = True ) </s>
