def windows_from_blocksize(blocksize_xy, width, height):
    """Create rasterio.windows.Window instances with given size which fully cover a raster.

    Arguments:
        blocksize_xy {int or list of two int} -- [description]
        width {int} -- With of the raster for which to create the windows.
        height {int} -- Heigth of the raster for which to create the windows.

    Returns:
        list -- List of windows according to the following format
            ``[[<row-index>, <column index>], rasterio.windows.Window(<col_off>, <row_off>, <width>, <height>)]``.
    """

    # checks the blocksize input
    value_error_msg = "'blocksize must be an integer or a list of two integers.'"
    if isinstance(blocksize_xy, int):
        blockxsize, blockysize = (blocksize_xy, blocksize_xy)
    elif isinstance(blocksize_xy, list):
        if len(blocksize_xy) != 2:
            raise ValueError(value_error_msg)
        else:
            if not all([isinstance(blocksize_xy[0], int), isinstance(blocksize_xy[1], int)]):
                raise ValueError(value_error_msg)
            blockxsize, blockysize = blocksize_xy
    else:
        raise ValueError(value_error_msg)

    # create the col_off and row_off elements for all windows
    n_cols = int(np.ceil(width / blockxsize))
    n_rows = int(np.ceil(height / blockysize))
    col = list(range(n_cols)) * n_rows
    col_off = np.array(col) * blockxsize
    row = np.repeat(list(range(n_rows)), n_cols)
    row_off = row * blockysize

    # create the windows
    # if necessary, reduce the width and/or height of the border windows
    blocksize_wins = []
    for ridx, roff, cidx, coff, in zip(row, row_off, col, col_off):
        if coff + blockxsize > width:
            bxsize = width - coff
        else:
            bxsize = blockxsize
        if roff + blockysize > height:
            bysize = height - roff
        else:
            bysize = blockysize
        blocksize_wins.append([[ridx, cidx], rasterio.windows.Window(coff, roff, bxsize, bysize)])
    return blocksize_wins
Create rasterio.windows.Window instances with given size which fully cover a raster.

    Arguments:
        blocksize_xy {int or list of two int} -- [description]
        width {int} -- With of the raster for which to create the windows.
        height {int} -- Heigth of the raster for which to create the windows.

    Returns:
        list -- List of windows according to the following format
            ``[[<row-index>, <column index>], rasterio.windows.Window(<col_off>, <row_off>, <width>, <height>)]``.