Skip to content

Commit

Permalink
remove useless words, use HashSet instead of list.unique() and rename…
Browse files Browse the repository at this point in the history
… other_residential by undefined_residential
  • Loading branch information
BERNARD Jeremy committed Apr 15, 2024
1 parent a529c6d commit f29d4b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ String sizeProperties(JdbcDataSource datasource, String building, List operation

// The operation names are transformed into lower case
operations.replaceAll { it.toLowerCase() }
// Remove duplicated names
operations.unique()
operations.each {
switch (it) {
case OP_VOLUME:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ String computeBuildingsIndicators(JdbcDataSource datasource, String building, St
finalTablesToJoin.put(buildTableGeometryProperties, idColumnBu)

// building_volume + building_floor_area + building_total_facade_length
def sizeOperations = ["floor_area"]
HashSet sizeOperations = new HashSet()
sizeOperations.addAll(["floor_area"])
if (indicatorUse*.toUpperCase().contains("UTRF")) {
sizeOperations = sizeOperations + ["volume", "total_facade_length"]
sizeOperations.addAll(["volume", "total_facade_length"])
}
if (indicatorUse*.toUpperCase().contains("LCZ")) {
sizeOperations = sizeOperations + ["total_facade_length"]
sizeOperations.addAll(["total_facade_length"])
}
def buildTableSizeProperties = Geoindicators.BuildingIndicators.sizeProperties(datasource, building,
sizeOperations, buildingPrefixName)
sizeOperations as List, buildingPrefixName)
if (!buildTableSizeProperties) {
info "Cannot compute the building_volume, building_floor_area, building_total_facade_length " +
"indicators for the buildings"
Expand Down Expand Up @@ -388,7 +389,7 @@ String computeRSUIndicators(JdbcDataSource datasource, String buildingTable,
"collective_housing": [ "apartments","barracks","abbey", "dormitory",
"sheltered_housing", "workers_dormitory",
"condominium"],
"other_residential": ["residential"],
"undefined_residential": ["residential"],
"commercial" : ["commercial","internet_cafe","money_transfer","pharmacy",
"post_office","cinema","arts_centre", "brothel", "casino",
"sustenance","hotel","restaurant","bar","cafe","fast_food",
Expand Down Expand Up @@ -416,7 +417,7 @@ String computeRSUIndicators(JdbcDataSource datasource, String buildingTable,
"collective_housing": [ "apartments","barracks","abbey", "dormitory",
"sheltered_housing", "workers_dormitory",
"condominium"],
"other_residential": ["residential"],
"undefined_residential": ["residential"],
"commercial" : ["commercial","internet_cafe","money_transfer","pharmacy",
"post_office","cinema","arts_centre", "brothel", "casino",
"sustenance","hotel","restaurant","bar","cafe","fast_food",
Expand Down Expand Up @@ -1236,7 +1237,7 @@ Map getParameters() {
"collective_housing": [ "apartments","barracks","abbey", "dormitory",
"sheltered_housing", "workers_dormitory",
"condominium", "residential"],
"other_residential": ["residential"],
"undefined_residential": ["residential"],
"commercial" : ["commercial","internet_cafe","money_transfer","pharmacy",
"post_office","cinema","arts_centre", "brothel", "casino",
"sustenance","hotel","restaurant","bar","cafe","fast_food",
Expand Down Expand Up @@ -1265,7 +1266,7 @@ Map getParameters() {
"collective_housing": [ "apartments","barracks","abbey", "dormitory",
"sheltered_housing", "workers_dormitory",
"condominium", "residential"],
"other_residential": ["residential"],
"undefined_residential": ["residential"],
"commercial" : ["commercial","internet_cafe","money_transfer","pharmacy",
"post_office","cinema","arts_centre", "brothel", "casino",
"sustenance","hotel","restaurant","bar","cafe","fast_food",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ class WorkflowGeoIndicatorsTest {
def realListRsu = datasource.getTable(geoIndicatorsCompute_i.rsu_indicators).columns
// We test that there is no missing indicators in the RSU table
for (i in expectListRsu) {
println(i)
assertTrue realListRsu.contains(i)
}
if (indicatorUse.contains("LCZ")) {
Expand Down

0 comments on commit f29d4b9

Please sign in to comment.