-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vieil outil pour convertir porosite en permeabilite
- Loading branch information
Frederic Merizen
committed
Feb 22, 2012
1 parent
cf39a54
commit 4c9b1ea
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |