如何使用python lasio读取文件的负数
我有file.las,我用python lasio阅读它。但当我打印文件时,lasio读取了一些负数作为Nan 我拥有的.las的内容是如何使用python lasio读取文件的负数,python,io,log-ascii-standard,Python,Io,Log Ascii Standard,我有file.las,我用python lasio阅读它。但当我打印文件时,lasio读取了一些负数作为Nan 我拥有的.las的内容是 > 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.25
> 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
这就是我目前所做的:
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
当我构建程序时,输出如下:
> '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读作nan。为什么会发生这种情况?如何读取las文件中的负字符串?我写了这个程序,它可以很好地工作,但不适用于负整数。。!!请帮帮我,我是Python新手…如果升级到lasio,您应该能够使用null\u subs=False
关键字参数防止将-999.25替换为numpy.nan
:
import lasio
data = lasio.read("./tests/well/O-CMS-001_KGAS-KINT-KOIL-KWTR-PIGN-VCL- SUWI.las", null_subs=False)
您可以发布您迄今为止尝试过的内容吗?这是我到目前为止尝试过的代码。似乎LAS文件头部分中的
NULL
项设置为-999.25,并且数据中的那些负值确实应该作为NULL或无效值读入。如果您将该行从-999.25更改为其他值,则应该删除lasio读入的数据中的nan
值。