I need to go out and buy a hat so I can tip it to farmers.

This year had all the makings of being terrible for agriculture, at least here in the Midwest. The spring was cold, weirdly cold — too cold to plant crops. And then it got rainy, weirdly rainy. Too rainy for planting.

And then came the floods. They came and they stayed and they stayed and they didn’t leave for more than three months. You can just imagine the frustration and despair felt by farmers whose crops are underwater for months at a time.

And yet.

Although the harvest has largely been delayed across the board, the crop yield has not been hit as hard as experts had feared. That’s good news for farmers and better news for us consumers.

The best news of all is in the tasting. This year’s corn has been consistently superb. The tomatoes have been excellent. Dinner is tasting better than ever.

I am writing this column last week, and as of that time I don’t think the regional corn crop had yet begun to come in. So perhaps it is still to be determined how the year’s agriculture-punishing weather has affected produce in the area.

But last night (as I write this), I had a couple of the best ears of corn I’ve had in a long time — and it’s been like that all season (except for one batch that had clearly been harvested too early). Last night’s splendors apparently came from Colorado, and I don’t know if the weather affected them as much as it did us here.

Whatever the Colorado farmers did to overcome this year’s weather, it has resulted in exceptional produce. Let’s hope the same results can be had here, too.

But what about dairy and meat farmers? Their livelihood isn’t as dependent on good weather.

Nevertheless, last night I splurged and grilled a steak. I eat steak rarely, because I am not in a highly remunerative profession, and when I do I typically get a lesser grade of meat. But yesterday I decided to end a much-needed vacation in style, so I spent the money for prime meat.

True, it was just sirloin, just about the cheapest cut of steak you can get. But it was prime sirloin, and it was magnificent.

I don’t know how much the farmer had to do with the meat’s taste. Maybe he fed the cow nothing but grass; maybe he served it a steady diet of oysters and foie gras. Maybe he just got lucky and through no effort of his own the cow (or at least the sirloin) was sufficiently marbled to qualify as part of the 2% of all beef that is rated prime.

Farming is hard. Farmers work from dawn to dusk, six or seven days a week. As we have seen, the amount of food they produce depends largely on factors they cannot control, such as weather. They are in a constant battle against nature — insects, birds, weeds, blight — that can eat into their meager profits. The equipment they use is expensive and requires constant maintenance. Debt is nearly inevitable.

Every year, there are fewer of them growing more food to feed more people (or to feed more animals to feed more people).

And they go through all of this just so we can eat an amazing meal of grilled steak with corn on the cob and a salad with sliced tomatoes.

Tip your hat to ‘em. If you don’t have a hat, buy one.

— Daniel Neman is a food writer for the St. Louis Post-Dispatch.