architecture-building-systems / CityEnergyAnalyst

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

NaN error in demand calculation #3368

Closed lilaleu closed 1 year ago

lilaleu commented 1 year ago

My subject is probably better up here in the issue-section:

Discussed in https://github.com/architecture-building-systems/CityEnergyAnalyst/discussions/3367

Originally posted by **lilaleu** August 27, 2023 Hey Everyone! When using the demand calculation tool for my district, I keep on getting this error: see below. Apparently there is a NaN in the building data where CEA expects a float to convert it to an integer. I would love to find the place or the reason why its like that to be able to change it. But I am struggling to read the error-message. Can somebody help and tell me whats wrong? Information: I have ran Solar Radiation, shedule maker and all modules necessary for that. Additionally I am working with modified datasets from GIS software, not the default OSM data. CEA version 3.32.0 Thanks in advance! Addition: I found a similar error in #3212 which was produced by a mismatch of the coordinate system of the zone and surrounding. I checked this and both CRS are WGS 84, so all fine. It must be something else. **Error Message:** __Building No. 187 completed out of 349: DENILD1513150232765_33292410 multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\User\miniconda3\envs\cea\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "C:\Users\User\miniconda3\envs\cea\lib\multiprocessing\pool.py", line 48, in mapstar return list(map(*args)) File "c:\users\User\documents\cityenergyanalyst\cea\utilities\parallel.py", line 131, in __apply_func_with_worker_stream result = func(*args) File "c:\users\User\documents\cityenergyanalyst\cea\demand\thermal_loads.py", line 142, in calc_thermal_loads tsd = hotwater_loads.calc_Qww_sys(bpr, tsd) # system (incl. losses) File "c:\users\User\documents\cityenergyanalyst\cea\demand\hotwater_loads.py", line 102, in calc_Qww_sys Qww_dis_ls_r_W = np.vectorize(calc_Qww_dis_ls_r)(T_int_C, tsd['Qww'].copy(), Lsww_dis, Lcww_dis, Y[1], Qww_nom_W, File "C:\Users\User\miniconda3\envs\cea\lib\site-packages\numpy\lib\function_base.py", line 2113, in __call__ return self._vectorize_call(func=func, args=vargs) File "C:\Users\User\miniconda3\envs\cea\lib\site-packages\numpy\lib\function_base.py", line 2200, in _vectorize_call res = array(outputs, copy=False, subok=True, dtype=otypes[0]) ValueError: cannot convert float NaN to integer """ The above exception was the direct cause of the following exception: 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: cannot convert float NaN to integer Building No. 188 completed out of 349: DENILD1513150232765_33292729__
ShiZhongming commented 1 year ago

@reyery Have you seen this error before?

lilaleu commented 1 year ago

Just checked: Same happens when using the default CEA workflow and the helper-functions.

ShiZhongming commented 1 year ago

@lilaleu did you usecea workflow --worflow?

lilaleu commented 1 year ago

@shizhongming no sorry for the confusion. I used the dashboard and executed all operations manually.

lilaleu commented 1 year ago

Update: I have now spent some time in finding the cause for the error. So I tried to simulate my szenario with the zone-helper and other default values that come with the CEA standard configuration. Only exception was the weather file (epw taken from PVGIS, attached as csv) from the location of my district. This caused the same error as described above.

So I switched to the standard Zuerich weather, that comes with the CEA installation. This one worked.

Transferring this to my original custom-data szenario brought up a new error: "ValueError: operands could not be broadcast together with shapes (8760,) (8765,) () " but I guess this is a new problem out of many. I'm happy if someone has some advice here... Anyway it seems to be caused by the weather file.

I would like to know what CEA expects from a weather file in order to work correctly. I never got it running with epw files from different sources. The only weather files that are working atm are those from CEA itself. tmy_52.250_10.543_2005_2020(1).csv

ShiZhongming commented 1 year ago

@lilaleu

CEA will need the epw weather file to work. Have you tried to find your city's weather file here? https://energyplus.net/weather

I have also used epw weather file for Canada found on their gov websites. All functioned well. Maybe you can find epw weather file from you city/country's gov data platform.

lilaleu commented 1 year ago

I have tried these before and remember I had trouble with these too... I could try those again for my case. BUT the weather file was epw before (Not allowed to upload on GitHUB, so i posted the csv version). So I don't see why it wouldn't work. Are there any more requirements for the epw file? @shizhongming do you have any idea in case anyone wants to use weather from different sources?

I am trying to use CEA as a demand calculation tool for initial DH planning. In my research I am trying to combine various geodata-sources in order to simplify the initial planning process and achieve more precise estimations than original "conservative" estimation methods with the same amount of time invest. My impression would be that this is what CEA is designed for (besides other applications). But I am experiencing many errors working with the custom made data which makes it to this point impossible to use CEA for my simulations. I would wish for a more detailed documentation about how to match the CEA formatting requirements with Applications like QGIS and ArcGIS. The existing documentation is rather general and focuses more on self drawn geometries than imported and manipulated geometries. I've seen that many have used a combination of QGIS and CEA. So it seems to be convenient once you know about the obstacles. Me using ArcGIS and processed building footprints from a LoD1-Model have a lot of problems implementing my data in CEA. Additionally more hints when errors occur would be very helpful. Please tell me, if you'd like me to contribute my mistakes I have made with data migration, in case you want the "HINT"-catalogue :)

ShiZhongming commented 1 year ago

@lilaleu Thank you for your feedback. What you have mentioned will be what we will focus on in the coming months of the year - CEA UX enhancement.

Personally, I always use ArcGIS and I don't encounter many errors. It could be that I am always working on CH or SG cases and I know where the "tricks" are without being aware of knowing them. We want to know your experiences in detail so we can improve the tool for more self-import scenarios.

To help us understand your situation and project, I suggest we have a 1:1 meeting. You can find a time here. ; D https://calendly.com/shi-zhongming/30min?month=2023-10

ShiZhongming commented 1 year ago

@lilaleu Also, I forgot to mention that in the upcoming release on 8 Sept. We have enhanced script handling the weather files. Maybe it will help on your case. You can access it now via PR#3364.

lilaleu commented 1 year ago

For the sake of completeness: I've performed the case with default CEA/OSM data for my district and the energypro-weather for cologne and it worked fine. Still, it would be interesting what's wrong with the PVGIS epw-file.

Anyway thank you for your help! I am looking forward to the new release and might take a look into PR.

@lilaleu

CEA will need the epw weather file to work. Have you tried to find your city's weather file here? https://energyplus.net/weather

I have also used epw weather file for Canada found on their gov websites. All functioned well. Maybe you can find epw weather file from you city/country's gov data platform.

lilaleu commented 1 year ago

Maybe of interest: Attached you'll find the problematic epw file, taken from PVGIS Bebelshof_tmy_52.244_10.542_2005_2020.zip