Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent units in _interpolate_survey #191

Open
srivatsamr opened this issue Oct 30, 2024 · 1 comment
Open

Inconsistent units in _interpolate_survey #191

srivatsamr opened this issue Oct 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@srivatsamr
Copy link

srivatsamr commented Oct 30, 2024

Firstly, thanks for creating and sharing this awesome project!

Description

I believe there is a bug in the _interpolate_survey function in the survey module while handling the units. When working in the units of feet, this function throws the following error: AssertionError: inconsistent units with header.

Here is a minimal reproducer:

import welleng as we

header = we.survey.SurveyHeader(deg=True, depth_unit='feet', surface_unit='feet')
sections = []
sections.append(
    we.connector.Connector(
        pos1=[0., 0., 0.],
        inc1=0.,
        azi1=0.,
        md1=0.,
        md2=100.,
        dls_design=3.0,
        degrees=True,
        unit='feet',
    )
)
survey = we.survey.from_connections(sections,
                                    step=30, 
                                    survey_header=header,
                                    radius=10, 
                                    deg=True,
                                    depth_unit='feet', 
                                    surface_unit='feet'
                                   )
node = survey.interpolate_md(50)

Bug

In the _interpolate_survey function, a new instance of Survey is created:

s = Survey(

While the header having units of feet is passed into the argument , the unit argument is left to default which is meters, causing this AssertionError. I guess setting unit=sh.depth_unit would resolve this.

Thanks!

@jonnymaserati jonnymaserati self-assigned this Oct 31, 2024
@jonnymaserati jonnymaserati added bug Something isn't working good first issue Good for newcomers labels Oct 31, 2024
@jonnymaserati
Copy link
Owner

Thanks for the feedback @srivatsamr!

I'll take a closer look when I get time, but I don't doubt there's issues as the whole units part was not well implemented. Longer term I want to make the engine dimensionless and then call stuff like dls as a method that checks dimensions.

In the meantime, I would suggest assuming that the survey module works in meters and transform your input into meters (using the units module for example, which is just a wrapper on the pint library) and then converting back to your unit of choice after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants