toddheitmann / PetroPy

A petrophysics python package for geoscience python computing of conventional and unconventional formation evaluation. Reads las files and creates a pandas dataframe of the log data. Includes a basic petrophysical workflow and a simple log viewer based on XML templates.
https://toddheitmann.github.io/PetroPy/
MIT License
177 stars 66 forks source link

issue reading tops from csv #2

Open dunchay opened 6 years ago

dunchay commented 6 years ago

when I use...

lasfilepath = r'1044931248.las'
log = ptr.Log(lasfilepath)
tops_path = r'D:\Users\duncan.hay\Documents\python\petrophysics\tops.csv'
log.tops_from_csv(tops_path)
print (log.tops)

it returns an empty dictionary meaning i cant use any of the additional functionality. The tops.csv is the exact same format as the example you give.

csv format: uwi,form,depth 1044931248,fm_1,800 1044931248,fm_2,2000.2 1044931248,fm_3,3000.5

Can you advise? Thanks

toddheitmann commented 5 years ago

The tops_from_csv method creates a dataframe from the csv and adds the tops when the tops csv uwi matches the log uwi, source code found here.

Could you try this to debug?

lasfilepath = r'1044931248.las'
log = ptr.Log(lasfilepath)
# see the uwi of the log object
log_uwi = str(self.well['UWI'].value)
print(log_uwi)
tops_path = r'D:\Users\duncan.hay\Documents\python\petrophysics\tops.csv'
top_df = pd.read_csv(tops_path, dtype = {'uwi': str,'form': str, 'depth': float})
# see csv of tops
print(top_df.head())
# count matches from tops dataframe uwi to log uwi
# if this value is 0 then the uwi from the las file does not match the uwi in the csv
print((top_df.uwi == log_uwi).sum())