def _check_tile_metadata(path1, path2):
    """Given two tile paths, check that the projections, geotransforms and
    dimensions agree. Returns a message in string msg which, if empty,
    indicates agreement on the metadata."""
    # pylint:disable=too-many-branches
    # pylint:disable=too-many-statements

    gdal.UseExceptions()
    msg = ""
    data1 = None
    data2 = None
    # Open the tile files
    try:
        dset1 = gdal.Open(path1)
        data1 = dset1.ReadAsArray()
    except RuntimeError:
        msg += "ERROR:\tBenchmark tile %s does not exist\n"  %path1
        dset1 = None
        data1 = None

    try:
        dset2 = gdal.Open(path2)
        data2 = dset2.ReadAsArray()
    except RuntimeError:
        msg += "ERROR:\tTest Ingest tile %s does not exist\n"  %path2
        dset2 = None
        data2 = None

    # Check geotransforms present
    try:
        geotransform1 = dset1.GetGeoTransform()
    except RuntimeError:
        if dset1:
            # file exists but geotransform not present
            msg += "\tError:\tGeotransform for %s not present\n" %path1
        geotransform1 = None
    try:
        geotransform2 = dset2.GetGeoTransform()
    except RuntimeError:
        if dset2:
            # file exists but geotransform not present
            msg += "\tError:\tGeotransform for %s not present\n" %path2
        geotransform2 = None

    # Check geotransforms equal
    if geotransform1 and geotransform2:
        if geotransform1 != geotransform2:
            msg += "\tError:\tGeotransforms disagree for %s and %s\n"\
                %(path1, path2)

    # Check projections present
    try:
        projection1 = dset1.GetProjection()
    except RuntimeError:
        if dset1:
            # file exists but projections not present
            msg += "\tError:\tProjection for %s not present\n" %path1
        projection1 = None
    try:
        projection2 = dset2.GetProjection()
    except __HOLE__:
        if dset2:
            # file exists but projection not present
            msg += "\tError:\tProjection for %s not present\n" %path2
        projection2 = None

    # Check projections equal
    if projection1 and projection2:
        if projection1 != projection2:
            msg += "\tError:\tProjections disagree for %s and %s\n"\
                %(path1, path2)

    # Check the dimensions of the arrays
    if dset1 and dset2:
        if data1.shape != data2.shape:
            msg += "\tError:\tDimensions of arrays disagree for %s and %s\n" \
                %(path1, path2)
    if dset1 and data1 is None:
        msg += "\tError:\tArray data for %s not present\n" %path1
    if dset2 and data2 is None:
        msg += "\tError:\tArray data for %s not present\n" %path2

    return (data1, data2, msg)
dataset/ETHPy150Open GeoscienceAustralia/agdc/src/tilecompare.py/_check_tile_metadata