Peru's northern coast has one of the world's driest deserts, except for when El Niño drowns it with massive flooding. Rainwater from the nearby Andean foothills gushes down parched ravines, often tearing up modern agricultural fields in the sediment-rich plains of the desert's few rivers. Ari Caramanica, an archaeologist at the Universidad del Pacífico in Lima, had long been intrigued by what looked like lengthy, straight, ancient “structures” crisscrossing parts of this desert, which is called the Pampa de Mocan. Caramanica first noticed these strange lines in 1940s photographs. Now she and her colleagues say farmers built them in pre-Hispanic times as a sophisticated, flexible-use canal system—which usually used river water but harnessed the wild El Niño floodwaters when they came—to survive and prosper in a challenging environment.

El Niño events occur in irregular six- to 20-year cycles, and they are difficult to predict. But Caramanica and her team's new research suggests farmers working between a.d. 1 and 1476 were prepared. The scientists examined the Pampa de Mocan archaeological record to chart how these farmers benefited from El Niño floods; their research is reported in the Proceedings of the National Academy of Sciences USA.

By studying clues such as discarded agricultural tools, plant remains and field locations, the team determined that farmers selectively used the canals to direct El Niño floodwaters to fields farther from the rivers, beyond the reach of their typical river-water irrigation. Some of these fields were enclosed by low mounds that allowed water to collect. The ancient farmer-engineers also built small rock piles to slow the water's movement and to collect fertile silt.

Caramanica says she had initially assumed that the photographed structures were used for more common river-water agriculture. But her team found they had multiple roles—some even acting as fields themselves when El Niño damage cut them off from rivers. “They were being constantly patched together to take advantage of whenever and wherever water appeared,” she says.

In contrast, Caramanica says modern agriculture in the area is dominated by large landholders or companies that repeatedly plant one crop and use fields year-round, not adapting as flexibly as smaller operations could.

“It's about the perception of the environment,” says Jason Nesbitt, an archaeologist at Tulane University, who was not involved in the study but wrote an accompanying commentary. Today many view El Niño events as extraordinary, he says, whereas the ancient residents of the Pampa de Mocan viewed them as an expected phenomenon—and that kind of mindset could help today's farmers deal with extreme weather. When officials draw up agricultural or disaster-management policies, he adds, “maybe it'd be good to have archaeologists and anthropologists at some levels of decision-making about these things.”