Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by 0 issue - Problem with running geoclimate on Nice #863

Closed
balglave opened this issue Oct 27, 2023 · 9 comments
Closed

Division by 0 issue - Problem with running geoclimate on Nice #863

balglave opened this issue Oct 27, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@balglave
Copy link

balglave commented Oct 27, 2023

Hi,
I want to run GeoClimate on Nice, but I am having a "division by 0" issue.
The request is below. Does someone have an idea where could be the problem ?
Thanks ! :)
Baptiste

{
    "description": "Processing OSM data",
    "input": {
    "locations": ["Nice"]
    },
    "output": {
        "folder": "D:\\Users\\alglave\\Desktop\\Research\\geoclimate\\data"
    },
    "parameters": {
        "rsu_indicators": {
            "indicatorUse": [
                "LCZ",
                "TEB",
                "UTRF"
            ],
            "svfSimplified": true,
            "estimateHeight": true
        },
        "grid_indicators": {
            "x_size": 100,
	    "y_size": 100,
	    "rowCol": false,
	    "output" : "geojson",
	    "indicators" :[
                 "BUILDING_FRACTION", 
                 "BUILDING_HEIGHT", 
                 "WATER_FRACTION",
                 "VEGETATION_FRACTION", 
                 "ROAD_FRACTION", 
                 "IMPERVIOUS_FRACTION", 
                 "LCZ_FRACTION"
             ]
         }
    }
}
@balglave balglave changed the title Problem with running geoclimate on Nice Division by 0 issue - Problem with running geoclimate on Nice Oct 27, 2023
@ebocher ebocher self-assigned this Oct 27, 2023
@ebocher
Copy link
Member

ebocher commented Oct 27, 2023

Thanks. Investigation under the pipe

@ebocher ebocher added the bug Something isn't working label Nov 7, 2023
@ebocher ebocher assigned j3r3m1 and unassigned ebocher Nov 14, 2023
@j3r3m1
Copy link
Collaborator

j3r3m1 commented Nov 15, 2023

@balglave can you share your log file to see exactly where the error is located ?

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Nov 17, 2023

Here it is:

15:13:38.713 [main] INFO class org.orbisgis.geoclimate.Geoindicators -- The URBAN TYPOLOGY classification is performed
15:13:38.714 [main] DEBUG class org.orbisgis.geoclimate.Geoindicators -- Executing the gathering of scales (to building or to RSU scale)
15:13:38.715 [main] DEBUG class org.orbisgis.geoclimate.Geoindicators -- Executing Unweighted statistical operations from lower scale
15:13:47.051 [main] DEBUG class org.orbisgis.geoclimate.Geoindicators -- Apply a Random Forest model
15:14:16.449 [main] DEBUG class org.orbisgis.geoclimate.Geoindicators -- Executing equality and uniqueness indicators
org.h2.jdbc.JdbcSQLDataException: Division par zéro: "CAST(0 AS DECFLOAT)"
Division by zero: "CAST(0 AS DECFLOAT)"; SQL statement:
DROP TABLE IF EXISTS TEMPO_DISTRIB [22012-224]

@balglave
Copy link
Author

Youps, sorry for not responding, I completely missed your comment...
And thanks for running it !

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Nov 22, 2023

Youps, sorry for not responding, I completely missed your comment... And thanks for running it !

No worries.

The problem comes from the UTRF distribution calculated based on floor area. Normally, if there is no building in a RSU, it is not considered in the distribution calculation. This is OK for the UTRF distribution based on building fraction. However, when the UTRF distribution is based on floor area fraction, it does not work if all buildings in the RSU have a floor area equal to 0, which is the case for a RSU in Nice...

We have two buildings (ID_SOURCE w448862514 and w141719740) within a single RSU having building height = 2 m. Thus, due to the floor area calculation method, the floor area results in 0 m². We have 3 options to solve that:

  1. consider that the building cannot have a building height lower than 3 m.
  2. consider that the floor area should be equal to the building area when the building height < 3m
  3. remove RSU having 0 values in all classes before distribution characterization

I would opt for the second solution. @ebocher what do you think ?

@ebocher
Copy link
Member

ebocher commented Dec 8, 2023

+1 for second solution

@j3r3m1 j3r3m1 added this to the GeoClimate 0.0.2 milestone Jan 8, 2024
@j3r3m1
Copy link
Collaborator

j3r3m1 commented Jan 9, 2024

The problem comes from the nb_lev formatting in the OSM workflow. The BDTopo formatting seems OK (the max of heightRoof / h_lev_min and 1 is taken).

Here is a bbox test for the building causing the troubles:
[43.725068,7.297883,43.727635,7.301284]

@j3r3m1
Copy link
Collaborator

j3r3m1 commented Jan 9, 2024

OK the problem is more complex than expected. I could perform the test for a building having a height lower than 3 m, the building is not even considered if this height information comes alone (ejected from this line).

However, if this information does not come alone as this is the case for building w141719740, thus the building is considered as it also have a nb_lev = 1. However, the nb_lev is downgraded to 0 but not in the initial formatting step. I suspect that it is when there is the building height estimation (I am investigating).

Anyway, there is a first inconsistency in our method: we consider a building as OK if it has a nb_lev > 0 but a building height < 3 m while we consider a building having only a building height < 3 m is not a building (it is evinced). I suggest we keep it and put its nb_lev to 1 (it is the case for BDTopo).

j3r3m1 added a commit to j3r3m1/geoclimate that referenced this issue Jan 9, 2024
@j3r3m1 j3r3m1 mentioned this issue Jan 9, 2024
ebocher added a commit that referenced this issue Jan 11, 2024
@ebocher
Copy link
Member

ebocher commented Jan 12, 2024

Fixed thanks @j3r3m1

@ebocher ebocher closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants