You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of project work with @charliebrookerBH , it was necessary to open up a very large (270MB) JSON file, containing LB objects and outputted by LB Tools. This JSON object contained a collection of objects, each corresponding to a point in a model. With each point, 8760 values were associated with it, each value corresponding to -1, 0, or 1 (meaning too cold, just right, too hot). The desired output was, for each point, to filter for a timerange (either 0800-1800 or 0900-2200) and then, within that timerange, get the percentage of time that point experienced too hot, too cold, or just right.
This was achieved with the attached .cs code using .NET 6. See attached zip file below for this code.
This code should be translated into .NET Framework 4.7.2, tidied, and incorporated into the BHoM. The final product should allow us to load in a LB-generated JSON file, and get a collection of 3 values for each point.
Note the following 'fix' that was required to prevent the deserialiser from crashing, which is believed to be due LB producing non-compliant JSON files:
The start of the JSON file will read something like [{"values": [0.0, 0.0, 0.0, 0.0, 0.0,. The JSON deserialiser likes to have a name for the collection - we fixed this by prefixing a name, i.e. {"hello" : [{"values": [0.0, 0.0, 0.0, 0.0, 0.0,
A final curly bracket was also needed at the end of the file. i.e. we changed "type": "HourlyContinuous"}] to "type": "HourlyContinuous"}]}
However, this may be a moot point, as a different JSON deserialiser will be required to be BHoM compliant to 4.7.2 anyway!
As part of project work with @charliebrookerBH , it was necessary to open up a very large (270MB) JSON file, containing LB objects and outputted by LB Tools. This JSON object contained a collection of objects, each corresponding to a point in a model. With each point, 8760 values were associated with it, each value corresponding to -1, 0, or 1 (meaning too cold, just right, too hot). The desired output was, for each point, to filter for a timerange (either 0800-1800 or 0900-2200) and then, within that timerange, get the percentage of time that point experienced too hot, too cold, or just right.
This was achieved with the attached .cs code using .NET 6. See attached zip file below for this code.
This code should be translated into .NET Framework 4.7.2, tidied, and incorporated into the BHoM. The final product should allow us to load in a LB-generated JSON file, and get a collection of 3 values for each point.
Note the following 'fix' that was required to prevent the deserialiser from crashing, which is believed to be due LB producing non-compliant JSON files:
[{"values": [0.0, 0.0, 0.0, 0.0, 0.0,
. The JSON deserialiser likes to have a name for the collection - we fixed this by prefixing a name, i.e.{"hello" : [{"values": [0.0, 0.0, 0.0, 0.0, 0.0,
"type": "HourlyContinuous"}]
to"type": "HourlyContinuous"}]}
However, this may be a moot point, as a different JSON deserialiser will be required to be BHoM compliant to 4.7.2 anyway!
JsonStructure2.zip
R&D Wishlist item 00375.
The text was updated successfully, but these errors were encountered: