kinverarity1 / lasio

Python library for reading and writing well data using Log ASCII Standard (LAS) files
https://lasio.readthedocs.io/en/latest/
MIT License
340 stars 153 forks source link

Add "rename_descriptions" method to SectionItems #305

Open MSZeftawy opened 4 years ago

MSZeftawy commented 4 years ago

Hi Kent,

I have been using LASIO for a week now and I think it has a large potential. Great job!

Some of the files I open has header and parameters section description same as mnemonic (150 to be exact). such as below;

~PARAMETER INFORMATION BHT. N/A :BHT BIT1. 127 :BIT1 BIT2. :BIT2 BIT3. :BIT3 BS. 127 :BS BTF1. 0 :BTF1 BTF2. :BTF2 BTF3. :BTF3 BTT1. 269.01 :BTT1 BTT2. :BTT2 BTT3. :BTT3 CIRC. N/A :CIRC CIRCT. N/A :CIRCT CRES. N/A :CRES

As all the lasses I have got the same parameters, I defined a function to rename the description of them, sample of the code;

def moddescr(): las.well.STRT.descr='START DEPTH' las.well.STOP.descr='STOP DEPTH' las.well.STEP.descr='STEP INTERVAL' las.well.COMP.descr='COMPANY' las.well.FLD.descr='FIELD' las.well.LOC.descr='LOCATION' las.well.SRVC.descr='SERVICE COMPANY' las.well.CTRY.descr='CTRY' las.well.STAT.descr='STATE' las.well.CNTY.descr='COUNTRY' las.well.DATE.descr='LOGGING DATE' las.params.BHT.descr='BOREHOLE TEMPERATURE AT TD' las.params.BIT1.descr='BIT 1 SIZE MM' las.params.BIT2.descr='BIT 2 SIZE MM' las.params.BIT3.descr='BIT 3 SIZE MM' las.params.BS.descr='BIT SIZE' las.params.BTF1.descr='BIT 1 START DEPTH' las.params.BTF2.descr='BIT 2 START DEPTH' las.params.BTF3.descr='BIT 3 START DEPTH' las.params.BTT1.descr='BIT 1 END DEPTH' las.params.BTT2.descr='BIT 2 END DEPTH' las.params.BTT3.descr='BIT 3 END DEPTH' las.params.CIRC.descr='STOP CIRCULATION TIME' las.params.CIRCT.descr='TIME SINCE CIRCULATION' las.params.CRES.descr='MUD CACKE RESISTIVITY'

You may have noticed that CNTY is used as COUNTRY instead of CTRY.

Then I called the function just before writing the new files and it worked great. A sample below;

las=lasio.read(filename) moddescr() lasio.writer.write(las,newlas,version=2,wrap=None,STRT=None,STOP=None,STEP=None,fmt='%.2f',len_numeric_field=11, data_width=None, header_width=60)

And the output;

~Params ---------------------------------------------------- BHT . N/A : BOREHOLE TEMPERATURE AT TD BIT1 . 127 : BIT 1 SIZE MM BIT2 . : BIT 2 SIZE MM BIT3 . : BIT 3 SIZE MM BS . 127 : BIT SIZE BTF1 . 0 : BIT 1 START DEPTH BTF2 . : BIT 2 START DEPTH BTF3 . : BIT 3 START DEPTH BTT1 . 269.01 : BIT 1 END DEPTH BTT2 . : BIT 2 END DEPTH BTT3 . : BIT 3 END DEPTH CIRC . N/A : STOP CIRCULATION TIME CIRCT . N/A : TIME SINCE CIRCULATION CRES . N/A : MUD CACKE RESISTIVITY

It would be great if you could add a header/parameters tables that contain standard mnemonics and corresponding description with a new separate function to apply the description upon user request. Or as optional input in las.writer function.

Plesase let me know if I can help.

Cheers Moustafa

kinverarity1 commented 4 years ago

Thanks for the suggestion @MSZeftawy!

I think that lasio could help with this by providing a keyword argument to map descriptions against mnemonics, using a dict-like object, similar to how pandas does in many places. Very similar to your function.

kinverarity1 commented 2 years ago

Note to self: stay aligned to whatever welly chooses to do in this space (e.g. related: renaming curves https://github.com/agilescientific/welly/issues/213)