Carbonate diagenesis:

Diagenesis includes anything that happens to sediment after deposition, up to the realm of metamorphism. With carbonates we see:

Compositional sequence: The lesson of all this is that we note that the polymorphs of CaCO3 have different susceptibilities to these processes. Specifically:

Diagenetic environments: Cementation is rapid in coastal environments:

One last enigma remains: Dolomite

A third common natural carbonate mineral exists: Dolomite: CaMg(CO3)2 and dolostone - a rock made of dolomite. Dolomite makes up 1/80 of Cenozoic carbonate deposits, 1/3 of Paleozoic, and 3/4 of Proterozoic. The problem: We don't really know how it forms.

In principle, we would expect two modes of dolomite formation:

The extreme rarity (absence?) of primary dolomite and the increasing abundance of dolomite in older rocks leads us to think that it is mostly (all?) secondary.

Primary dolomite deposition has only been observed with absolute certainty in the kidneys of a single dalmatian dog.

A modern dolomite environment: One modern environment where dolomite might be forming as a primary precipitate is the Coorong lakes, along the southern margin of Australia. The Coorong is an area of lagoons and alkaline lakes behind modern beach barriers, which are fed by seawater and groundwater. The temporary lakes are of high pH (8 to 10) and have Mg/Ca of up to 20. Dolomite forms in more landward lakes as minute spherical aggregates.

Prothero and Schwab note that this deposition probably represents rapid dolomitization of calcite, rather than primary dolomite. Maybe the distinction is academic. The Coorong lakes clearly demonstrate the central principle of dolomitization: To get dolomite, you must expose calcite or aragonite to water with: