what geological conditions and processes are necessary for the formation of both crude oil and natural ga

what geological conditions and processes are necessary for the formation of both crude oil and natural ga