architecture-building-systems / CityEnergyAnalyst

The City Energy Analyst (CEA)
https://www.cityenergyanalyst.com/
MIT License
194 stars 61 forks source link

Demand calculation: Error "alueError: operands could not be broadcast together with shapes (8760,) (8765,) () " #3373

Closed lilaleu closed 12 months ago

lilaleu commented 1 year ago

Describe the bug When executing my building energy demand (monthly, all outputs selected, all buildings selected, no overheating warning) it happens that I am getting the following error:

_Traceback (most recent call last): File "c:\users\user\documents\cityenergyanalyst\cea\worker.py", line 146, in worker run_job(config, job, server) File "c:\users\user\documents\cityenergyanalyst\cea\worker.py", line 108, in run_job script(config=config, *parameters) File "c:\users\user\documents\cityenergyanalyst\cea\api.py", line 60, in call self._runner.call(args, **kwargs) File "c:\users\user\documents\cityenergyanalyst\cea\api.py", line 38, in script_runner script_module.main(config) File "c:\users\user\documents\cityenergyanalyst\cea\demand\demand_main.py", line 145, in main demand_calculation(locator=locator, config=config) File "c:\users\user\documents\cityenergyanalyst\cea\demand\demand_main.py", line 106, in demand_calculation calc_thermal_loads( File "c:\users\user\documents\cityenergyanalyst\cea\utilities\parallel.py", line 96, in wrapper result = map_result.get() File "C:\Users\user\miniconda3\envs\cea\lib\multiprocessing\pool.py", line 771, in get raise self.value ValueError: operands could not be broadcast together with shapes (8760,) (8765,) ()

I am working with prepared datasets from ArcGIS that were prepared to be directly readable in CEA (zone and typology). I performed all helper modules with weather from energyplus. CEA version 3.32.0

Under #570 I find the same error from long ago. Here the problem was, that the file was interrupted by writing the results leading to to few entries in the result file. In my case I have 5 entries too many (8760 expected, but 8765 present). Can somebody tell me whats wrong, or what file to look at to find the error?

To Reproduce Steps to reproduce the behavior:

  1. Load in my customized data
  2. Run all necessary helper-modules
  3. Solar Radiation calculation (roof-grid 50 instead of 10)
  4. Run demand calculation (monthly, overheating warning off, rest default)
  5. Get the error 6 buildings before calculation is finished

Expected behaviour Demand calculation should run to end and deliver total demand file.

Hardware (please complete the following information):

lilaleu commented 1 year ago

@shizhongming have you seen that error before?

ShiZhongming commented 1 year ago

@lilaleu Please send the weather file causing this error. Compress your .epw file to .zip. and you can send via GitHub.

lilaleu commented 1 year ago

I think I have just solved the problem: The error kept on occuring at the very end of my demand calculation (often at 6th last building). I tried to run the calculation on another computer. Therefore I copied all input- and output data except from demand files and ran the simulation on another computer. Same error again.

Asking a colleague to help me, she ran the simulations with the same original inputs (zone, typology and weather) from scrap (street-,sourrounding-,terrain-helper, archetypes mapper, Solar radiation, shedule maker,) and finally demand calculation. She could not reproduce the error, leaving me clueless. Then I tried the same: Simulation from scratch with my second computer using the CEA workflow functionalities and a modified yaml from the example workflows. This time the demand calculation ran through without any errors.

@shizhongming you probably refer to #3368 where the problem was a faulty weather file, causing errors in demand calculation. Eventhough this issue is already closed I will upload the problematic epw file there in case this might become of interest at a certain point.

For this case I suspect a whitespace in my windows user-name as the problem. I might seem like a bloody beginner with python stuff, which I am. Anyway I guess this could be a very "promising" reason for this problem. It wouldn't be my first time having trouble with Python based code because of this issue.

ShiZhongming commented 1 year ago

Happy it worked! Thanks for detailing the processes. We will still take a look at your weather file provided at #3368.

martin-mosteiro commented 1 year ago

For the sake of completion, note that I have tested @lilaleu's weather file and it is read correctly by cea.utilities.epwreader.epw_reader (8760 rows). There does seem to be an extra column (index) but that shouldn't be a problem as CEA will in any case only use the columns it needs. So that was indeed not the issue (as demonstrated by the fact that the issue couldn't be replicated by @lilaleu's colleague).

In any case, it seems like the issue is resolved... for now?