How can I treat you like Sodom? What is a word or a few words that came to mind to you as I read—either triggered by these passages themselves or something else that my question evokes? And certainly the Old Testament does give us pictures of that kind of God; even the book of Leviticus itself does.
You could carry the whole thing around on a couple of ten-inch floppies.
Earlier, God had been traumatized and grief-stricken by human violence and self-worship, traumatized and grief-stricken to the extent that God would lash out and destroy with the Flood that left only a remnant to carry on.