architecture-building-systems / CityEnergyAnalyst

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

Figure out why the radiation-daysim tool hangs on Sabine's scenario #1625

Closed daren-thomas closed 5 years ago

daren-thomas commented 6 years ago

Sabine Python's semester project involves a rather big scenario that seems to hang with the radiation-daysim tool. Why? I don't know.

The scenario can be obtained from Martin, Danielle, Sabine or Daren.

daren-thomas commented 6 years ago

First thing I noticed: Creating the topography geometry takes forever.

daren-thomas commented 6 years ago

First fix: using ArcScene -> Data Management Tools -> Raster -> Raster Processing -> Resample, I resampled the terrain.tif to 20m x 20m granularity and exported the raster dataset back to TIFF format. Reading in the topography is now faster.

daren-thomas commented 6 years ago

Next problem: The geometry in zone.shp (and probably also in district.shp has Z coordinates. This breaks the geometry_generator.py script.

daren-thomas commented 6 years ago

Fixed in branch 1625-figure-out-why-the-radiation-daysim-tool-hangs-on-sabines-scenario: POLYGON Z shapefiles can now be used (the Z component is ignored)

daren-thomas commented 6 years ago

Next problem: zone.shp and terrain.tif do not intersect. The coordinate systems are different, but I believe that the routines we use should be able to abstract that away. Showing both layers in ArcGIS Desktop is impossible, it seems they're too far appart or something.

martin-mosteiro commented 6 years ago

Next problem: zone.shp and terrain.tif do not intersect. The coordinate systems are different, but I believe that the routines we use should be able to abstract that away. Showing both layers in ArcGIS Desktop is impossible, it seems they're too far appart or something.

@daren-thomas I encountered this issue too... but weirdly it's solved if you add layers in a certain order: if you add the terrain first, then the building, they appear to be on the same location. If you add the buildings first, the coordinate system seems to be interpreted differently and the buildings and topography can't be shown together.

daren-thomas commented 6 years ago

ugh!

daren-thomas commented 6 years ago

You're right! But check this out:

image

It seems even if it worked, there are still some buildings that are "outside" of the considered terrain...

I just checked to make sure the building our intersection is failing on is not one of those (it isn't):

image

Also, that's the very first building it tries... So... something is up with the coordinate system thing...

martin-mosteiro commented 6 years ago

@daren-thomas you might wanna check the terrain file I sent Sabine in reply to her email today. Seemed to work better and there were no buildings outside the terrain.

Am 20.09.2018 um 16:47 schrieb Daren Thomas notifications@github.com<mailto:notifications@github.com>:

You're right! But check this out:

[image]https://user-images.githubusercontent.com/2969564/45826274-7d98ad00-bcf4-11e8-9e3c-f3f9010390a5.png

It seems even if it worked, there are still some buildings that are "outside" of the considered terrain...

I just checked to make sure the building our intersection is failing on is not one of those (it isn't):

[image]https://user-images.githubusercontent.com/2969564/45826427-c486a280-bcf4-11e8-99b2-79652aff92d4.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/architecture-building-systems/CityEnergyAnalyst/issues/1625#issuecomment-423211353, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARsFYb1PfBSuQDhoqjHBDjnSOTSrvXoPks5uc6p9gaJpZM4WyBwE.

daren-thomas commented 6 years ago

Next thing I tried was importing the Coordinate system from zone.shp using this guide: http://desktop.arcgis.com/en/arcmap/10.3/manage-data/raster-and-images/defining-or-modifying-a-raster-coordinate-system.htm

Still the same error. Somehow the centroid points of the building footprints don't intersect with the geometry of the terrain...

martin-mosteiro commented 6 years ago

Yep, same issue here. As I mentioned above, things didn't look the same on ArcGIS when I imported the shapefile first than when I opened the terrain. The reason is that ArcGIS was setting a different coordinate system for the scene in each case. So I changed the coordinate system in zone.shp and arrived at the same result you did...

daren-thomas commented 6 years ago

@martin-mosteiro was just trying to use the reduced.rad scenario you sent me and the following problem occurrs when trying to do the base heights thing in ArcScene:

image

martin-mosteiro commented 6 years ago

@daren-thomas Strange. Works perfectly for me... screen shot 2018-09-21 at 15 02 44 ...iff I add the terrain first and then the zone. Otherwise I still get no error message but the zone seems to disappear from the scene.

DanielleGriego commented 6 years ago

Ok, thanks guys. I just talked to Sabine and we’ll correspond here and update the files from the Polybox folder you sent Martin:

Here’s the case study after I removed the Z coordinate in the shapefile and replaced the terrain (I suppose this is the same case study you were testing): https://polybox.ethz.ch/index.php/apps/files/?dir=/2018.09.21.15.01_flattened_geometry&fileid=1099896304 Here’s the case study with Danielle’s new shapefile: https://polybox.ethz.ch/index.php/apps/files/?dir=/2018.09.21.15.01_Danielles_geometry

sabinepython commented 6 years ago

Thanks for your help!

I opened the 2D shapefile with the terrain Martin prepared and it seems to be ok (in QGIS).

grafik

I will now try it in CEA

sabinepython commented 6 years ago

I had to use swissALTI3D2016relief since the create_new_project tool would not accept the terrain.tif from Martin.

Everything runs fine until the radiation tool... here's the error:

C:\Users\iA\Anaconda2\envs\cea\python.exe C:/Users/iA/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation_daysim/radiation_main.py DEBUG:Fiona:GDAL_DATA: C:\Program Files (x86)\PostgreSQL\10\gdal-data DEBUG:Fiona:PROJ_LIB: C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\osgeo\data\proj DEBUG:Fiona:GDAL_DATA: C:\Program Files (x86)\PostgreSQL\10\gdal-data DEBUG:Fiona:PROJ_LIB: C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\osgeo\data\proj DEBUG:Fiona:Userencoding: None DEBUG:Fiona:Projection not found (cogr_crs was NULL) DEBUG:Fiona:Projection not found (cogr_crs was NULL) DEBUG:Fiona:Index: 0 DEBUG:fiona.collection:Flushed buffer DEBUG:fiona.collection:Stopped session creating 3D geometry and surfaces DEBUG:Fiona:GDAL_DATA: C:\Program Files (x86)\PostgreSQL\10\gdal-data DEBUG:Fiona:PROJ_LIB: C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\osgeo\data\proj DEBUG:Fiona:Userencoding: None DEBUG:Fiona:Got coordinate system INFO:Fiona:Failed to auto identify EPSG: 7 DEBUG:Fiona:Params: +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +no_defs DEBUG:Fiona:Got coordinate system DEBUG:Fiona:Index: 0 DEBUG:fiona.collection:Flushed buffer DEBUG:fiona.collection:Stopped session DEBUG:Fiona:GDAL_DATA: C:\Program Files (x86)\PostgreSQL\10\gdal-data DEBUG:Fiona:PROJ_LIB: C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\osgeo\data\proj DEBUG:Fiona:Userencoding: None DEBUG:Fiona:Got coordinate system INFO:Fiona:Failed to auto identify EPSG: 7 DEBUG:Fiona:Params: +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +no_defs DEBUG:Fiona:Got coordinate system DEBUG:Fiona:Index: 0 DEBUG:fiona.collection:Flushed buffer DEBUG:fiona.collection:Stopped session DEBUG:Fiona:GDAL_DATA: C:\Program Files (x86)\PostgreSQL\10\gdal-data DEBUG:Fiona:PROJ_LIB: C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\osgeo\data\proj DEBUG:Fiona:Userencoding: None DEBUG:Fiona:Projection not found (cogr_crs was NULL) DEBUG:Fiona:Projection not found (cogr_crs was NULL) DEBUG:Fiona:Index: 0 DEBUG:fiona.collection:Flushed buffer DEBUG:fiona.collection:Stopped session Failed to boolean cut Failed to boolean cut [...] Failed to boolean cut Traceback (most recent call last): File "C:/Users/iA/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation_daysim/radiation_main.py", line 231, in main(cea.config.Configuration()) File "C:/Users/iA/Documents/GitHub/CityEnergyAnalyst/cea/resources/radiation_daysim/radiation_main.py", line 211, in main settings) File "C:\Users\iA\Documents\GitHub\CityEnergyAnalyst\cea\resources\radiation_daysim\geometry_generator.py", line 359, in geometry_main nfloor_col="floors_ag") File "C:\Users\iA\Documents\GitHub\CityEnergyAnalyst\cea\resources\radiation_daysim\geometry_generator.py", line 164, in building2d23d building_solid = calc_solid(face_footprint, range_floors, flr2flr_height) File "C:\Users\iA\Documents\GitHub\CityEnergyAnalyst\cea\resources\radiation_daysim\geometry_generator.py", line 286, in calc_solid vertical_shell = construct.make_loft(moved_face_list) File "C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\pyliburo\py3dmodel\construct.py", line 132, in make_loft loft = Construct.make_loft(wire_list, ruled = rule_face) File "C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\pyliburo\py3dmodel\OCCUtils\Construct.py", line 423, in make_loft with assert_isdone(sections, 'failed lofting'): File "C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\pyliburo\py3dmodel\OCCUtils\Common.py", line 65, in enter raise AssertionError(self.error_statement) AssertionError: failed lofting

Process finished with exit code 1

Where does the error lie?

PS: I cannot access the polybox... it says I don't have the permission

martin-mosteiro commented 6 years ago

@sabinepython Sorry, here are the correct links

daren-thomas commented 6 years ago

@sabinepython do you have new files? the ones martin links to don't seem to work properly for me. i get a totally different errror...

sabinepython commented 6 years ago

@daren-thomas same here, I tried Martin's files on Friday and it didn't work out neither. I'm now working on a new reduced sample with 10 buildings in the middle of the district. https://www.dropbox.com/sh/yja9zlseciawc2c/AABkLMW8aXzD9u2bJb9wvweOa?dl=0

Concerning the re-projection, my shapefiles are already in CH1903/LV03 ...

sabinepython commented 6 years ago

Or is CH1903/LV03 the root of the problem and I should use another one? Could you recommend any PCS for Switzerland I could use and fulfills CEA's requirements?

sabinepython commented 6 years ago

Oh it seems to work better with CH1903+/LV95 :)

sabinepython commented 6 years ago

@daren-thomas So now I changed the terrain created by Martin and the district & zone shapefiles to CH1903+/LV95, they overlap nicely in QGIS :) Using these files I'm getting the error below when running the create_new_file:

`Running create-new-project with occupancy-types = C:\Users\iA\Dropbox\SemesterProject_SP\CEA\test_sample10/inputs/building-properties/occupancy.dbf Warning 1: Cannot find ellipsoid.csv Running create-new-project with zone = C:\Users\iA\Dropbox\SemesterProject_SP\CEA\test_sample10/inputs/building-geometry/zone.shp Running create-new-project with terrain = C:\Users\iA\Dropbox\SemesterProject_SP\CEA\test_sample10/inputs/topography/terrain.tif Running create-new-project with terrain = C:\Users\iA\Dropbox\SemesterProject_SP\CEA\test_sample10/inputs/topography/terrain.tif Running create-new-project with output-path = C:\Users\iA\Dropbox\SemesterProject_SP Warning 1: Cannot find prime_meridian.csv Traceback (most recent call last): File "C:/Users/iA/Documents/GitHub/CityEnergyAnalyst/cea/datamanagement/create_new_project.py", line 141, in main(cea.config.Configuration()) File "C:/Users/iA/Documents/GitHub/CityEnergyAnalyst/cea/datamanagement/create_new_project.py", line 135, in main create_new_project(locator, config) File "C:/Users/iA/Documents/GitHub/CityEnergyAnalyst/cea/datamanagement/create_new_project.py", line 56, in create_new_project driver.CreateCopy(locator.get_terrain(), terrain) File "C:\Users\iA\Anaconda2\envs\cea\lib\site-packages\osgeo\gdal.py", line 1515, in CreateCopy return _gdal.Driver_CreateCopy(self, *args, **kwargs) ValueError: Received a NULL pointer.

Process finished with exit code 1`

any ideas of where the bug lies?

daren-thomas commented 6 years ago

@sabinepython can you make your terrain and shape files available?

sabinepython commented 6 years ago

They're in the link I shared before terrain: https://www.dropbox.com/s/lez7bv9d5my6fcm/terrain.tif?dl=0 shapefiles: https://www.dropbox.com/sh/ryg7hw34pio7xvq/AABhDS39QivlsjKN9kgKBJXAa?dl=0

daren-thomas commented 5 years ago

@sabinepython based on your scenario as posted here: https://www.dropbox.com/sh/yja9zlseciawc2c/AABkLMW8aXzD9u2bJb9wvweOa?dl=0

I just managed to run the radiation simulation. I did encounter a problem with building Z1947 - It has 0 floors above ground and 0 height above ground and the CEA was not able to handle that. I just removed it and the simulation ran through. I did not get the error you had above, though. Instead, I got an error failed lofting.

What you have above seems to be an installation error. I can help you with installing no problem!

sabinepython commented 5 years ago

@daren-thomas Could you come over for the installation issue this afternoon or even now? If after that there are still some issues we can discuss them tomorrow after Integrated Design.

sabinepython commented 5 years ago

@daren-thomas could you please share your modified files (without Z1947)? thanks