fix read data from geosys
This commit is contained in:
@@ -64,26 +64,32 @@ def read_geosys(buffer: BytesIO,
|
||||
#Daten einlesen und umwandeln
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
data = []
|
||||
|
||||
#Einlesen
|
||||
buffer.seek(0)
|
||||
|
||||
lines_file = buffer.readlines()
|
||||
lines = buffer.readlines()
|
||||
print(len(lines))
|
||||
|
||||
for line in lines_file:
|
||||
data = []
|
||||
|
||||
for line in lines:
|
||||
try:
|
||||
line = line.decode(encoding)
|
||||
line = line.split('\t')
|
||||
|
||||
if len(line) > 2:
|
||||
data.append(line)
|
||||
|
||||
v = line[0][0:3]
|
||||
if len(v) == 3:
|
||||
if (table == v) or (pkdata == v) or (v in metadata_ids):
|
||||
data.append(line)
|
||||
except:
|
||||
raise
|
||||
pass
|
||||
|
||||
if debug:
|
||||
print('Anz. Datensätze: ', str(len(data)), getsizeof(data))
|
||||
|
||||
#aufräumen
|
||||
##Datenstruktur anlegen
|
||||
|
||||
@@ -108,6 +114,8 @@ def read_geosys(buffer: BytesIO,
|
||||
# replace object
|
||||
data = data_processed
|
||||
|
||||
assert len(data['data']) != 0
|
||||
|
||||
if debug:
|
||||
print('data_clean fin')
|
||||
|
||||
@@ -133,6 +141,7 @@ def read_geosys(buffer: BytesIO,
|
||||
|
||||
if debug:
|
||||
print(id_durchmesser, id_hoehe, id_name)
|
||||
|
||||
elif idx == 1:
|
||||
unit_durch = None
|
||||
unit_hoehe = None
|
||||
@@ -169,10 +178,14 @@ def read_geosys(buffer: BytesIO,
|
||||
sel = meta[key]
|
||||
|
||||
assert len(sel[0]) == len(sel[2])
|
||||
header_append = {
|
||||
sel[0][i]: sel[2][i].strip()
|
||||
for i in range(len(sel[0]))
|
||||
}
|
||||
|
||||
if len(sel) <= 3:
|
||||
d = { sel[0][i]: sel[2][i].strip() for i in range(len(sel[0])) }
|
||||
# Fix: In Geosys gibt es den Parameter Oberspannung zweimal. Erster entfernen
|
||||
else:
|
||||
d = { sel[0][i]: sel[3][i].strip() for i in range(len(sel[0])) }
|
||||
|
||||
header_append = d
|
||||
|
||||
header.update(header_append)
|
||||
|
||||
@@ -186,10 +199,12 @@ def read_geosys(buffer: BytesIO,
|
||||
print('daten umwandel')
|
||||
|
||||
temp = []
|
||||
|
||||
for idx, row in enumerate(data['data']):
|
||||
|
||||
if idx == 0:
|
||||
if debug:
|
||||
print('head')
|
||||
print('convert head')
|
||||
data_head = []
|
||||
for idx_name, name in enumerate(row):
|
||||
if idx_name <= 1: continue
|
||||
|
||||
Reference in New Issue
Block a user