Impact of energy filtering and carrier localization on the thermoelectric properties of granular semiconductors