Atmospheric stability code estimate
The script on this page is based on the steps found in this EPA document, section 6.4.1, which describes Turner's method of estimating atmospheric stability. For more on the subject, see Turner's book.
Fair warning: although somewhat knowledgeable about air dispersion modeling, I am not an expert. I have tested this script, but not thoroughly. It is possible that I have misunderstood the instructions in the above mentioned EPA document. In particular, I found table 6-6, step 3(C)(4) to be strange. And I also assumed that the wording of step 3(C)(6) means that the net radiation index is the modified insolation class number.
Furthermore, in table 6-4 there is a gap of .1 m/s for wind speed. I'm not sure if the author of the EPA document assumed rounding or that wind readings would only be to the tenth. Essentially, I truncated such that 1.89 m/s is the same as 1.8 m/s, for example.
Also, the stability categories in table 6-4 are numbered 1 - 7. I mapped them to the corresponding Pasquill stability classes A - F, F matching category 6 and 7. A is very unstable, D is neutral, and F is stable.
I strongly suggest anyone wishing to use this script investigate my assumptions and test the code.
To find the solar altitude for any location, try this calculator on the Navy's website: Sun or Moon Altitude Azimuth Table.
Check if night, to include one hour before sunset or one hour after sunrise: