def test_get(self): profile = ['V', 'J', 'S', 'H1', 'H2'] for x in profile: well = get(100, points=100, profile=x, build_angle=45, kop=20, eob=40, sod=60, eod=80, kop2=60, eob2=80) run_assertions(self, well, 100)
def test_get(self): profile = ['V', 'J', 'S', 'H1', 'H2'] for x in profile: my_wp = get(100, cells_no=100, profile=x, build_angle=45, kop=20, eob=40, sod=60, eod=80, kop2=60, eob2=80) run_assertions(self, my_wp, 100)
def test_get(self): profile = ['V', 'J', 'S', 'H1', 'H2'] for x in profile: my_wp = wp.get(100, grid_length=1, profile=x, build_angle=45, kop=20, eob=40, sod=60, eod=80, kop2=60, eob2=80) self.assertIsInstance(my_wp.zstep, int, msg='zstep is not an integer') self.assertEqual(my_wp.md[0], 0, msg='MD is not starting from 0') self.assertEqual(my_wp.md[-1], 100, msg='Target depth not reached') self.assertEqual(my_wp.zstep, len(my_wp.tvd), msg='wrong number of values in tvd') self.assertEqual(my_wp.zstep, len(my_wp.north), msg='wrong number of values in north') self.assertEqual(my_wp.zstep, len(my_wp.east), msg='wrong number of values in east') self.assertEqual(my_wp.zstep, len(my_wp.inclination), msg='wrong number of values in inclination') self.assertEqual(my_wp.zstep, len(my_wp.dogleg), msg='wrong number of values in dogleg') self.assertEqual(my_wp.zstep, len(my_wp.azimuth), msg='wrong number of values in azimuth') self.assertIsInstance(my_wp.deltaz, int, msg='grid length is not an integer')
def add_well_profile_app(): st.subheader('WELLBORE 3D APP') st.write( "This is a web based application to create, manipulate and visualize 3D wellbore trajectory data," " based on well_profile. This is part of the open source initiative by Pro Well Plan AS." ) st.info( 'well_profile is a python package to generate or load wellbore profiles in 3D. Features are added \ as they are needed; suggestions and contributions of all kinds are very welcome.' ) c1, c2, c3, c4, c5 = st.columns(5) with c1: st.markdown( "[![Github](https://img.shields.io/badge/source-well_profile-green.svg?logo=github)]" "(https://github.com/pro-well-plan/well_profile)") with c2: st.markdown( "[![PyPI version](https://badge.fury.io/py/well-profile.svg)]" "(https://badge.fury.io/py/well-profile)") with c3: st.markdown( "[![Documentation Status](https://readthedocs.org/projects/well_profile/badge/?version=latest)]" "(http://well_profile.readthedocs.io/?badge=latest)") with c4: st.markdown( "[![Build Status](https://www.travis-ci.org/pro-well-plan/well_profile.svg?branch=master)]" "(https://www.travis-ci.org/pro-well-plan/well_profile)") st.markdown( '<iframe src="https://ghbtns.com/github-btn.html?user=pro-well-plan&repo=well_profile&type=star&' 'count=true" frameborder="0" scrolling="0" width="160" height="25" title="GitHub"></iframe>', unsafe_allow_html=True) building_preference = st.selectbox( 'Select the way to start:', ('Load existing trajectory', 'Create shape-based trajectory', 'Create trajectory from 2 points')) if building_preference == 'Create trajectory from 2 points': st.markdown('### Set kick-off point:') kop_depth = st.number_input("tvd", value=100, step=10) st.markdown('### Set target point:') c1, c2, c3 = st.columns(3) with c1: target_north = st.number_input("north", value=500, step=10) with c2: target_east = st.number_input("east", value=800, step=10) with c3: target_depth = st.number_input("tvd", value=800, step=10) show_data, dark, color = settings() traj = wp.two_points({ 'kickoff': { 'north': 0, 'east': 0, 'tvd': kop_depth }, 'target': { 'north': target_north, 'east': target_east, 'tvd': target_depth } }) data_and_plot(traj, show_data, dark, color) if building_preference == 'Create shape-based trajectory': units = 'metric' length_units = 'm' profile = st.selectbox( 'Select a well profile type', ('Vertical', 'J-type', 'S-type', 'Horizontal single curve', 'Horizontal double curve')) show_data, dark, color = settings() # Create a vertical well if profile == 'Vertical': profile = 'V' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], points=100, set_info={'units': units}, set_start=param_dict['start']) data_and_plot(traj, show_data, dark, color) # Create a J-type well if profile == 'J-type': profile = 'J' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], points=100, profile=profile, build_angle=param_dict['build_angle'], kop=param_dict['kop'], eob=param_dict['eob'], set_info={'units': units}, set_start=param_dict['start']) data_and_plot(traj, show_data, dark, color) # Create a S-type well if profile == 'S-type': profile = 'S' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], points=100, profile=profile, build_angle=param_dict['build_angle'], kop=param_dict['kop'], eob=param_dict['eob'], sod=param_dict['sod'], eod=param_dict['eod'], set_info={'units': units}, set_start=param_dict['start']) data_and_plot(traj, show_data, dark, color) # Create a horizontal single curve well if profile == 'Horizontal single curve': profile = 'H1' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], profile=profile, kop=param_dict['kop'], eob=param_dict['eob'], set_info={'units': units}, set_start=param_dict['start']) data_and_plot(traj, show_data, dark, color) # Create a horizontal double curve well if profile == 'Horizontal double curve': profile = 'H2' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], points=100, profile=profile, build_angle=param_dict['build_angle'], kop=param_dict['kop'], eob=param_dict['eob'], kop2=param_dict['kop2'], eob2=param_dict['eob2'], set_info={'units': units}, set_start=param_dict['start']) data_and_plot(traj, show_data, dark, color) if building_preference == 'Load existing trajectory': st.set_option('deprecation.showfileUploaderEncoding', False) c1, c2 = st.columns(2) with c1: wells_no = st.number_input('Number of files:', step=1, value=1) wellbores_data = [] wellbores_names = [] with c2: units = st.selectbox('System of units', ('metric', 'english')) if units == 'metric': length_units = 'm' else: length_units = 'ft' for x in range(wells_no): st.write('_________________') c1, c2 = st.columns(2) with c1: well_name = st.text_input('Set name:', value='well ' + str(x + 1)) with c2: file_type = st.selectbox("File format", ['excel', 'csv'], key='file_type' + str(x)) start = {'north': 0, 'east': 0} uploaded_file = st.file_uploader('Load file ' + str(x + 1), type=["xlsx", "csv"]) if uploaded_file: if file_type == 'excel': df = pd.read_excel(uploaded_file) else: df = pd.read_csv(uploaded_file) if st.checkbox('Set initial point:', key='set_start' + str(x)): c1, c2 = st.columns(2) with c1: start_north = st.number_input("north, " + length_units, value=0, step=10, key='initial_north' + str(x)) with c2: start_east = st.number_input("east, " + length_units, value=0, step=10, key='initial_east' + str(x)) start = {'north': start_north, 'east': start_east} trajectory = wp.load(df, equidistant=False, set_info={'units': units}, set_start=start) wellbores_data.append(trajectory) wellbores_names.append(well_name) c1, c2 = st.columns(2) with c1: if st.checkbox("Show loaded data", value=False, key='rawLoad' + str(x)): st.dataframe(df, width=1000) with c2: if st.checkbox("Show converted data", value=False, key='convLoad' + str(x)): st.dataframe(trajectory.df()) csv = trajectory.df().to_csv(index=False) b64 = base64.b64encode( csv.encode()).decode() # some strings link = f'<a href="data:file/csv;base64,{b64}" download="wellpath.csv">Download dataset</a>' st.markdown(link, unsafe_allow_html=True) interp_pt = st.number_input( "Data at MD depth (" + length_units + ")", value=0.0, step=10.0, key='interp' + str(x), min_value=0.0, max_value=float(trajectory.trajectory[-1]['md'])) if interp_pt != 0: st.write(trajectory.get_point(interp_pt)) if len(wellbores_data) >= 1: st.write('-----------------') style = {'units': units} c1, c2, c3 = st.columns(3) with c1: st.write('') st.write('') st.write('') style['darkMode'] = st.checkbox("Dark Mode", value=False) with c2: plot_type = st.selectbox('Plot type:', ('3d', 'top', 'vs')) with c3: color = st.selectbox( 'Color by:', ('None', 'Dogleg Severity (dls)', 'Dogleg (dl)', 'Inclination (inc)', 'Azimuth (azi)', 'Measured Depth (md)', 'True Vertical Depth (tvd)')) color_data = { 'None': None, 'Dogleg Severity (dls)': 'dls', 'Dogleg (dl)': 'dl', 'Inclination (inc)': 'inc', 'Azimuth (azi)': 'azi', 'Measured Depth (md)': 'md', 'True Vertical Depth (tvd)': 'tvd' } style['color'] = color_data[color] style['size'] = 2 if color_data[color] is not None: style['size'] = st.slider('Marker size:', min_value=1, max_value=8, value=2, step=1) if len(wellbores_data) == 0: st.warning('No data loaded') else: if plot_type == 'vs': c1, c2 = st.columns(2) with c1: xaxis = st.selectbox('X axis:', ('md', 'tvd', 'north', 'east', 'dl', 'dls', 'inc', 'azi')) with c2: yaxis = st.selectbox('Y axis:', ('inc', 'azi', 'dl', 'dls', 'md', 'tvd', 'north', 'east')) else: xaxis = yaxis = None fig = wellbores_data[0].plot(plot_type=plot_type, x_axis=xaxis, y_axis=yaxis, add_well=wellbores_data[1:], names=wellbores_names, style=style) st.plotly_chart(fig)
def default_casing_with_trajectory(): casing = default_casing() trajectory = wp.get(2000, profile='J', build_angle=20, kop=800, eob=1300) casing.add_trajectory(trajectory) return casing
def add_well_profile_app(): st.subheader('WELLBORE 3D APP') st.write( "This is a web based application to create, manipulate and visualize 3D wellbore trajectory data," " based on well_profile. This is part of the open source initiative by Pro Well Plan AS." ) st.info( 'well_profile is a python package to generate or load wellbore profiles in 3D. Features are added \ as they are needed; suggestions and contributions of all kinds are very welcome.' ) st.markdown('[source code]' '(https://github.com/pro-well-plan/well_profile)') st.markdown('[python package]' '(https://pypi.org/project/well-profile/)') st.markdown( '[About our Open Source initiative]' '(https://prowellplan.com/modern-drilling-organization/open-source-boosting-the-digital-transformation)' ) building_preference = st.selectbox( 'Select the way to start:', ('Load existing trajectory', 'Create a new trajectory')) units = st.selectbox('Select the system of units', ('metric', 'english')) if units == 'metric': length_units = 'm' else: length_units = 'ft' if building_preference == 'Create a new trajectory': profile = st.selectbox( 'Select a well profile type', ('Vertical', 'J-type', 'S-type', 'Horizontal single curve', 'Horizontal double curve')) # Create a vertical well if profile == 'Vertical': profile = 'V' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], cells_no=param_dict['cells_no'], units=units, set_start=param_dict['start']) data_and_plot(traj) # Create a J-type well if profile == 'J-type': profile = 'J' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], cells_no=param_dict['cells_no'], profile=profile, build_angle=param_dict['build_angle'], kop=param_dict['kop'], eob=param_dict['eob'], units=units, set_start=param_dict['start']) data_and_plot(traj) # Create a S-type well if profile == 'S-type': profile = 'S' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], cells_no=param_dict['cells_no'], profile=profile, build_angle=param_dict['build_angle'], kop=param_dict['kop'], eob=param_dict['eob'], sod=param_dict['sod'], eod=param_dict['eod'], units=units, set_start=param_dict['start']) data_and_plot(traj) # Create a horizontal single curve well if profile == 'Horizontal single curve': profile = 'H1' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], cells_no=param_dict['cells_no'], profile=profile, kop=param_dict['kop'], eob=param_dict['eob'], units=units, set_start=param_dict['start']) data_and_plot(traj) # Create a horizontal double curve well if profile == 'Horizontal double curve': profile = 'H2' param_dict = set_parameters(profile, length_units) traj = wp.get(param_dict['mdt'], cells_no=param_dict['cells_no'], profile=profile, build_angle=param_dict['build_angle'], kop=param_dict['kop'], eob=param_dict['eob'], kop2=param_dict['kop2'], eob2=param_dict['eob2'], units=units, set_start=param_dict['start']) data_and_plot(traj) if building_preference == 'Load existing trajectory': st.set_option('deprecation.showfileUploaderEncoding', False) wells_no = st.number_input('Number of files:', step=1, value=1) wellbores_data = [] wellbores_names = [] for x in range(wells_no): st.write('_________________') well_name = st.text_input('Set name:', value='well ' + str(x + 1)) start = {'north': 0, 'east': 0} if st.checkbox('Set coordinates of initial point:', key='set_start' + str(x)): start_north = st.number_input("Initial point, North, " + length_units, value=0, step=1, key='initial_north' + str(x)) start_east = st.number_input("Initial point, East, " + length_units, value=0, step=1, key='initial_east' + str(x)) start = {'north': start_north, 'east': start_east} file_type = st.selectbox("File format", ['excel', 'csv'], key='file_type' + str(x)) uploaded_file = st.file_uploader('Load file ' + str(x + 1), type=["xlsx", "csv"]) if uploaded_file: if file_type == 'excel': df = pd.read_excel(uploaded_file) else: df = pd.read_csv(uploaded_file) trajectory = wp.load(df, units=units, set_start=start) wellbores_data.append(trajectory) wellbores_names.append(well_name) if st.checkbox("Show loaded data", value=False, key='raw_load' + str(x)): st.dataframe(df, width=1000) if st.checkbox("Show converted data", value=False, key='conv_load' + str(x)): st.dataframe(trajectory.df()) csv = trajectory.df().to_csv(index=False) b64 = base64.b64encode( csv.encode()).decode() # some strings link = f'<a href="data:file/csv;base64,{b64}" download="wellpath.csv">Download dataset</a>' st.markdown(link, unsafe_allow_html=True) if st.button('Generate 3D plot'): if len(wellbores_data) == 0: st.warning('No data loaded') else: fig = wellbores_data[0].plot(add_well=wellbores_data[1:], names=wellbores_names) st.plotly_chart(fig)