Bad logic for extract pixel/line
l1aextract_netcdf.py and l1cextract.py employ incorrect logic in calculating start/end lines and pixels when extracting from an extracted granule:
if 'extract_pixel_start' in infile.ncattrs():
outfile.extract_pixel_start = np.dtype('int32').type(infile.extract_pixel_start + self.spixl + 1)
outfile.extract_pixel_stop = np.dtype('int32').type(infile.extract_pixel_stop + self.epixl + 1)
outfile.extract_line_start = np.dtype('int32').type(infile.extract_line_start + self.sline + 1)
outfile.extract_line_stop = np.dtype('int32').type(infile.extract_line_stop + self.eline + 1)
else:
outfile.extract_pixel_start = np.dtype('int32').type(self.spixl + 1)
outfile.extract_pixel_stop = np.dtype('int32').type(self.epixl + 1)
outfile.extract_line_start = np.dtype('int32').type(self.sline + 1)
outfile.extract_line_stop = np.dtype('int32').type(self.eline + 1)
Consider a granule extracted twice with epixl=1000. This code would cause the second extraction to set epixl=2000.
Actually, it would be epixl=2001, since internally self.epixl is zero-based, but the attribute is 1-based. The second extraction causes 1 to be added twice.
Edited by Gwyn Fireman