striplog
striplog copied to clipboard
Some changes necessary for subsurface
From dict method
- I have added a method to be able to pass directly a python dictionary. It is just a simplification of the method
from_csv
. Since I created the pull request someone else has created anotherfrom_dict
method. I just renamed my contribution tofrom_dict_advance
since it does more post processing.
I am using this in subsurface to be able to first read a table with pandas, clean it and then converting the pandas dataframe to a valid dictionary that striplog understands.
Supporting integer as formation name
- At the moment any formation name that is passed as a integer is directly converted to float. This gave problems when the user uses ids for the formations and we want to map it to a table of the components.
- In the same direction, comparing two
Component
objects with different integers was always comparing them as True.
This is the test that needs all of the mention here: https://github.com/softwareunderground/subsurface/blob/6543c9924dcfd5d67068069f2a6fc1f9e17f5ef5/tests/test_io/test_welly_to_subsurface.py#L420
Coverage decreased (-0.2%) to 76.815% when pulling 2d1b7189babf94ae80ddf75c4436e6a44e0188b3 on Leguark:master into 02ae02ec4ec7c31990faa06e5156924a9b87254f on agile-geoscience:master.
Coverage decreased (-0.3%) to 75.11% when pulling fcd782540d0d24f131614b7e6a90a394ab92249e on Leguark:master into 0c68f63d645c5bb7a5cc73b9bdaa197c4fb3cc33 on agile-geoscience:master.
@Leguark I'm just getting to know the striplog and Markov Chain object preferences and wondering if you can suggest how you'd clean up a log in the form of a pandas table with well, top, base, log. Based on @kwinkunks notebook it looks like a .GroupBy or .to_json might be the way to go.
Something like this, I suppose:
df.dropna(how='any').groupby('well')['log'].apply(lambda x: x.to_json(orient='records'))