簡體   English   中英

如何使用python lasio讀取文件的負數

[英]how to read negative number of a file with python lasio

我有文件 .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.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版本0.9.1 ,你應該能夠防止替代從-999.25到numpy.nannull_subs=False關鍵字參數:

import lasio

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM