in analysis/webservice/algorithms/doms/MatchupQuery.py [0:0]
def __getSatNodeForLatLonAndTime(self, chunksByDay, source, lat, lon, searchTime, xyTolerance):
timeDiff = 86400 * 365 * 1000
foundNodes = []
for ts in chunksByDay:
chunks = chunksByDay[ts]
if abs((ts * 1000) - searchTime) < timeDiff:
for chunk in chunks:
indexes, latlons = self.__getChunkIndexesForLatLon(chunk, lat, lon, xyTolerance)
# for index in indexes:
for i in range(0, len(indexes)):
index = indexes[i]
latlon = latlons[i]
sst = None
sss = None
windSpeed = None
windDirection = None
windU = None
windV = None
value = self.__getChunkValueAtIndex(chunk, index)
if isinstance(value, float) and (math.isnan(value) or value == np.nan):
continue
if "GHRSST" in source:
sst = value
elif "ASCATB" in source:
windU = value
elif "SSS" in source: # SMAP
sss = value
if len(chunks) > 0 and "wind_dir" in chunks[0].meta_data:
windDirection = self.__checkNumber(self.__getChunkValueAtIndex(chunk, index, "wind_dir"))
if len(chunks) > 0 and "wind_v" in chunks[0].meta_data:
windV = self.__checkNumber(self.__getChunkValueAtIndex(chunk, index, "wind_v"))
if len(chunks) > 0 and "wind_speed" in chunks[0].meta_data:
windSpeed = self.__checkNumber(self.__getChunkValueAtIndex(chunk, index, "wind_speed"))
foundNode = {
"sea_water_temperature": sst,
"sea_water_salinity": sss,
"wind_speed": windSpeed,
"wind_direction": windDirection,
"wind_u": windU,
"wind_v": windV,
"time": ts,
"x": self.__checkNumber(latlon[1]),
"y": self.__checkNumber(latlon[0]),
"depth": 0,
"sea_water_temperature_depth": 0,
"source": source,
"id": "%s:%s:%s" % (ts, lat, lon)
}
foundNodes.append(foundNode)
timeDiff = abs(ts - searchTime)
return foundNodes