Preparing DaylightFactor recipe to_json() for docker

hi @AntoineDao,

Looking forward to deploy docker on the cloud https://github.com/ladybug-tools/honeybee-server-daylight, I’m preparing my cases and building the json recipe.
I’m not so fluent on python and have been stuck for a while on handling dictionaries. The HBObjects python component is returning a tree instead of lists of lists.

Any tip on this one would be cool.

Cheers
Olivier

@OlivierDambron, Is there a reason that you don’t use the to_json method of daylight factor recipe? Assuming you call objects input as hb_objects and make it list access and flatten the data this code should work.

analysisRecipe.hb_objects = hb_objects
a = analysisRecipe.to_json()

Hi @OlivierDambron! I’ll post an example script taking different recipes and prepping them to be sent to a server (local or on the cloud) from a single grasshopper node. I’ll post it on this thread tomorrow.

@mostapha, which is the best place for me to dump such an example? Is it one for Hydra? Also, how do I go about adding nodes to the honeybee[+] grasshopper rep on GitHub?

1 Like

@mostapha

probably I’m missing something trivial but :
analysisRecipe = honeybee.radiance.recipe.daylightfactor
analysisRecipe.to_json()

gives me the following:
‘module’ object has no attribute ‘to_json’

Cheers @AntoineDao !

Could you let me know your best practice to upload the payload and distribute to multiple workers?

You probably need to update your Honeybee[+] installation. It’s already implemented:

I would say since it’s still under development sharing it here is the best approach for now. We want to have it on Hydra once more people can use it.

Send a PR to this repository. You can use export ladybug component to create the userobject and export the source code as far as you follow the rules. You can use any of the current components as the starting point. Here is an example:

@mostapha,
I did so and yet.

You should import the recipe and initiate the class first. In your script you’re calling the module. A good starting point would be using the Daylight Factor recipe component.

from honeybee.radiance.recipe.daylightfactor.gridbased import GridBased
analysisRecipe = GridBased(_analysisGrids, _radiancePar_)
analysisRecipe.hb_objects = hb_objects
a = analysisRecipe.to_json()
1 Like

ahh many thanks.

:sunny: