1

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...

Amir Charkhi
  • 768
  • 7
  • 23
  • can you post what you have tried so far? – Hackaholic Oct 19 '15 at 09:43
  • this is the code that i've try so far – user2029297 Oct 20 '15 at 03:16
  • 1
    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. – kii Nov 11 '15 at 01:39

1 Answers1

2

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)
kii
  • 497
  • 3
  • 11