Skip to content

Commit

Permalink
Add TYPO_SECOND in UTRF tables and a corresponding test
Browse files Browse the repository at this point in the history
  • Loading branch information
j3r3m1 committed Nov 7, 2023
1 parent 2556b76 commit 4e158be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ Map computeTypologyIndicators(JdbcDataSource datasource, String building_indicat
def CORRESPONDENCE_TAB_UTRF = ["ba" : 1, "bgh": 2, "icif": 3, "icio": 4, "id": 5, "local": 6, "pcif": 7,
"pcio": 8, "pd": 9, "psc": 10]
def nameColTypoMaj = "TYPO_MAJ"
def nameColTypoSecond = "TYPO_SECOND"

// Output Lcz (and urbanTypo) table names are set to null in case LCZ indicators (and urban typo) are not calculated
def rsuLcz = null
Expand Down Expand Up @@ -974,7 +975,10 @@ Map computeTypologyIndicators(JdbcDataSource datasource, String building_indicat
ELSE b.UNIQUENESS_VALUE END AS UNIQUENESS_VALUE,
CASE WHEN b.UNIQUENESS_VALUE=-1
THEN NULL
ELSE LOWER(SUBSTRING(b.EXTREMUM_COL FROM 6)) END AS $nameColTypoMaj
ELSE LOWER(SUBSTRING(b.EXTREMUM_COL FROM 6)) END AS $nameColTypoMaj,
CASE WHEN b.UNIQUENESS_VALUE=-1
THEN NULL
ELSE LOWER(SUBSTRING(b.EXTREMUM_COL2 FROM 6)) END AS $nameColTypoSecond
FROM TEMPO_DISTRIB a LEFT JOIN $resultsDistrib b
ON a.$COLUMN_ID_RSU=b.$COLUMN_ID_RSU""".toString()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ class WorkflowGeoIndicatorsTest {
// Check that the sum of proportion (or building floor area) for each RSU is equal to 1
def utrfFloorArea = datasource."$geoIndicatorsCompute_i.rsu_utrf_floor_area"
def colUtrfFloorArea = utrfFloorArea.getColumns()

// Test that the TYPO_SECOND is inside the RSU UTRF table
assertEquals colUtrfFloorArea.count("TYPO_SECOND"), 1

colUtrfFloorArea = colUtrfFloorArea.minus(["ID_RSU", "THE_GEOM", "TYPO_MAJ", "TYPO_SECOND", "UNIQUENESS_VALUE"])
def countSumFloorAreaEqual1 = datasource.firstRow("""SELECT COUNT(*) AS NB
FROM ${geoIndicatorsCompute_i.rsu_utrf_floor_area}
Expand Down

0 comments on commit 4e158be

Please sign in to comment.