1
votes

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
can you post what you have tried so far?Hackaholic
this is the code that i've try so faruser2029297
It seems likely that the NULL item in the LAS file's header section is set to -999.25, and that those negative values in the data are indeed supposed to be read in as null or invalid values. If you change that line from -999.25 to some other value, then you should get rid of the nan values in the data that lasio reads in.kinverarity

1 Answers

2
votes

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)