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