-
Notifications
You must be signed in to change notification settings - Fork 1
/
extract_volumes.py
executable file
·75 lines (60 loc) · 2.06 KB
/
extract_volumes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 10:48:35 2020
@author: sainteno
"""
#%% Import de librairies
#import itertools
import numpy as np
#import sys
import os
#import h5py
#import math
#import numpy as np
#from scipy.stats import linregress
import matplotlib.pyplot as plt
import pandas as pd
#%% Import du script de définition des param geometrie et GPR max
from param_acquisition import nT, geometry, ParamMVG, paramGPRMAX, temps
from outils import read_parameters, rada_plot
#%% parcours le dossier OUT
dir_name = "OUTdtrou30_rtrou4_tr5.0"
PickedVolumes=pd.DataFrame(columns=['Volumes'])
for subdir in os.listdir(dir_name):
if os.path.isfile(subdir):
print("'%s' pas un dossier" % subdir)
continue
print(subdir)
subdir_name = os.path.join(dir_name, subdir)
p = read_parameters(subdir_name)
paramMVG = ParamMVG(tr=p[2], ts=p[0], ti=p[1], Ks=p[5], n=p[3], alpha=p[4])
paramMVG.porosity = paramMVG.ts
filename_SWMS = os.path.join(subdir_name, "SWMS_2D.OUT", "Balance.out")
if not os.path.isfile(filename_SWMS):
print("Pas de Balance.out")
continue
InFlow=np.zeros(nT+1)
dVolume=np.zeros(nT)
Volume_infiltre=np.zeros(nT+1)
i=0
fVOL=open(filename_SWMS,"r")
for ligne in fVOL:
if 'InFlow' in ligne:
mots = ligne.split(" ")
InFlow[i] = float(mots[10])
i=i+1
fVOL.close()
dVolume[0] = temps[0] * InFlow[1]
Volume_infiltre[1] = Volume_infiltre[0] + dVolume[0]
for i in range(1,nT):
dVolume[i] = (temps[i] - temps[i-1]) * InFlow[i+1]
Volume_infiltre[i+1] = Volume_infiltre[i] + dVolume[i]
PickedVolumes['Volumes']=Volume_infiltre
PickedVolumes['Volumes'].to_csv(subdir_name + 'Volumes_EL.csv', sep=',', encoding='utf-8', index=None, header=True)
# Pour plotter le volume au cours du temps d'infiltration
# axe=np.zeros(nT+1)
# axe[1:nT+1]=temps
# plt.xlabel("Time (ns)")
# plt.ylabel("Infiltrated volume of water (cm^3)")
# plt.plot(axe,Volume_infiltre)