import logging
import re


def get_landsat_angles(productdir):
    """
        Get Landsat angle bands file path.

        Parameters:
            productdir (str): path to directory containing angle bands.
        Returns: 
            sz_path, sa_path, vz_path, va_path: file paths to solar zenith, solar azimuth, view (sensor) zenith and vier (sensor) azimuth.
    """
    img_list = list(productdir.glob('**/*.tif'))
    logging.info('Load Landsat Angles')
    pattern = re.compile('.*_solar_zenith_.*')
    sz_path = list(item for item in img_list if pattern.match(str(item)))[0]
    pattern = re.compile('.*_solar_azimuth_.*')
    sa_path = list(item for item in img_list if pattern.match(str(item)))[0]
    pattern = re.compile('.*_sensor_zenith_.*')
    vz_path = list(item for item in img_list if pattern.match(str(item)))[0]
    pattern = re.compile('.*_sensor_azimuth_.*')
    va_path = list(item for item in img_list if pattern.match(str(item)))[0]

    return sz_path, sa_path, vz_path, va_path