Commit c3c69de8 authored by Daniel Eggert's avatar Daniel Eggert
Browse files

applied changes addressing the updated index-mediator-server communication scheme

Former-commit-id: 165205fd
Former-commit-id: c80ba350
parent 80041303
......@@ -149,8 +149,8 @@ class SpatialIndexMediator:
filterTimerange = not (refDate is None or maxDaysDelta is None)
# prepare buffer
# numbytes = 1 + 4*8 + 8 + 8 + 4 + 1 + 1 + 2
b = bytearray(57)
# numbytes = 1 + 4*8 + 8 + 8 + 4 + 1 + 1 + 2 + 2
b = bytearray(59)
# pack msg header and envelope
offset = 0
......@@ -167,7 +167,8 @@ class SpatialIndexMediator:
seasonCode = self.__deriveSeasonCode(refDate, maxDaysDelta)
# pack the rest
struct.pack_into('> i 2b h', b, offset, seasonCode, minCloudCover, maxCloudCover, datasetid)
# TODO: send unconstraint min/max proclevel values
struct.pack_into('> i 2b h 2b', b, offset, seasonCode, minCloudCover, maxCloudCover, datasetid, 0, 127)
# get connection and lock the channel
con = Connection(self.host, self.port, self.timeout)
......@@ -204,15 +205,16 @@ class SpatialIndexMediator:
scenes = []
for _x in range(numScenes):
scenedata = struct.unpack_from('> i h 8b', b, offset)
offset += 14
scenedata = struct.unpack_from('> i h 9b', b, offset)
offset += 15
print scenedata
timestamp = datetime(scenedata[1], scenedata[2], scenedata[3], scenedata[4], scenedata[5], scenedata[6])
# ignore unused scenedata[7]
# read bounds
numBounds = scenedata[9]
numBounds = scenedata[10]
fmt = "> {0}d".format(numBounds)
bounds = struct.unpack_from(fmt, b, offset)
offset += numBounds * 8
......@@ -230,7 +232,7 @@ class SpatialIndexMediator:
continue
# create scene
scenes.append(Scene(scenedata[0], timestamp, scenedata[8], bounds))
scenes.append(Scene(scenedata[0], timestamp, scenedata[8], scenedata[9], bounds))
return scenes
......@@ -291,7 +293,7 @@ class Connection:
class Scene:
"""Scene Metadata class"""
def __init__(self, sceneid, acquisitiondate, cloudcover, bounds):
def __init__(self, sceneid, acquisitiondate, cloudcover, proclevel, bounds):
"""
:param sceneid: database sceneid, e.g. 26366229
:param acquisitiondate: acquisition date of the scene as datetime instance, e.g. 2016-03-25 10:15:26
......@@ -302,6 +304,7 @@ class Scene:
self.sceneid = sceneid
self.acquisitiondate = acquisitiondate
self.cloudcover = cloudcover
self.proclevel = proclevel;
self.bounds = bounds
tempList = list(bounds) + [None] * 2
self.coordsLonLat = [tempList[n:n + 2] for n in range(0, len(bounds), 2)]
......
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