There are numerous calculators online which estimate climbing speed based on power and grade or similar. For example:
But real-world climbs are rarely precisely the same grade throughout. For example, Hawk Hill (a popular climb in the San Francisco area) averages 6% grade, but has sections as steep as 11% and even a slightly downhill section.
Of course, aerodynamics, rolling resistance, and drivechain losses will complicate the picture, but let's limit the issue to climbs which remain slow, steep, and sustained enough that still overcoming gravity is by a wide margin the most significant force for the rider to overcome, and thus aerodynamic drag and rolling resistance don't vary significantly over the climb.
In such circumstances, is average grade sufficient to relate power and climbing times, as exemplified in the calculators above? Or does the variability in grade introduce significant error? How significant? Please show with math, if possible.