Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. class TransformAddDummyStratigraphy(base.BaseTransform):
  2. """
  3. Adds and extra horizon above the first horizon
  4. from the ground level. MD of the top of the new
  5. horizon begins a the point where a record of all
  6. logs appears.
  7.  
  8. Parameters
  9. ----------
  10. logs: list of str
  11. list of logs that need to be present at the top
  12. of the new horizon
  13. gap_threshold: int
  14. gap .......
  15. horizon_name: str
  16. name of new horizon
  17.  
  18. """
  19.  
  20. def __init__(self, logs, gap_threshold, horizon_name):
  21. """
  22.  
  23. """
  24. self._logs = logs
  25. self._horizon_name = horizon_name
  26. self._gap_threshold = gap_threshold
  27.  
  28. def __call__(self, data):
  29. log_top_md = data.dropna(subset=self._logs)['MD'].min()
  30. horizon_top_md = data[data['Layer'] != 'nan']['MD'].min()
  31. gap = horizon_top_md - log_top_md
  32. if gap > self._gap_threshold:
  33. new_horizon_top_md = horizon_top_md - self._gap_threshold
  34. elif gap <= self._gap_threshold and gap > 0:
  35. new_horizon_top_md = log_top_md
  36. else:
  37. return data
  38.  
  39. where_new_layer = ((data['MD'] >= new_horizon_top_md)
  40. & (data['MD'] <= horizon_top_md))
  41. data.loc[where_new_layer, 'Layer'] = self._horizon_name
  42. return data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement