(CNN)Sauropods were the largest animals to ever walk the Earth.
These long-necked dinosaurs could grow the length of three school buses and were so heavy the ground must have shaken as they walked.
This family of dinosaurs, however, wasn't always so gigantic. In the first 50 million years of their evolutionary history, sauropods were much more diverse. While some were quite large, at about 10 meters in length, the family also included more lightly built animals that were no larger than a goat. What's more, some sauropods walked on two legs while others used four.
So how did these dinos with the signature long neck get so big?
Fossil finds from Patagonia in South America have shed new light on this mystery. A team of paleontologists has discovered one of the earliest known large sauropods, and plant fossils in the rock layers surrounding the dinosaur fossil provide evidence of the climate and ecosystem in which the newly identified species of dinosaur lived. The scientists named it Bagualia alba after Bagual Canyon, where the dinosaur fossil was found, and alba, which means "dawn" in Spanish, for its early age.
The sauropod's huge size was likely a response to a shift in climate 180 million years ago during the early Jurassic period, the new research has suggested. This evolutionary transformation was triggered by massive volcanic eruptions in the Southern Hemisphere that resulted in a change of flora that formed the plant-eating sauropod diet.
"There (were) lava flows extended for over a million square miles. This is way larger than anything we have witnessed in human times. Large amounts of CO2 and methane were released to the atmosphere and there is a well studied warming of the climate at a global scale," Diego Pol, principal researcher at the Museum of Paleontology Egidio Feruglio in Argentina told CNN via email.
"But we did not know what was the effect of this global crisis in the terrestrial ecosystems. Our lack of knowledge was because sediments with dinosaurs and plants of that particular age are very uncommon."
The shift in diet meant that many sauropod groups disappeared and only one lineage survived -- the big sauropods known as eusauropods. Bagualia alba would likely have been 10 tons -- around the size of two African elephants -- but later sauropods were up to 40 meters in length and weighed 70 tons.
Change in vegetation
In particular, it was the change in vegetation in a harsher climate that led to the extinction of most sauropods. Tall conifer trees came to dominate the warmer, more arid environment. These trees supplanted the lush vegetation of the humid environment that preceded the volcanic event. Fossils from this environment show ferns with fronds larger than 6 feet, Pol said.
"The only ones that survived this crisis were eusauropods. They have long been regarded as bulk feeders, with teeth and jaws that were able to cut and swallow all kinds of plants including conifers.
"Moreover we found that the enamel of the teeth of Bagualia was about 7 times thicker than those of the other herbivores that went extinct. This allowed them to feed on the tough coriaceous leaves of conifers," said Pol, referring to the new species of dinosaur.
In fact, the large digestive chambers needed to cope with this kind of vegetation were probably one reason why these animals reached these huge sizes.
And the long necks? They would have enabled them to reach the tall conifers and allowed them to access different plants without moving their huge bodies, Pol said.
"Their large bodies required them to eat a large amount of food to meet their energetic requirements. But if you are big and heavy and have to move a lot to acquire the food you need, you may spend quite a lot of energy (and then require even more food)," he said.
Giant animals also produce a lot of body heat, and other studies have suggested that their long neck could dissipate body heat -- a bit like the big ears of modern elephants, Pol explained.
The research was published in the journal Proceedings of the Royal Society B on Tuesday.