Commit e07f9119 authored by Xiaowu Zhang's avatar Xiaowu Zhang

ors_wendelin: load chunk data to calculate kpi

parent 6d8555e2
import numpy as np
from DateTime import DateTime
progress_indicator = in_stream["Progress Indicator"]
in_data_stream = in_stream["Data Stream"]
start = progress_indicator.getIntOffsetIndex()
end = in_data_stream.getSize()
if start >= end:
total_size = in_data_stream.getSize()
if start >= total_size:
return
chunk_size = 1024*1024
if start + chunk_size > total_size:
end = total_size
else:
end = start + chunk_size
chunk_data = "".join(in_data_stream.readChunkList(start, end))
# last one maybe a not valide json
split_chunk_data = chunk_data.splitlines()
if len(split_chunk_data) < 2:
return
chunk_data = '\n'.join(split_chunk_data[:-1])
end = start + len(chunk_data) + 1
chunk_data = chunk_data.decode('utf8')
e_rab_data_array = None
e_utran_data_array = None
......@@ -17,8 +34,7 @@ for array in out_array:
if array['variation'] == 'e_utran':
e_utran_data_array = array['Data Array']
data = in_data_stream.getData().decode('utf8')
vt, vInititialEPSBEstabSR, vAddedEPSBEstabSR, evt, vIPThp_qci = context.Base_getORSKPIValue(data)
vt, vInititialEPSBEstabSR, vAddedEPSBEstabSR, evt, vIPThp_qci = context.Base_getORSKPIValue(chunk_data)
e_rab_dtype = np.dtype([
('vt', 'float'),
......@@ -37,15 +53,13 @@ e_utran_dtype =np.dtype([
])
e_rab_array = e_rab_data_array.getArray()
#XXXXXXXXXX initialise every time because of kpi calculation
if not e_rab_array or True:
if not e_rab_array:
e_rab_array = e_rab_data_array.initArray(shape=(0,), dtype=e_rab_dtype)
e_rab_array_data = []
e_utran_array = e_utran_data_array.getArray()
#XXXXXXXXXX initialise every time because of kpi calculation
if not e_utran_array or True:
if not e_utran_array:
e_utran_array = e_utran_data_array.initArray(shape=(0,), dtype=e_utran_dtype )
e_utran_array_data = []
......@@ -63,7 +77,6 @@ if e_utran_array_data:
e_utran_array_data = np.ndarray((len(e_utran_array_data), ), e_utran_dtype, np.array(e_utran_array_data))
e_utran_array.append(e_utran_array_data)
progress_indicator.setIntOffsetIndex(end)
return
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment