Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything. 5 If any of you lacks wisdom, you should ask God, who gives generously to all without finding fault, and it will be given to you.
Specifically James 1:2, but the rest is helpful too.
It's like this bite-sized version of the answer to "Why are we here" to me, and quite useful to keep in mind during both times of sunshine and rain.