Porosity is the value used to describe how much empty, or void, space is present in a given sample. This is measured in regards to soil, since appropriate porosity levels are necessary for plant growth. Porosity can be calculated theoretically using equations and given values (by volumes or by density). Porosity can also be determined by finding the values needed to solve the equations either in Lab or Field. Now a days many software are used to calculate porosity. The most common are RESPAD, NAPL calculator Note, Groundwater software.com etc. For more details you may consult the book : Craig, R. F. (1997). Soil Mechanics, sixth edition, Published by Chapman&Hall, USA.