How to load the results from a file into Grasshopper using Honeybee[+] API?

solar-access

#1

Hi @mostapha,

Is there a way to reload results for the ‘Solar Access’ recipe as well, as the component doesn’t have the option to reuse the matrices?
I have the resulting .ill files from a simulation I ran on another (Linux) machine, and I was now hoping to load the results back in grasshopper but couldn’t figure out how to do it properly…

Any hints would be appreciated (and apologies if I am missing something obvious)


Question on annual simulation parameter settings
Reloading results
#2

Hi @MohammadHamza,

You need both *.pts file and *.ill file.

from honeybee.radiance.analysisgrid import AnalysisGrid

pts_file = r'path_to_points_file.pts'
ill_file = r'path_to_ill_file.ill'
hoys = []  # list of hours of the year. You can get this from sun_path or recipe.

# first let's create an analysis grid from pts file
ag = AnalysisGrid.from_file(pts_file)

# now let's load the results
# mode is set to 1 to convert the results to 0-1
ag.set_values_from_file(ill_file, hoys, mode=1)

# output this ag and you can use the standard honeybee[+] components to get the values.

You can see recipe classes as a reference:


#3

Thanks for your swift reply Mostapha!

I gave it a try (with my very limited Python skills) but I am not sure if I got it right. I get the following Assertion error

What should I change to fix this?


#4

You should remove hoy = [] line from the script. That was a place holder for your input.


#5

Aha! Perfect! Now it works. Many thanks Mostapha.

For anyone else in need of the same, here’s the tiny component. I added some description to the component inputs too.

HBPlus_reloadAnalysisGrid.gh (4.4 KB)

Btw, Mostapha, I didn’t get mode = 2 in set_values_from_file

  • mode – 0 > load the values 1 > load values as binary. Any non-zero value will be 1. This is useful for studies such as sunlight hours. 2 > load the values divided by mode number. Use this mode for daylight factor or radiation analysis.

Why would we want to divide the values by the mode number i.e. division by 2?


#6

In mode 2 results will be divided by mode value which can be 2 or any other value larger than 2.

Imagine the case for daylight factor that we run an illuminance study under an overcast sky with total horizontal illuminance of 10000 lux. Now to get daylight factor we should divide the values by 100 ( 10000 / 100). In that case we can use mode = 100 to get the correct values.

Here is how it is used for daylight factor recipe:


#7

I see. Got it. Thanks!

Maybe it would help to change the description in the API documentation, as at least to me, it was not clear that I can set the mode to 100, or 1000 or to any other arbitrary number I like… I thought it maxed out at ‘2’


#8

Agreed! Why don’t you go ahead and get it fixed? :smiley:


#9

Sure! How do I do that? :sweat_smile:


#10

Edit the source code and send a pull request on GitHub. @PeterZatko has done one for the Grasshopper plugin recently so he know how.


#11

Cool! I’ll ask him about it on Monday then.


#12

Hi @MohammadHamza, @mostapha,

Thanks for sharing the reload component, I can see how useful it would be for me too.

Unfortunately I get the following errors when I try to use it, to reload a DC analysis:

Any idea why this is happening ?

I have plugged the same list of hoys as in the original run.
Is this component meant to work only for subhourly sunlight hours analyses ? The moy value seems to be involved in the issue here…

Many thanks for your help.

Jocelyn


#13

Hi Jocelyn,

Could you please share your *.ill file and *.pts file that you are trying to load? Also, please attach the hoys list (maybe as a normal text file or grasshopper file, whatever works for you) that you are using? It would allow me to take a closer look.

Best,
Hamza


#14

Hi Hamza,

see in the link below.
What I would like to be able to do is load much heavier files (after processing them externally to recompose blind combs outside of GH) but let’s start with this lighter one (still 1700 points).

Many thanks,

Jocelyn


#15

hi @JocelynUrvoy,

A quick alternative but hacky way would be to open a same grasshopper definition that wrote the file you processed externally and run the simulation in GH (also make sure that the reuse mtx is turned to true). As the black window appears let it run until the oconv or rcontrib functions appear (10 sec) and CTRL+C to close. This will write empty result files in the result folder inside your ladybug folder.

Collect the scene.ill or any other relevant result you processed externally and overwrite the files there. While the toggles in GH were left to true, you just need to induce a small change upstream in the definition for it to refresh (what I was doing was to change plug or unplug a panel in the radparameters (adding “-ab 5” for example), this will not make any change to the simulation.

Wait for the reload of the results and there should show up.

Good luck


#16

Thanks for sharing your files @JocelynUrvoy .

I am also getting the same error, and honestly, I am puzzled myself. Out of curiosity, where did you generate the list for the hoys ? I am assuming this is the same list you supplied to the SkyMatrix component earlier to run the simulation as well?

In the meantime, you can follow the excellent the suggestion from @OlivierDambron. Just make sure you set the ‘reuse Dmtx’ input to true. However, I believe you don’t need to manually close any terminal windows that pop up. Just run the simulation again and let it do it’s thing, and hopefully it should present you the results without any hassle.

Sorry coudln’t help you out on this one. I will let you know if I figure a way out…


#17

The problem was because of _hoys you provided is a list of string values, causing the set_values_from_file() not parsing the hour correctly. The fix is quite simple, input them as numerical values.

@MohammadHamza maybe you should write a check + warning message for this in your component.

image


#18

Hi @vhoang,

Thanks for the solution, indeed that was the issue and the files now load nicely and quickly !
I should have thought about the data format !

thanks @OlivierDambron for the tip as well - I have tried to reload the results using ReuseDmtx before but the calculation time for the first step of calculating the daylight matrices was still taking some useless time. Your trick would work to avoid that I guess.

For the record, I am now able to load a 1.7Gb .ill file (about 27k points for 2800 hours) in 4.4min, which is acceptable.
Next step for me is to figure out how to lighten the .ill files (write an integer lux value rather than the full scientific float ?), or do the addition of several window groups contributions externally.

Cheers


#19

@JocelynUrvoy

Using the component of @MohammadHamza on reloading a large file with 11k points for 8760 hours, all my ram got taken and it takes a long time. Did you find an effective way to split the results in post-processing?

perhaps a sub-annual simulation leaving out the night hours where 0 takes considerable space in the .ill files.


#20

@OlivierDambron

Yes I always remove the night hours by testing if the global horizontal illum is > 100 lux.
When combined to an occupancy schedule 8am-6pm, that leaves me with only 2800 hours which is slightly better.

Then I am lucky enough to have a decent of RAM on my work machine (64gb) but 2800 hours x 27k points = 1.7Gb still takes 4min to load and makes the rhino session to use 20gb of RAM.

Bit of script attached.
ALJ_daytime_discourse.gh (486.9 KB)

It is my understanding that DA should only account for hours that are both occupied AND daylit … ie the dark hour between 8am-9am in winter doesn’t burden your results.
But I’d be glad to hear I am not the only one interpreting it as such :smiley: