architecture-building-systems / CityEnergyAnalyst

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

error runing the demand "TypeError: can only concatenate str (not "float") to str" #3643

Closed Dashboard-IN3 closed 1 month ago

Dashboard-IN3 commented 2 months ago

Hi, When I run the Demand script - both in the dashboard as in the console - I get the error:

Building No. 141 completed out of 149: df7f7943-69b0-11ec-92a1-eb49ce5d42be
Building No. 142 completed out of 149: df940b35-69b0-11ec-9329-832399ba795c
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\ops\array_ops.py", line 171, in _na_arithmetic_op
    result = func(left, right)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\computation\expressions.py", line 239, in evaluate
    return _evaluate(op, op_str, a, b)  # type: ignore[misc]
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\computation\expressions.py", line 70, in _evaluate_standard
    return op(a, b)
TypeError: can only concatenate str (not "float") to str

If I run with just a few buildings there is no problem but I cannot identify the problematic one... here are the input files if you wish to reproduce https://www.dropbox.com/scl/fo/q28jffl9wrh6miy8wfo4v/ABDBQtaRd39wWw8afRgVOO4?rlkey=j9ktiiipfl4xpxuz7xqvbrv2p&dl=0

thank you!

reyery commented 1 month ago

Hi @Dashboard-IN3, thanks for reporting this issue. I have looked into it and found that in the typology file, buildings dd567382-69b0-11ec-b913-1faa1099ad15 and de1523a0-69b0-11ec-bc89-db5d5f804d85 do not have any use type ratios. This caused their schedules to be NaN resulting in the error found above. Filling the appropriate values for these buildings should fix the issue. On our end, we are in the process of improving file validation for input files to prevent such bugs from happening again. Hopefully this helps.

reyery commented 1 month ago

Closing this issue for now. Kindly reopen if this is still an issue for you.

Dashboard-IN3 commented 1 month ago

Hi again, thank you a lot for your help. I had that error and corrected but a similar error remains. is there any way to better find what is the error?

the inputs folder is here: https://www.dropbox.com/scl/fo/wf1du8hk36kn7th4p3t6q/ALFPPJPBgD-pWmCzoo43Bns?rlkey=nu11dge25vpfvv75yays8qzfh&dl=0

Traceback (most recent call last): File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\ops\array_ops.py", line 171, in _na_arithmetic_op result = func(left, right) File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\computation\expressions.py", line 239, in evaluate return _evaluate(op, op_str, a, b) # type: ignore[misc] File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\computation\expressions.py", line 70, in _evaluate_standard return op(a, b) TypeError: can only concatenate str (not "float") to str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\multiprocessing\pool.py", line 48, in mapstar
    return list(map(*args))
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\utilities\parallel.py", line 131, in __apply_func_with_worker_stream
    result = func(*args)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\demand\thermal_loads.py", line 78, in calc_thermal_loads
    tsd = electrical_loads.calc_Eal_Epro(tsd, schedules)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\demand\electrical_loads.py", line 54, in calc_Eal_Epro
    tsd['Eal'] = schedules['El_W'] + schedules['Ea_W']
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\ops\common.py", line 81, in new_method
    return method(self, other)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\arraylike.py", line 186, in __add__
    return self._arith_method(other, operator.add)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\series.py", line 6112, in _arith_method
    return base.IndexOpsMixin._arith_method(self, other, op)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\base.py", line 1348, in _arith_method
    result = ops.arithmetic_op(lvalues, rvalues, op)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\ops\array_ops.py", line 232, in arithmetic_op
    res_values = _na_arithmetic_op(left, right, op)  # type: ignore[arg-type]
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\ops\array_ops.py", line 178, in _na_arithmetic_op
    result = _masked_arith_op(left, right, op)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\pandas\core\ops\array_ops.py", line 116, in _masked_arith_op
    result[mask] = op(xrav[mask], yrav[mask])
TypeError: can only concatenate str (not "float") to str
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\worker.py", line 146, in worker
    run_job(config, job, server)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\worker.py", line 108, in run_job
    script(config=config, **parameters)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 60, in __call__
    self._runner.__call__(*args, **kwargs)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 38, in script_runner
    script_module.main(config)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\demand\demand_main.py", line 145, in main
    demand_calculation(locator=locator, config=config)
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\demand\demand_main.py", line 106, in demand_calculation
    calc_thermal_loads(
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\site-packages\cea\utilities\parallel.py", line 96, in wrapper
    result = map_result.get()
  File "C:\Users\Ricardo\dependencies\micromamba\envs\cea\lib\multiprocessing\pool.py", line 771, in get
    raise self._value
TypeError: can only concatenate str (not "float") to str
Dashboard-IN3 commented 1 month ago

I cant reopen the issue

Dashboard-IN3 commented 3 weeks ago

now it is running... sorry