def get_date_range_plot(source_time): data_time_ws = sql_con.get_data_tm(cs.time_column_name_weewx, cs.time_int_data_range, cs.data_base_name_weewx, cs.table_name_weewx ) * 1000 data_time_bs = sql_con.get_data_tm(cs.time_column_name_ceil, cs.time_int_data_range, cs.data_base_name_ceil, cs.bs_table_name_ceil ) * 1000 y_factors=['weather','ceilometer'] data_time_ws['y'] = y_factors[0] data_time_bs['y'] = y_factors[1] data_time_bs.rename(columns={0: 'x'}, inplace=True) data_time_ws.rename(columns={0: 'x'}, inplace=True) source_df = pd.concat([data_time_ws, data_time_bs], ignore_index=True) source_df.sort_values('x', inplace=True) source_time.data = ColumnDataSource(data=source_df).data source_time.name = 'source_time' toolset = "crosshair , xpan ,reset, xwheel_zoom" t_min_mili = float(source_df['x'].min()) t_max_mili = float(source_df['x'].max()) t_span_mili=t_max_mili-t_min_mili # Generate a figure container plot = figure(plot_height=cs.data_range_plot_height, plot_width=cs.plot_width, tools=toolset, x_axis_type="datetime", y_range=y_factors, toolbar_location="right", x_range=[t_min_mili-.1*t_span_mili, t_max_mili+.1*t_span_mili], logo=None) plot.add_tools(BoxSelectTool(dimensions=['width'])) plot.circle('x', 'y', source=source_time, color="red") plot.title = "select interval from below" # df=source_time.to_df() # t_max,t_min = get_first_time_interval() # index=df[df.x>=t_min*1000].index.values # source_time.selected['1d']['indices']=index return plot
def get_date_range_plot(source_time): data_time_ws = sql_con.get_data_tm( cs.time_column_name_weewx, cs.time_int_data_range, cs.data_base_name_weewx, cs.table_name_weewx) * 1000 data_time_bs = sql_con.get_data_tm( cs.time_column_name_ceil, cs.time_int_data_range, cs.data_base_name_ceil, cs.bs_table_name_ceil) * 1000 y_factors = ['weather', 'ceilometer'] data_time_ws['y'] = y_factors[0] data_time_bs['y'] = y_factors[1] data_time_bs.rename(columns={0: 'x'}, inplace=True) data_time_ws.rename(columns={0: 'x'}, inplace=True) source_df = pd.concat([data_time_ws, data_time_bs], ignore_index=True) source_df.sort_values('x', inplace=True) source_time.data = ColumnDataSource(data=source_df).data source_time.name = 'source_time' toolset = "crosshair , xpan ,reset, xwheel_zoom" t_min_mili = float(source_df['x'].min()) t_max_mili = float(source_df['x'].max()) t_span_mili = t_max_mili - t_min_mili # Generate a figure container plot = figure( plot_height=cs.data_range_plot_height, plot_width=cs.plot_width, tools=toolset, x_axis_type="datetime", y_range=y_factors, toolbar_location="right", x_range=[t_min_mili - .1 * t_span_mili, t_max_mili + .1 * t_span_mili], logo=None) plot.add_tools(BoxSelectTool(dimensions=['width'])) plot.circle('x', 'y', source=source_time, color="red") plot.title = "select interval from below" # df=source_time.to_df() # t_max,t_min = get_first_time_interval() # index=df[df.x>=t_min*1000].index.values # source_time.selected['1d']['indices']=index return plot
from ceil_bokeh import sql_con # df=sql_con.get_data_bs(time_int=600) # df=sql_con.get_data_ws(time_int=1) df=sql_con.get_data_tm( 'dateTime',600,'weewx_ceilometer02', 'archive',"mysql://*****:*****@10.8.3.1/") print df
from ceil_bokeh import sql_con # df=sql_con.get_data_bs(time_int=600) # df=sql_con.get_data_ws(time_int=1) df = sql_con.get_data_tm('dateTime', 600, 'weewx_ceilometer02', 'archive', "mysql://*****:*****@10.8.3.1/") print df