Zabamund / wellpathpy

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

"ValueError: md cannot contain nan values" when the input deviation survey contains depths with zero inclination and zero azimuth #54

Closed jpaul-equinor closed 2 years ago

jpaul-equinor commented 3 years ago

We are having no deviation till Water Depth in our deviation survey data, so data looks like below

md inc azi
0 0 0
190 0 0
222 0 0
360 0.3 256.5
390 0.2 124.8
419 0.4 114.3

As a result when we call below code

dev = wp.deviation(   md = md,   inc = inc,   azi = azi)
step = 10
depths = list(range(0, int(dev.md[-1]) + 1 , step))
pos = dev.minimum_curvature().resample(depths = depths)
dev2 = pos.deviation() 

Its throwing Value Error saying MD cannot be null. While computing an approximate deviation survey from the position log, for the zero incl and azi, md is getting calculated as NaN (wellpathpy/position_log.py) and which is caught by checkarrays(md, inc, azi)

Complete Stack trace:

----> 4 dev2 = pos.deviation()

/local_disk0/.ephemeral_nfs/envs/pythonEnv-733cdf7f-f671-45aa-8b0c-56504e08eead/lib/python3.8/site-packages/wellpathpy/position_log.py in deviation(self)
    485         print(np.count_nonzero(~np.isnan(np.array(incs))))
    486         print(np.count_nonzero(~np.isnan(np.array(azis))))
--> 487         return deviation(
    488             md  = np.array(mds),
    489             inc = np.array(incs),

/local_disk0/.ephemeral_nfs/envs/pythonEnv-733cdf7f-f671-45aa-8b0c-56504e08eead/lib/python3.8/site-packages/wellpathpy/position_log.py in __init__(self, md, inc, azi)
     23     """
     24     def __init__(self, md, inc, azi):
---> 25         md, inc, azi = checkarrays(md, inc, azi)
     26         self.md = np.copy(md)
     27         self.inc = np.copy(inc)

/local_disk0/.ephemeral_nfs/envs/pythonEnv-733cdf7f-f671-45aa-8b0c-56504e08eead/lib/python3.8/site-packages/wellpathpy/checkarrays.py in checkarrays(md, inc, azi)
     45     for prop, arr in {'md': md, 'inc': inc, 'azi': azi}.items():
     46         if np.isnan(arr).any():
---> 47             raise ValueError('{} cannot contain nan values'.format(prop))
     48 
     49     if not ((0 <= inc) & (inc < 180)).all():

ValueError: md cannot contain nan values
jokva commented 2 years ago

This should be solved in #63 and #64, could you please confirm?

Zabamund commented 2 years ago

Running the example data provided with the code provided by @jpaul-equinor no longer throws any errors with release 0.5.0.

Ready to close I think.