A unified index to measure ecological diversity and species rarity