How to read negative number of a file with python lasio

389 Views Asked by At

I have file .las and I read it with python lasio. But when I print the file, lasio read some negative numbers as Nan

The content of .las that I have is

> 1190.09200       0.00000       0.00000       0.00000       0.00000       0.00000       0.00000       0.00000       0.00000       0.00000 
   1190.24440    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1190.39680    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1190.54920    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1190.70160    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1190.85400    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1191.00640    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1191.15880    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1191.31120    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1191.46360    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1191.61600    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000 
   1191.76840    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    -999.25000    

This is what I did so far :

import lasio
import json
import numpy
import re

data = lasio.read("./tests/well/O-CMS-001_KGAS-KINT-KOIL-KWTR-PIGN-VCL-   SUWI.las")

print data

when I build program, the output was like this :

> 'DEPT': [ 1190.092   1190.2444  1190.3968 ...,  2429.4088  2429.5612  2429.7136],
 'KGAS': [  0.  nan  nan ...,  nan  nan  nan],
 'KINT': [  0.  nan  nan ...,  nan  nan  nan],
 'KOIL': [  0.  nan  nan ...,  nan  nan  nan],

-999.25000 read as nan. Why is it happen? How to read a negative string on las file? I wrote this program that works fine but not for negative integers..!! Please help me, I'm new to Python...

1

There are 1 best solutions below

0
On

If you upgrade to lasio version 0.9.1 you should be able to prevent the substitution from -999.25 to numpy.nan with the null_subs=False keyword argument:

import lasio

data = lasio.read("./tests/well/O-CMS-001_KGAS-KINT-KOIL-KWTR-PIGN-VCL-   SUWI.las", null_subs=False)