The imprint of climate and geology on the residence times of groundwater