1

I'm using the python lasio.py library and I must be missing in something in the docs.

Is there a native way to add headers columns in the ~ASCII (~A) section of the output file.

I need to output something like

~A  DEPTH     DT    RHOB        NPHI   SFLU    SFLA      ILM      ILD
1670.000   123.450 2550.000    0.450  123.450  123.450  110.200  105.600
1669.875   123.450 2550.000    0.450  123.450  123.450  110.200  105.600
1669.750   123.450 2550.000    0.450  123.450  123.450  110.200  105.600

where I'm actually getting

~ASCII -----------------------------------------------------
   1670     123.45       2550       0.45     123.45     123.45      110.2      105.6
 1669.9     123.45       2550       0.45     123.45     123.45      110.2      105.6
 1669.8     123.45       2550       0.45     123.45     123.45      110.2      105.6

written to my output file.

I feel like I'm missing something really obvious.

edit: output for file is pretty straight forward:

las.write(outfilename + '.las', fmt='%.3f', version=2)

cheers

jpf
  • 1,407
  • 11
  • 20
ris15
  • 19
  • 2
  • UPDATE - For anyone who comes across this looking for an inbuilt native function answer I couldn't find one. Ended up just modifying the output format programmatically (after the .las process had completed) to modify the line and include the curve headers. – ris15 Sep 03 '20 at 08:16

1 Answers1

1

To anyone who comes across this issue, here is a workaround. You need to modify the writer.py file in the lasio package. Create a list with curve mnemonics, convert it to np array, stack said array on top of data_arr using np.vstack()

data_arr = las.data    # original code

# adding curve names as headers - insert these 5 lines in writer.py
hdr_list = []
for hdr_item in las.curves:
    hdr_list.append(hdr_item.mnemonic)
hdrs = np.array(hdr_list).reshape(1, -1)
data_arr = np.vstack((hdrs, data_arr))

nrows, ncols = data_arr.shape   # original code