Code: Alles auswählen
pos_sum = np.array([])
for j in len(daten):
#...mach ich was und erhalte:
#pos (1d array)
#tc_mean (1d array)
ax1 = np.vstack([pos,tc_mean]).T
pos_sum.concatenate((ax1),axis=0)
Code: Alles auswählen
pos_sum = np.array([])
for j in len(daten):
#...mach ich was und erhalte:
#pos (1d array)
#tc_mean (1d array)
ax1 = np.vstack([pos,tc_mean]).T
pos_sum.concatenate((ax1),axis=0)
Code: Alles auswählen
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import re
import numpy as np
import matplotlib.pyplot as plt
import glob
import os.path
import scipy
from scipy import stats
from pylab import *
#==============================================================================
"""
Open the txt-file 'Begin_measurment.txt' in the folder 'Begin_measurment' and
strip the '\n' from each line what stands for next line
and split the text line with space. After this read every second string.
"""
with open('Begin_measurment\Begin_measurment.txt','r') as begin_file:
for lines in begin_file:
eee = lines.rstrip('\n')
arr = eee.split(' ')
begin_val = list(arr[1::2])
#print(begin_val)
"""
Porosity values
"""
with open('Begin_measurment\Porosity.txt','r') as porosity_file:
for lines in porosity_file:
fff = lines.rstrip('\n')
arr2 = fff.split(' ')
poro_val = list(arr2[1::2])
#print(poro_val)
tc_mean_sum = []
td_mean_sum = []
tc_ins_mean_sum = []
aua_sum = np.array([])
#aua_sum = np.concatenate((aua))#np.array([])
#==============================================================================
"""
Open all txt-files in the current folder. Sort them. Open ever file and read
them.
"""
files = glob.glob("*.txt")
files.sort()
for j in range(len(files)):
datei = files[j]
in_file = open(datei)
text = in_file.read()
#==============================================================================
"""
Find all lines with 'p9' and show the hole line because in this lines are
all results with the final correction. And then delete the first two lines
because this are the headings.
"""
s=re.findall(r'.*p9.*$',text,re.MULTILINE)
del s[0:2]
#==============================================================================
"""
It will be created a array. The collums will be seperated with spaces. This
starts at the fourth position because every line beginn with 'p9 ':
"""
x = np.array([np.fromstring(line[3:], sep=" ") for line in s])
#==============================================================================
"""
Calculate the position of the mesurment in the borehole with the millimeter
position form the TC and TD mesurment and the beginning positioms form
'Begin_measurment.txt' file
"""
pos_hole = (x[:,4] + (float(begin_val[j])*1000))/1000
#print(pos_hole)
#==============================================================================
"""
Wärmeleitfähigkeit auf in-situ Bedingungen umrechnen
"""
"""
Füllung: Wasser TC = 0.7 W/m/K
"""
tc_fluid = ((x[:,3])**(1-(float(poro_val[j]))))*(0.7**(float(poro_val[j]))) #porosität 1>poro_val>0 [nach Woodside, Goto]
"""
Temperatur
"""
# tc_fluid_temp = ((tc_fluid) - ((10**(-3))) * (20-293) * ((tc_fluid)-1.28) *
# ((tc_fluid) * (1.8*(10**(-3))*20)**(-0.25*(tc_fluid)) + 1.28) # für t 20 grad nach [somerton]
# * ((x[:,3])**(-0.64)))
tc_null = tc_fluid*(1.007+25*(0.0037 - (0.0074/tc_fluid))) #nach sass et al
tc_fluid_temp = tc_null/(1.007+15*(0.0036-(0.0072/tc_null)))
"""
Druck
"""
tc_insitu = (tc_fluid_temp)*(1+3.77*((pos_hole/1000)/3.4)) # nach seipold wert für alpha = 3.77 quarzitischer sandstein
#==============================================================================
tc_mean = ((x[:,3]).mean())
tc_insitu_mean = (tc_insitu.mean())
td_mean = ((x[:,6]).mean())
tc_mean1 = ((np.ones(len(x[:,3]))*tc_mean))
tc_insitu_mean1 = np.ones(len(x[:,3]))*tc_insitu_mean
td_mean1 = np.ones(len(x[:,6]))*td_mean
#the varianz
tc_var = ((x[:,3]).var())
tc_insitu_var = (tc_insitu.var())
td_var = ((x[:,6]).var())
##Standard deviation
tc_std = ((x[:,3]).std())
tc_insitu_std = (tc_insitu.std())
td_std = ((x[:,6]).std())
tc_mean_sum.append(tc_mean)
td_mean_sum.append(td_mean)
tc_ins_mean_sum.append(tc_insitu_mean)
pos_hole_sum.append(pos_hole)
aua = np.vstack([pos_hole,tc_mean1]).T
aua_sum.concatenate((aua),axis=0)
Code: Alles auswählen
import numpy as np
a1 = np.array(range(10))
ss =[1,2,3,4,5]
sum_aus = np.array([])
for i in range(len(ss)):
pos = a1[:]*i
das = a1[:]+i
aus = np.vstack([pos,das]).T
Code: Alles auswählen
import numpy as np
a1 = np.arange(10)
ss =[1,2,3,4,5]
result = []
for idx, _ in enumerate(ss):
pos = a1 * idx
das = a1 + idx
result.append(np.vstack([pos, das]).T)
result = np.vstack(result)