@window_data
def test_crop_image_from_and_get_win_do_the_same_with_resize(self):
    bounds = (2, 3, 4, 5)
    win = rasterio.windows.Window(bounds[0], bounds[1], (bounds[2] - bounds[0]), (bounds[3] - bounds[1]))
    xsize = round(((bounds[2] - bounds[0]) / 2))
    ysize = round(((bounds[3] - bounds[1]) / 2))
    raster = self.read_only_virtual_geo_raster()
    with NamedTemporaryFile(mode='w+b', suffix='.tif') as rf:
        raster.save(rf.name)
        raster.save('area.tif', tags={'AREA_OR_POINT': 'Area'})
        raster.save('point.tif', tags={'AREA_OR_POINT': 'Point'})
        saved_raster = GeoRaster2.open(rf.name)
        cropped_win = saved_raster.get_window(win, xsize=xsize, ysize=ysize)
        saved_raster_area = GeoRaster2.open('area.tif')
        cropped_win_area = saved_raster_area.get_window(win, xsize=xsize, ysize=ysize)
        saved_raster_point = GeoRaster2.open('point.tif')
        cropped_win_point = saved_raster_point.get_window(win, xsize=xsize, ysize=ysize)
    cropped_image = raster._crop(bounds, xsize=xsize, ysize=ysize)
    print('cropped_win_area pixels\n', cropped_win_area.image)
    print('cropped_win_point pixels\n', cropped_win_point.image)
    print('cropped_win pixels\n', cropped_win.image)
    print('cropped_image pixels\n', cropped_image.image)
    if (cropped_win_point == cropped_win_area):
        print('point == area')
    if (cropped_image == cropped_win_area):
        print('image == area')
    if (cropped_image == cropped_win_point):
        print('image == point')
    if (cropped_win == cropped_win_area):
        print('win == area')
    if (cropped_win == cropped_win_point):
        print('win == point')
    self.assertEqual(cropped_image, cropped_win)
@window_data
def test_crop_image_from_and_get_win_do_the_same_with_resize(self):
    bounds = (2, 3, 4, 5)
    win = rasterio.windows.Window(bounds[0], bounds[1], (bounds[2] - bounds[0]), (bounds[3] - bounds[1]))
    xsize = round(((bounds[2] - bounds[0]) / 2))
    ysize = round(((bounds[3] - bounds[1]) / 2))
    raster = self.read_only_virtual_geo_raster()
    with NamedTemporaryFile(mode='w+b', suffix='.tif') as rf:
        raster.save(rf.name)
        raster.save('area.tif', tags={'AREA_OR_POINT': 'Area'})
        raster.save('point.tif', tags={'AREA_OR_POINT': 'Point'})
        saved_raster = GeoRaster2.open(rf.name)
        cropped_win = saved_raster.get_window(win, xsize=xsize, ysize=ysize)
        saved_raster_area = GeoRaster2.open('area.tif')
        cropped_win_area = saved_raster_area.get_window(win, xsize=xsize, ysize=ysize)
        saved_raster_point = GeoRaster2.open('point.tif')
        cropped_win_point = saved_raster_point.get_window(win, xsize=xsize, ysize=ysize)
    cropped_image = raster._crop(bounds, xsize=xsize, ysize=ysize)
    print('cropped_win_area pixels\n', cropped_win_area.image)
    print('cropped_win_point pixels\n', cropped_win_point.image)
    print('cropped_win pixels\n', cropped_win.image)
    print('cropped_image pixels\n', cropped_image.image)
    if (cropped_win_point == cropped_win_area):
        print('point == area')
    if (cropped_image == cropped_win_area):
        print('image == area')
    if (cropped_image == cropped_win_point):
        print('image == point')
    if (cropped_win == cropped_win_area):
        print('win == area')
    if (cropped_win == cropped_win_point):
        print('win == point')
    self.assertEqual(cropped_image, cropped_win)