Esempio n. 1
0
 def create(self, source_data_range):
     logger.debug('initializing %s class',self)
     self.utc = 1
     logger.debug('current utc is %s',self.utc)
     # data_weather = sql_con.get_data_ws()
     # data_weather = sql_con.get_data_ws()
     # data_weather = sql_con.get_data_ws()
     self.plot_weather = plots.get_weather_plot()
     self.plot_ceil = plots.get_ceil_plot()
     self.plot_data_range = plots.get_date_range_plot(source_data_range)
     self._id_weather = self.plot_weather._id
     self._id_ceil = self.plot_ceil._id
     self._id_data_range = self.plot_data_range._id
Esempio n. 2
0
 def create(self, source_data_range):
     logger.debug('initializing %s class', self)
     self.utc = 1
     logger.debug('current utc is %s', self.utc)
     # data_weather = sql_con.get_data_ws()
     # data_weather = sql_con.get_data_ws()
     # data_weather = sql_con.get_data_ws()
     self.plot_weather = plots.get_weather_plot()
     self.plot_ceil = plots.get_ceil_plot()
     self.plot_data_range = plots.get_date_range_plot(source_data_range)
     self._id_weather = self.plot_weather._id
     self._id_ceil = self.plot_ceil._id
     self._id_data_range = self.plot_data_range._id
Esempio n. 3
0
    def input_change(self, app, obj, attrname, old, new):

        logger.debug('input change detected wiht atrr %s', attrname)
        logger.debug('current utc is %f',self.utc)
        assert isinstance(obj, ColumnDataSource)
        data_frame = obj.to_df()
        t_min, t_max = get_t_min_max_from_sel(data_frame, new)
        t_int = get_time_int(t_max - t_min)

        if self.utc == 0:
            t_min -= cs.utc_shift
            t_max -= cs.utc_shift

        new_plot_weather = plots.get_weather_plot(t_int, t_min, t_max)

        plot_weather = find_plot(app, self._id_weather)

        plot_weather.select(ColumnDataSource)[0].data = new_plot_weather.select(ColumnDataSource)[0].data
        plots.update_y_ranges(
            cs.column_names_weewx,
            new_plot_weather.select(ColumnDataSource)[0].to_df(),
            plot_weather
        )

        plot_weather.title = new_plot_weather.title

        new_plot_ceil = plots.get_ceil_plot(t_int, t_min, t_max)
        plot_ceil = find_plot(app, self._id_ceil)
        plot_ceil.select(ColumnDataSource)[0].data = new_plot_ceil.select(ColumnDataSource)[0].data

        plot_ceil.title = new_plot_ceil.title

        plot_weather.x_range.start = new_plot_weather.x_range.start
        plot_weather.x_range.end = new_plot_weather.x_range.end

        old_utc = self.utc
        self.utc = 1  # retrieval of data is always in utc
        self.shift_time(app, old_utc, change_data_range=False)
Esempio n. 4
0
    def input_change(self, app, obj, attrname, old, new):

        logger.debug('input change detected wiht atrr %s', attrname)
        logger.debug('current utc is %f', self.utc)
        assert isinstance(obj, ColumnDataSource)
        data_frame = obj.to_df()
        t_min, t_max = get_t_min_max_from_sel(data_frame, new)
        t_int = get_time_int(t_max - t_min)

        if self.utc == 0:
            t_min -= cs.utc_shift
            t_max -= cs.utc_shift

        new_plot_weather = plots.get_weather_plot(t_int, t_min, t_max)

        plot_weather = find_plot(app, self._id_weather)

        plot_weather.select(ColumnDataSource)[
            0].data = new_plot_weather.select(ColumnDataSource)[0].data
        plots.update_y_ranges(
            cs.column_names_weewx,
            new_plot_weather.select(ColumnDataSource)[0].to_df(), plot_weather)

        plot_weather.title = new_plot_weather.title

        new_plot_ceil = plots.get_ceil_plot(t_int, t_min, t_max)
        plot_ceil = find_plot(app, self._id_ceil)
        plot_ceil.select(ColumnDataSource)[0].data = new_plot_ceil.select(
            ColumnDataSource)[0].data

        plot_ceil.title = new_plot_ceil.title

        plot_weather.x_range.start = new_plot_weather.x_range.start
        plot_weather.x_range.end = new_plot_weather.x_range.end

        old_utc = self.utc
        self.utc = 1  # retrieval of data is always in utc
        self.shift_time(app, old_utc, change_data_range=False)
Esempio n. 5
0
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.resources import INLINE

from ceil_bokeh import sql_con, plots

border_left = 150
time_int = 3600
data_weather = sql_con.get_data_ws(time_int=time_int)

plot_weather = plots.get_weather_plot(data_weather, border_left=border_left)

data_ceil = sql_con.get_data_bs(time_int=time_int)

plot_ceil = plots.get_ceil_plot(data_ceil, time_int=time_int, border_left=border_left)

# link x_range both plots
plot_weather.x_range = plot_ceil.x_range

doc = Document()
doc.add(plot_weather)
doc.add(plot_ceil)

if __name__ == "__main__":
    filename = "twin_axis.html"
    with open(filename, "w") as f:
        f.write(file_html(doc, INLINE, "Twin Axis Plot"))
    print("Wrote %s" % filename)
    view(filename)
Esempio n. 6
0
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.resources import INLINE

from ceil_bokeh import sql_con, plots

border_left = 150
time_int = 3600
data_weather = sql_con.get_data_ws(time_int=time_int)

plot_weather = plots.get_weather_plot(data_weather, border_left=border_left)

data_ceil = sql_con.get_data_bs(time_int=time_int)

plot_ceil = plots.get_ceil_plot(data_ceil,
                                time_int=time_int,
                                border_left=border_left)

# link x_range both plots
plot_weather.x_range = plot_ceil.x_range

doc = Document()
doc.add(plot_weather)
doc.add(plot_ceil)

if __name__ == "__main__":
    filename = "twin_axis.html"
    with open(filename, "w") as f:
        f.write(file_html(doc, INLINE, "Twin Axis Plot"))
    print("Wrote %s" % filename)
    view(filename)