def create_rectangle_geo(LATRES, LONRES, ORIGIN_LAT, ORIGIN_LON, rowno, startcol, linedata): # find a rectangle of pixels with the same value, and represent that pixel instead endcol = startcol while (endcol < len(linedata)) and (linedata[endcol] == linedata[startcol]): endcol = endcol + 1 return create_geo(LATRES, LONRES, ORIGIN_LAT, ORIGIN_LON, rowno, startcol, endcol)