Problem in defining the context_geometry in RadiationStudy

Hi,

I am trying to write a code in python using the RadiationStudy of ladybug_radiance package. There is a need to define context_geometry which is “A list of ladybug geometry Face3D and/or Mesh3D that can block the view to the sky and ground”

My first question is that why this context_geometry in mandatory here, while we can run a radiation study without any context in the grasshopper environment.

Secondly, I was wondering about this error “AttributeError: ‘RadiationStudy’ object attribute ‘context_geometry’ is read-only” that I receive, no matter what I put on behalf of context_geometry in RadiationStudy class. I have tried putting a 3D mesh/face defined by ladybug_geometry.geometry3d.mesh/face. I have also tried importing a geometry from Inputs class in pollination_dsl.function.

Has anybody tried this radiation study so far? My main goal is to calculate the kWh/m2 radiation on different surfaces using my codes in Python.

Hi @sufia89 ,

Glad to see you working with the source code. The reason why the ladybug-radiance RadiationStudy class requires context_geometry here:

… is that this context_geometry means something different than what the context_ input means on the LB Incident Radiation component. If you look here in the source code of that component, you’ll see that the “real” context_geometry under the hood of the component includes both the _geometry input as well as the context_:

This is because the LB Incident Radiation component counts the input _geometry as something that always blocks the sun. When you are working on the SDK layer like you are now, you have the freedom to say what exactly does and does not block the sun by putting whatever you want in for context_geometry.

Long story short, if you’re just trying to replicate the behavior of the Incident Radiation component using ladybug-radiance, plug then just input the exact same thing in for study_mesh and context_geometry.

The answer to this:

… is that context_geometry is not a set-able property. You can only define it when you initialize the class. After that, the context_geometry is fixed for the lifetime of that class instance and you’ll have to make a new class instance if you want to run a study with different context_geometry.

1 Like