Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:31:32

And when waves come over them like canopies, they supplicate Allah, sincere to Him in religion. But when He delivers them to the land, there are ˹some˺ of them who are moderate ˹in faith˺. And none rejects Our signs except everyone treacherous and ungrateful.  

And if waves cover them, that is, ˹if˺ these rise above the disbelievers, like awnings, like mountains that act as awnings over those below them, they call on God, sincere before Him in their faith, that is, ˹in their˺ supplication, that He may deliver them, in other words, they do not call on any other ˹god˺ with Him; but when He delivers them to land, some of them compromise, middling between belief and disbelief, while others persist in their disbelief. And none denies Our signs, an example of which is Our delivering ˹them˺ from ˹such treacherous˺ waves, except every perfidious ingrate, ˹ungrateful˺ for God’s graces, exalted be He.
القرآن:٣١:٣٢

وَإِذَا غَشِيَهُمْ مَوْجٌ كَالظُّلَلِ دَعَوُا اللَّهَ مُخْلِصِينَ لَهُ الدِّينَ فَلَمَّا نَجَّاهُمْ إِلَى الْبَرِّ فَمِنْهُمْ مُقْتَصِدٌ ۚ وَمَا يَجْحَدُ بِآيَاتِنَا إِلَّا كُلُّ خَتَّارٍ كَفُورٍ  

{وإذا غشيهم} أي علا الكفار {موجٌ كالظلل} كالجبال التي تُظل من تحتها {دعوا الله مخلصين له الدين} أي الدعاء بأن ينجيهم أي لا يدعون معه غيره {فلما نجاهم إلى البر فمنهم مقتصد} متوسط بين الكفر والإيمان، ومنهم باق على كفره {وما يجحد بآياتنا} ومنها الإنجاء من الموج {إلا كل ختارٍ} غدار {كفورٍ} لنعم الله تعالى.