We present a theory for interpreting the sodium lines detected in transmission spectra of exoplanetary atmospheres . Previous analyses employed the isothermal approximation and dealt only with the transit radius . By recognising the absorption depth and the transit radius as being independent observables , we develop a theory for jointly interpreting both quantities , which allows us to infer the temperatures and number densities associated with the sodium lines . We are able to treat a non-isothermal situation with a constant temperature gradient . Our novel diagnostics take the form of simple-to-use algebraic formulae and require measurements of the transit radii ( and their corresponding absorption depths ) at line center and in the line wing for both sodium lines . We apply our diagnostics to the HARPS data of HD 189733b , confirm the upper atmospheric heating reported by ( 7 ) , derive a temperature gradient of 0.4376 \pm 0.0154 K km ^ { -1 } and find densities \sim 1 – 10 ^ { 4 } cm ^ { -3 } .