Measurements and implications of the relationship between lightning and terrestrial gamma ray flashes