[Numpy-discussion] Suggestion about reading text file and extracting data LAS format (newbie questions)

Warren Weckesser warren.weckesser at enthought.com
Mon Mar 21 23:03:45 EDT 2011


On Mon, Mar 21, 2011 at 8:00 PM, Sachin Kumar Sharma <SSharma84 at slb.com>wrote:

>  BB,
>
>
>
> I have picked python recently and use it for simple day to day task. I am
> looking a routine for loading Well Log Las format and storing information as
> arrays or List.
>
>
>
> Las format looks like following
>


Sachin,

Take a look at pyLASDev:  http://pylasdev.sourceforge.net/, or try the
attached file for a quick-and-dirty, not full tested LAS reader.

There are a couple problems with your sample file.  The DATE line in the
Well section uses colons in the time (08:31:52), but there should be only
one colon in a line.  The LAS reader that I wrote avoids that problem by
only using the last colon as the delimiter of the description.  More
importantly, your sample doesn't include the line ~A to begin the log data.
This is required.  The lines where the data begin should look something like
this:


#==================================================================
~A
2711.0000000 0.2031999975 1.0000000000 0.1447000057 5.0000000000
171.17599487


Warren



>
> # LAS format
>
> # Project units are specified as depth units
>
> #==================================================================
>
> ~Version information
>
> VERS.   2.0:
>
> WRAP.   NO:
>
> #==================================================================
>
> ~Well
>
> STRT .ft      1900.0000000 :
>
> STOP .ft      6725.0000000 :
>
> STEP .ft     0.50000000 :
>
> NULL .        -999.250000 :
>
> COMP.           : COMPANY
>
> WELL.            : WELL
>
> FLD.            : FIELD
>
> LOC.            : LOCATION
>
> SRVC.           : SERVICE COMPANY
>
> DATE.  Tuesday, March 22 2011 08:31:52   : DATE
>
> PROV.           : PROVINCE
>
> UWI.            : UNIQUE WELL ID
>
> API.            : API NUMBER
>
> #==================================================================
>
> ~Curve
>
> DEPT .ft                  : DEPTH
>
> PHIE .ft3/ft3            : POROSITY
>
> SW .                      : WATER SATURATION
>
> VCLfin .                  : VCL
>
> FACIES_NN .               : FACIES
>
> KairHU .mD                : PERM
>
> ~Parameter
>
> #==================================================================
>
>
>
> 2711.0000000 0.2031999975 1.0000000000 0.1447000057 5.0000000000
> 171.17599487
>
> 2711.5000000 0.2098000050 1.0000000000 0.1421000063 5.0000000000
> 199.55209351
>
> 2712.0000000 0.2072000057 1.0000000000 0.1570000052 5.0000000000
> 200.47390747
>
> 2712.5000000 0.2063000053 1.0000000000 0.1530999988 5.0000000000
> 192.77430725
>
> 2713.0000000 0.2161999941 1.0000000000 0.1184000000 5.0000000000
> 208.76330566
>
> 2713.5000000 0.2213999927 1.0000000000 0.0970999971 5.0000000000
> 214.45840454
>
> 2714.0000000 0.2188999951 1.0000000000 0.0939999968 5.0000000000
> 198.89270020
>
> 2714.5000000 0.2120999992 1.0000000000 0.1231999993 5.0000000000
> 192.96949768
>
> 2715.0000000 0.2094999999 1.0000000000 0.1480000019 5.0000000000
> 203.21719360
>
> 2715.5000000 0.2054000050 1.0000000000 0.1673000008 6.0000000000
> 201.36019897
>
> 2716.0000000 0.2071000040 1.0000000000 0.1544999927 5.0000000000
> 197.63549805
>
> 2716.5000000 0.2006999999 1.0000000000 0.1601999998 5.0000000000
> 173.38989258
>
> 2717.0000000 0.2045000046 1.0000000000 0.1494999975 5.0000000000
> 181.11289978
>
> 2717.5000000 0.2016000003 1.0000000000 0.1485999972 5.0000000000
> 167.39660645
>
> 2718.0000000 0.2023999989 1.0000000000 0.1332000047 5.0000000000
> 158.64739990
>
> 2718.5000000 0.1915999949 1.0000000000 0.1460999995 5.0000000000
> 127.54989624
>
> 2719.0000000 0.1824000031 1.0000000000 0.1656000018 5.0000000000
> 110.23919678
>
> 2719.5000000 0.1812999994 1.0000000000 0.1741999984 5.0000000000
> 111.93460083
>
> 2720.0000000 0.1774999946 1.0000000000 0.1779000014 5.0000000000
> 102.91439819
>
> 2720.5000000 0.1650000066 1.0000000000 0.1888999939 5.0000000000
> 76.584999084
>
> 2721.0000000 0.1314000040 1.0000000000 0.2365999967 5.0000000000
> 35.996101379
>
> 2721.5000000 0.1238999963 1.0000000000 0.2381000072 5.0000000000
> 28.215700150
>
> 2722.0000000 0.1242000014 1.0000000000 0.2396000028 5.0000000000
> 28.818500519
>
> 2722.5000000 0.1412999928 1.0000000000 0.2210000008 5.0000000000
> 45.044498444
>
> 2723.0000000 0.1543000042 1.0000000000 0.2046999931 5.0000000000
> 61.145401001
>
> 2723.5000000 0.1601999998 1.0000000000 0.2020999938 5.0000000000
> 71.653701782
>
> 2724.0000000 0.1479000002 1.0000000000 0.2287999988 5.0000000000
> 57.839698792
>
> 2724.5000000 0.1274999976 1.0000000000 0.2714999914 7.0000000000
> 39.379501343
>
> 2725.0000000 0.1230000034 1.0000000000 0.2777000070 7.0000000000
> 35.316699982
>
> 2725.5000000 0.1237000003 1.0000000000 0.2709000111 7.0000000000
> 34.647201538
>
>
>
> Blue shows the header precedes the data (shown in green). The file normally
> contains between 3000-10000 data rows.
>
>
>
> If someone can share a routine existing for the same or Can advise what is
> the best way to read these lines. Currently, I edit these files by hand to
> remove the headers and use something like this to plot
>
>
>
> X = numpy.loadtxt('ASCII.txt') #  X  is   an   array
>
> t  =  X [: ,0]     #   extract   the   first   column
>
> v  =  X [: ,1]     #   extract   the   second   column
>
> len (t)
>
> len (v)
>
> plot (t,v)  #   plot   the   data
>
>
>
> Is there a way, I can use readline option to direct to read from where the
> data starts and pick the name of columns from header like porosity,
> permeability.
>
>
>
> Cheers
>
>
>
> Sachin
>
> *************************************************************************
> Sachin Kumar Sharma*
>
> Senior Geomodeler **
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110321/6f29a721/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: las.py
Type: application/octet-stream
Size: 2829 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110321/6f29a721/attachment.obj>


More information about the NumPy-Discussion mailing list