# Sunlight Hours - Consecutive hourly threshold (rather than total)

Hi All,

I typically run sunlight hours assessments to determine if a required amount of outdoor amenity space receives a total of X hours of direct sunlight on a given date. However I’ve come across a new standard which is requiring this sunlight to be delivered in 4 consecutive hours, rather than in total across the day.

Has anyone tackled this previously and can offer suggestions how to derive the results using sunlight hours component?

It seems this question was asked some time back but never got a reply: Sunlight Analysis: Consecutive number of hours

Hi @jwoodall, have you seen this topic: Ladybug_Sunlight Hours Analysis period filter function wish and suggestion

Hi @mostapha, thanks for signposting to this thread - very interesting feedback.
Would you be able to share your script for the post-processing of results to customise the continuous sunlight results?

Oops. I shared the wrong one from my phone. See this one:

Thanks Mostapha - very interesting.
I am trying to adapt your proposed method to a 0.3m grid of points (32,460 total), but struggling to obtain a result on this basis by imposing the script to fit.

Would you be able to take a look and suggest a workflow please?Sunlight_Hours__GHSCRIPT_INT.gh (555.6 KB)

Hi @jwoodall
I’ve come across this metric as well, while working on a project in Kazakhstan.

I managed to use the Sun is Visible output and a bit of code from David Rutten from this post to count the consecutive sunlight hours along with Colibri from TT Toolbox to iterate through the days of the analysis period. I know this isn’t the most elegant solution but it worked for an analysis of about 100,000 points taking about 5-10min to simulate.

hope this helps

consecutive sunlight hours.gh (495.9 KB)

Hi @AKomar, thanks so much for sending this! After a bit of fiddling with script it seems to work perfectly!
One quick question - you divide the output from the DR code by 1.85. Can I ask why this done?

Thanks again!

Ah yes that was just to figure out what percent of the analysis period (185 days) the consecutive sunlight target was achieved. The output of the last mass addition gives the number of days the criteria is passed.

Hope that makes sense
Andrw