equinor / dlisio

Python library for working with the well log formats Digital Log Interchange Standard (DLIS V1) and Log Information Standard (LIS79)
https://dlisio.readthedocs.io/en/latest/
Other
121 stars 39 forks source link

Unable to find depth_reprc values in LIS79-specific types #378

Closed zuzulacas closed 3 years ago

zuzulacas commented 3 years ago

Hello, Thank you for the great job you are doing on this project. I don't know if it is the best way to require some help but I am trying this way. On the lis parser, I am trying to get the index/depth curve name using the depth_reprc attribute (from the dfsr object) but I am unable to find the equivalent curve name in the lis-79.pdf file. Do you have a mapping for this attribute? Thank you

ErlendHaa commented 3 years ago

Hi!

depth_reprc does not refer to the name/mnemonic of a curve. It refers to the data-type used to store the curve. It's an integer and it's value is defined by Appendix B in the LIS79 spec. This is used internally to correctly parse the curves and set the right type in the numpy array produced by the curves function.

If it's the name/mnemonic you are after, you have to look at the Spec Blocks. Note that LIS has 2 ways of recording the index of a DataFormatSpec. Which mode your file uses can be checked with DataFormatSpec.depth_mode. If depth mode is 0, then the first spec block in DataFormatSpec.specs defines the index - which stores both the mnemonic, units and other meta about the index. If depth mode is 1, then the index is not described by a Spec Block and the name/mnemonic is not explicitly defined in the file. The spec seem to always refer to the index as depth-index in that case and we use 'DEPT' as column name in the numpy array from curves. The units are recorded in DataFormatSpec.depth_units.

As you see it's a bit cumbersome to deal with the index due to LIS79's different recording modes for the index. In the next version, which will be out soon, we add a couple of convenience functions that makes it more straightforward to get the index name/mnemonic and units, without having to manually check the depth mode.

zuzulacas commented 3 years ago

Hi Erlend,

Thanks for the clear explanation, I will explore your logic to try to get the info. I will then need to extract the min and max for each curve index, which way should I go for it?

Should I close the issue or keep it open until I get what I am expecting?

Thanks again.

Thibault

ErlendHaa commented 3 years ago

Generally we like to keep one ticker pr issue. This makes it easier for others in the future to look for closed issues matching their issue before creating their own.

Min/max is not explicitly recorded in LIS79 files. You would have to calculate statistics about the curves ourself. For min/max it would be the first and last sample of the index curve. (Assuming the index is always strictly increasing or decreasing). Which one is max and min depends on the direction of the log (see 1DataFormatSpec.direction`).

E.g. if the index is 'DEPT' direction is down-hole:

curves = lis.curves(f, fs)
index  = curves['DEPT']

min = index[0]
max = index[-1]

It's all numpy, so alternatively, you can use numpy's min() and max():

min = index.min()
max = index.max()
ErlendHaa commented 3 years ago

As of 0.3.5 you can now use index_mnem and index_units without manually checking the depth_mode