Four times in two days NASA flight managers opted out of chances to end Discovery's 14-day mission at its home port, the Kennedy Space Center, because clouds and rain loomed too close to the landing strip.
NASA decided to divert to California because of rain and possible lightning within 35 miles of the runway in Florida.
The mission is the first since Columbia was destroyed on Feb. 1, 2003, 16 minutes from landing.
Columbia's wing had been critically damaged during launch by a piece of insulating foam that fell from the shuttle fuel tank. As the spacecraft raced through Earth's atmosphere 16 days later for landing, superheated gases blasted into the hole, ripping the ship apart and killing all seven astronauts on board.
NASA spent $1 billion on repairs and safety upgrades. But a chunk of insulating foam almost as large as the one that damaged Columbia flew off Discovery's fuel tank at, telling NASA managers they had failed to fix the problem.
The space agency grounded the shuttle fleet again and said they would not fly until the foam problem is solved.
Discoveryon a servicing and resupply mission. The crew delivered a new steering gyroscope to the outpost and revived a second failed device.
The astronauts also made the shuttle program's first in-flight heat shield repair. Astronaut Stephen Robinson rode the space station's robot arm to Discovery's belly to remove two protruding cloth strips from the smooth surface of the ship's belly.
NASA managers were concerned the strips could disrupt air flow over the shuttle and raise temperatures beyond what the shuttle can withstand.
NASA would have preferred landing the shuttle in Florida rather than California. Landing at Edwards involves a week of processing time, a $1 million expense and the risks associated with a cross-country ferry flight to return the shuttle to Florida.