Is the use of the past perfect in this sentence correct and if so why or should it be the past tense?
"The sun was shining when I got up this morning, but by ten o'clock it had disappeared entirely behind the clouds."
The sentence is standard [good] English. You used the past perfective there to show that the event (the sun's disappearance) happened before the other past event - the arrival of 10 0'clock.
Some grammarians say that this use of past perfective conveys "past in the past."