President Donald Trump paints a dire picture of life for U.S. farmers, citing in part unfair trade relations with other countries.

In fact, the picture is more complex. While the agricultural sector is affected by global trade, other factors play a larger role, including low commodity prices, record crop production and changing weather. Following is a closer look at Mr. Trump's claim that farmers are on "downward trend" because of bad trade deals.

Farmers have been on a downward trend for 15 years. The price of soybeans has fallen 50% since 5 years before the Election. A big reason is bad (terrible) Trade Deals with other countries. They put on massive Tariffs and Barriers. Canada charges 275% on Dairy. Farmers will WIN! — Donald J. Trump (@realDonaldTrump) July 20, 2018

Farmers have seen growing exports -- especially to China

U.S. farm exports have actually been on the rise, and the agriculture industry has a track record of surpluses.

American farmers export more than 20 percent of what they produce, according to the USDA. Domestic farm and food exports rose 8 percent to $140.5 billion last year, the third-highest level on record.

Get Breaking News Delivered to Your Inbox

Indeed, U.S. agriculture is one of the few industries to have a trade surplus. That should be a positive for Mr. Trump, who has railed about America's deficits with China and other countries. It also makes agriculture a target for retaliatory tariffs. To that end, China this month moved to impose a 25 percent tariff on soybeans and sorghum.

Most economists disagree with Mr. Trump's assertion that trade deficits are bad.

Soybean prices have dropped, but not because of trade deals

Mr. Trump is right in saying that soybean prices are falling. But that has far less to do with the terms of trade with China than with a global oversupply of soybeans.

Soybean prices fell to about $9.39 a bushel in 2017, from about $14 in 2012 and 2013. That's because farmers are flooding the market with soybeans.

"We've had good harvests, we've had good weather, we've had ample production -- demand hasn't changed that much," said Wally Tyner, a professor of agricultural economics at Purdue University. "And when supply is greater than demand what happens? Price falls."

A record 89.5 million acres of soybeans were harvested in 2017, about 13.3 million acres more than in 2013. Prices generally fall as supply rises.

"So this decline in prices was not tariffs from the rest of the world. It has to do with agricultural supply and demand forces," Tyner said.

Farm income has been holding steady

Although farm income has fallen since 2013, that decline is from a period of relative bounty for farmers over the past several decades. That has helped growers manage the drop in income.

The years 2012 to 2014 was "kind of a golden age of agriculture, the best period of time for agriculture, and it wasn't just soybeans. Other prices have fallen since that time," said Mary Marchant, a professor at Virginia Tech's department of agriculture and applied economics. "And it really wasn't because of a change in trade in tariffs."

Median farm household income this year is forecast at $78,886, about even with 2017. But it's up about 3.5 percent from 2016, according to a February report from the Congressional Research Service, another data point suggesting that farmers are coping with the drop in crop prices.

Trump is partially right on dairy

Mr. Trump also tweeted that Canada charges 275 percent on dairy. That's about right for certain products - but it's an exception, and is under certain conditions.

Canada runs a supply management program that effectively shields its farmers from competition. The country allows a small amount of dairy and poultry imports duty-free or at very low tariffs. Anything above the cutoff gets gobsmacked, such as 245 per cent tariffs on some cheese. And 298 percent on butters.

But that has been the exception — not the rule — when it comes to trade with Canada under the North American Free Trade Agreement, according to Factcheck.org.

More broadly, Canadian trade policies have had only a "tiny impact" on America's struggling dairy farmers, Daniel Sumner, an agricultural economist at the University of California, told The Associated Press.

Even with the disputes, the U.S. last year ran a $474 million trade surplus in dairy with Canada. It exported $636 million in dairy products to Canada and imported $162 million, according to the USDA.

-- The Associated Press contributed to this report