Zabamund / wellpathpy

Well deviation import
GNU Lesser General Public License v3.0
78 stars 28 forks source link

Typo in Docs and "no attribute 'minimum_curvature'" #24

Closed bneelon85 closed 3 years ago

bneelon85 commented 3 years ago

I've been messing a bit with your library to see if it can help our team. Excited for the potential!

2 things:

  1. There is a spelling issue that happens multiple times in the docs: tvd, northing, easting, dls = wp.mininum_curvature(md, inc, azi, course_length=30) image
  2. Even after fixing the typo, tvd, northing, easting, dls = wp.minimum_curvature(md, inc, azi, course_length=30) still returns AttributeError: module 'wellpathpy' has no attribute 'minimum_curvature'

Inspecting __init__.py i see minimum_curvature is not imported.

    import pkg_resources
    __version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound:
    pass

__all__ = [
    'read_header_json',
    'read_csv',
    'unit_convert',
    'deviation_to_csv',
    'position_to_csv',
    'deviation',
    'position_log',
]

from .convert import unit_convert
from .header import read_header_json
from .read import read_csv
from .write import deviation_to_csv, position_to_csv
from .position_log import deviation, position_log

Stepping into position_log.py i noticed there is a minimum_curvature function in the deviation class, so I tried to run: tvd, northing, easting, dls = wp.deviation.minimum_curvature(md, inc, azi, course_length=30) but got: TypeError: minimum_curvature() got multiple values for argument 'course_length'

Could it be as simple as also importing the minimum_curvature class from position_log.py within __init__.py?

Thanks for any help you can provide here!

Zabamund commented 3 years ago

Hello, thanks for your interest. The latest release made in January made some changes and the docs are currently out-of-sync. For now you should consider this package as unstable.

bneelon85 commented 3 years ago

Ok thanks. Good to know.

Are you recommending to not use the package at all? or just that the docs don't necessarily represent how the code works now? If it still "works", do you have any insight as to how to go from:

md, inc, azi = wp.read_csv(fname)
md = wp.unit_convert(md, src='ft', dst='m')
elevation = wp.unit_convert(header['elevation'],
                               src=header['elevation_units'], dst='m')
surface_easting = wp.unit_convert(header['surface_easting'],
                                src=header['surface_coordinates_units'],
                                dst='m')
surface_northing = wp.unit_convert(header['surface_northing'],
                                src=header['surface_coordinates_units'],
                                dst='m')

To converting to a position log using minimum curvature method?

Zabamund commented 3 years ago

So the API changed quite a bit from when the docs were wriiten, and while I plan to correct them soon, I don't currently have time. So for now I'd suggest you check out https://github.com/jonnymaserati/welleng which is being developped more actively. Also, wellpathpy really only aims to handle deviations, wheres welleng goes further.

So if it's urgent and you're looking for well planning, go to welleng, if you're only after deviations and have time, keep an eye on wellpathpy.

I hope that helps.

Currently, you could use this approach to load a CSV of a deviation survey and get back a positional log using minimum curvature:

​
md, inc, azi = wellpathpy.read_csv(
    './wellpathpy/test/fixtures/well10.csv',
    md = 'Measured Depth ( ft )',
    inc = 'Inclination ( deg )',
    azi = 'Azimuth Grid ( deg )',
    sep=",",
)
​
dev = wellpathpy.deviation(
    md = md,
    inc = inc,
    azi = azi,
)
​
depths = list(range(0, int(dev.md[-1]) + 1, 30))
pos = dev.minimum_curvature().resample(depths = depths)
# pos is a position log, you can then go back to a deviation with:
dev2 = pos.deviation()
​
for md, inc, azi in zip(dev2.md, dev2.inc, dev2.azi):
    print(f'md = {md:.3f} inc = {inc:.3f}° azi = {azi:.3f}°')
bneelon85 commented 3 years ago

This is great, thanks! And I'll check out welleng also!