def _header2row_numbers(local_header, global_header):
    """Calculate local grid starting and ending rows in global grid

    Return:

        ind_top: the index of the top row

        ind_bottom: the index of the bottom row
        
    """
    y_bottom_gap = local_header['yllcorner']-global_header['yllcorner']
    row_gap = round(y_bottom_gap/local_header['cellsize'])
    ind_bottom = global_header['nrows']-1-row_gap
    ind_top = ind_bottom-local_header['nrows']+1
    ind_top = int(ind_top)
    ind_bottom = int(ind_bottom)
    return ind_top, ind_bottom