The impact of climate on medieval societies