Jonah gives us a striking example of thanksgiving and praise in time of great distress.
He ran from God's commandment to prophesy to Nineveh, and took flight on the sea. God stirred up a great tempest against the boat, and the sailors were finally forced to throw Jonah overboard due to God's wrath against him for his disobedience.
God prepared a great fish to swallow Jonah, saving him from certain death by drowning.
While in the belly of that fish, Jonah gave strong thanksgiving to God, even though he was not yet fully rescued. Jonah didn't wait until he was safely on dry ground, but recognized that God had rescued him from drowning, and ought to be praised and thanked!
Jonah recounted that he had cried unto the Lord for salvation, while he was sinking to the depths of the sea, and God had heard his prayer and rescued him by the fish.
Then Jonah makes it clear, that it was God Who had cast him into the deep! Surely God used the sailors, and surely Jonah was to blame for his own rebellion, and yet God was the ultimate cause of Jonah's troubles.
Jonah next tells the Lord, that he at first thought he was cast out of God's sight in the ocean. This is bitterly ironic, since Jonah had purposefully fled to escape the presence of the Lord in the first place!
Jonah now recognizes that in no place and at no time was he ever out of the sight of God! What had once seemed a foolish, rebellious desire of Jonah's, suddenly became his worst terror, and then when God saved him by the fish, Jonah praised God for the fact that God always could see and hear him!
Jonah describes in his prayer to God the utter horror of the prospect of drowning in the deep sea . . . .