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

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


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