def update_figure(surface_picks, curve, active_well): """redraw the plot when the data in tops-storage is updated""" surface_picks = pd.read_json(surface_picks) surface_picks = surface_picks[surface_picks['UWI'] == active_well] w = p.get_well(active_well) ##selects the correct welly.Well object df = w.df() ##reloads the correct dataframe for the display # regenerate figure with the new horizontal line fig = px.line(x=df[curve], y=df.index, labels={ 'x': curve, 'y': df.index.name }) fig.layout = { 'uirevision': curve } # https://community.plotly.com/t/preserving-ui-state-like-zoom-in-dcc-graph-with-uirevision-with-dash/15793 fig.update_yaxes(autorange="reversed") fig.layout.xaxis.fixedrange = True fig.layout.template = 'plotly_white' helper.update_picks_on_plot(fig, surface_picks) return fig
def update_figure(picks, curve, active_well): """redraw the plot when the data in tops-storage is updated""" w = p.get_well(active_well) ##selects the correct welly.Well object picks_df = pd.read_json(picks) picks_selected = picks_df[picks_df['UWI'] == active_well.replace(' ', '-')] # regenerate figure with the new horizontal line fig = helper.make_log_plot(w=w, ymin=ymin) fig.update_layout(uirevision=active_well) helper.update_picks_on_plot(fig, picks_selected) return fig
def update_figure(surface_picks, curve, active_well): """redraw the plot when the data in tops-storage is updated""" surface_picks = pd.read_json(surface_picks) surface_picks = surface_picks[surface_picks['UWI'] == active_well] w = p.get_well(active_well) ##selects the correct welly.Well object df = w.df() ##reloads the correct dataframe for the display # regenerate figure with the new horizontal line fig = helper.make_log_plot(df) helper.update_picks_on_plot(fig, surface_picks) return fig
def update_figure(picks, curve, active_well): """redraw the plot when the data in tops-storage is updated""" w = p.get_well(active_well) ##selects the correct welly.Well object picks_df = pd.read_json(picks) for i, row in picks_df.iterrows(): print(row.UWI, row.PICK, row.MD) print('***Active Well', active_well) picks_selected = picks_df[picks_df['UWI'] == active_well.replace(' ', '-')] print('***\n***\n***', picks_selected) # regenerate figure with the new horizontal line fig = helper.make_log_plot(df) helper.update_picks_on_plot(fig, picks_selected) return fig
def update_figure(surface_picks, curve): """redraw the plot when the data in tops-storage is updated""" surface_picks = json.loads(surface_picks) # regenerate figure with the new horizontal line """this is not updating the figure for the newly selected curve""" fig = px.line(x=df[curve], y=df.index, labels={ 'x': curve, 'y': df.index.name }) fig.update_yaxes(autorange="reversed") helper.update_picks_on_plot(fig, surface_picks) return fig ###this does not seem to return to dcc.Graph in the app
def update_figure(picks, curve, active_well): """redraw the plot when the data in tops-storage is updated""" w = p.get_well(active_well) ##selects the correct welly.Well object picks_df = pd.read_json(picks) picks_selected = picks_df[picks_df['UWI'] == active_well.replace(' ', '-')] # regenerate figure with the new horizontal line fig = px.line(x=w.data[curve], y=w.data[curve].basis, labels = {'x':curve, 'y': 'MD'}) fig.layout = {'uirevision': curve} # https://community.plotly.com/t/preserving-ui-state-like-zoom-in-dcc-graph-with-uirevision-with-dash/15793 fig.update_yaxes(autorange="reversed") fig.layout.xaxis.fixedrange = True fig.layout.template = 'plotly_white' helper.update_picks_on_plot(fig, picks_selected) return fig
dropdown_options = [{ 'label': k, 'value': k } for k in list(surface_picks.keys())] ##Need to make the selector grab the wanted curve curve_dropdown_options = [{'label': k, 'value': k} for k in curve_list] # draw the initial plot fig_well_1 = px.line(x=df[curve], y=df.index, labels={ 'x': curve, 'y': df.index.name }) fig_well_1.update_yaxes(autorange="reversed") helper.update_picks_on_plot(fig_well_1, surface_picks) app.layout = html.Div( children=[ html.Div([ 'Mode:', dcc.RadioItems(id='mode-selector', options=[{ 'label': 'Well Display', 'value': 'display_mode' }, { 'label': 'Tops', 'value': 'tops_mode' }], value='display_mode'), 'Edit tops:', dcc.Dropdown(id='top-selector',
#well dropdown selector well_dropdown_options = [{'label': k, 'value': k} for k in well_uwi] ##list of wells to the dropdown #tops dropdown options tops_dropdown_options = [{'label': k, 'value': k} for k in list(surface_picks.keys())] ##list of tops to the dropdown ##well log curve dropdown options curve_dropdown_options = [{'label': k, 'value': k} for k in curve_list] ##list of well log curves to the dropdown # draw the initial plot fig_well_1 = px.line(x=df[curve], y=df.index, labels = {'x':curve, 'y': df.index.name}) ##polot data and axis lables fig_well_1.update_yaxes(autorange="reversed") ## flips the y-axis to increase down assuming depth increases fig_well_1.layout.xaxis.fixedrange = True ##forces the x axis to a fixed range based on the curve data fig_well_1.layout.template = 'plotly_white' ##template for the plotly figure helper.update_picks_on_plot(fig_well_1, surface_picks) ## helper script updates the top picks on the figure app.title = "SwellCorr" app.layout = html.Div( children=[ html.Div([ 'Select well:', ##Well selector dcc.Dropdown(id='well-selector', options=well_dropdown_options, value=well_uwi[0], style={'width': '200px'}), 'Edit tops:', ##existing top to edit selector dcc.Dropdown(id='top-selector', options=tops_dropdown_options, placeholder="Select a top to edit", style={'width': '200px'}), html.Hr(), 'Create a new surface pick:', html.Br(), ##dialog to creat a new well top correlation for a well dcc.Input(id='new-top-name', placeholder='Name for new top', type='text', value=''), html.Button('Create', id='new-top-button'),