Skip to content

Commit

Permalink
vieil outil pour convertir porosite en permeabilite
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Merizen committed Feb 22, 2012
1 parent cf39a54 commit 4c9b1ea
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions permeabilite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/python
import sys
import re
import math

class Loi(object):
def __init__(self, a, b):
self.a = a
self.b = b

def perm(self, poro):
return self.a * math.exp(self.b * poro)

coeffs = {
"102.0000": Loi(0.005, 0.525),
"103.0000": Loi(0.015, 0.549),
"104.0000": Loi(0.098, 0.536),
}

loi_defaut = Loi(0.002, 0.471)

def get_loi(c):
return coeffs.get(c, loi_defaut)

entree_las = open(sys.argv[1], 'r')
sortie_las = open(sys.argv[2], 'w')

whitespace = re.compile('[ \t]+')

ligne = ""
while ligne != "~Ascii":
ligne = entree_las.readline().strip()
sortie_las.write(ligne + "\n")

for ligne in entree_las:
ligne = ligne.strip()
elems = whitespace.split(ligne)

loi = get_loi(elems[5])
poro = float(elems[1])
perm = loi.perm(poro)
elems[5] = "{0:.4f}".format(perm)

sortie_las.write(" ".join(map(str, elems))+"\n")

0 comments on commit 4c9b1ea

Please sign in to comment.