Skip to content
Snippets Groups Projects
Commit b258dbd6 authored by Michael Hiley's avatar Michael Hiley
Browse files

hack in nearest neighbor stuff

currently just puts interpolated data in existings HIRS channels.

had to fix apparent bug in HirsMask to get this to work.
parent ea34be93
No related branches found
No related tags found
No related merge requests found
......@@ -310,11 +310,11 @@ class AVHRR(Sensor):
@reify
def SounderEmissive(self):
return self.HirsBands[0]
return self.HirsBandsNearestNeighbor[0]
@reify
def SounderBTs(self):
return self.HirsBands[1]
return self.HirsBandsNearestNeighbor[1]
@reify
def SounderCenters(self):
......@@ -441,7 +441,32 @@ class AVHRR(Sensor):
@reify
def HirsMask(self):
elems = self.SounderElementIndex
elems[elems != -999.0] = 1
elems[elems == -999.0] = 0
elems = self.SounderElementIndex.copy()
elems[elems != -999] = 1
elems[elems == -999] = 0
return elems.astype(np.int8)
@reify
def HirsBandsNearestNeighbor(self):
from iff_avhrr_nearest_neighbor import do_interpolation
interp_rad = self.HirsBands[0].copy()
interp_bt = self.HirsBands[1].copy()
log.debug('starting nearest neighbor interpolation')
(interp_i, interp_j, hirs_i, hirs_j) = do_interpolation(
self.HirsMask.astype(np.uint32),
self.SounderLineIndex,
self.SounderElementIndex,
0, self.HirsMask.shape[0])
print 'HirsMask shape: ', self.HirsMask.shape
print 'SounderLineIndex shape: ', self.SounderLineIndex.shape
print 'interp_i shape: ', interp_i.shape
print 'interp_j shape: ', interp_j.shape
print 'hirs_i shape: ', hirs_i.shape
print 'hirs_j shape: ', hirs_j.shape
print 'interp_bt shape: ', interp_bt.shape
print 'HirsBands[1] shape: ', (self.HirsBands[1]).shape
log.debug('finished with nearest neighbor interpolation')
for i in range(interp_rad.shape[0]):
interp_rad[i, interp_i, interp_j] = (self.HirsBands[0])[i, hirs_i, hirs_j]
interp_bt[i, interp_i, interp_j] = (self.HirsBands[1])[i, hirs_i, hirs_j]
return (interp_rad, interp_bt)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment