Arrived at by counting the number of distinct surnames listed as householders in each county in Griffith's Valuation, and dividing this number by the area of the county in square kilometres.
Caveats: "Distinct surnames" is literally that. "McIlhatton", McElhatton" and "McElhattan" are counted as different, so random spelling variation introduces noise into the statistical signal. Topography is also a distorting factor. Mountainous and very infertile areas such as bogs have significantly lower populations, hence fewer surnames per square kilometre.
Nonetheless, some clear features emerge. After Dublin, the area with by far the greatest variety of surnames is the ancient tuatha of Oriel, comprising parts of Armagh, Louth and Monaghan. The western seaboard counties (with the striking exception of Sligo) have surname densities well below average, even though they were the most densely populated areas at the period. The north-eastern counties, with their mix of Scots-irish and Gaelic-Irish, have surname variety well above average.
The clear corollary is that surname variety or density is a respectable proxy for cultural purity and cultural diversity.