Skip to content

Commit

Permalink
Merge pull request #1018 from ebocher/w_target_filter
Browse files Browse the repository at this point in the history
Force W target indicator
  • Loading branch information
ebocher authored Dec 11, 2024
2 parents 76ba3df + 0f60dc6 commit 6aead54
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ abstract class AbstractBDTopoWorkflow extends BDTopoUtils {
"IMPERVIOUS_FRACTION",
"VEGETATION_FRACTION"])
}
if(x_size != y_size){
throw new Exception("TARGET model supports only regular grid. Please set the same x and y resolutions")
}
def grid_indicators_tmp = [
"x_size" : x_size,
"y_size" : y_size,
Expand Down Expand Up @@ -913,7 +916,7 @@ abstract class AbstractBDTopoWorkflow extends BDTopoUtils {
}
//We must transform the grid_indicators to produce the target land input
if(processing_parameters.rsu_indicators.indicatorUse.contains("TARGET")){
results.put("grid_target", Geoindicators.GridIndicators.formatGrid4Target(h2gis_datasource, rasterizedIndicators))
results.put("grid_target", Geoindicators.GridIndicators.formatGrid4Target(h2gis_datasource, rasterizedIndicators, x_size))
}
info("End computing grid_indicators")
}
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
- Fix github actions
- Add TARGET landcover production
- Force TARGET ROOF fraction to 0.75 when BUILDING fraction is greater than 0.75
- Force TARGET W indicator to the grid resolution
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,12 @@ String gridDistances(JdbcDataSource datasource, String input_polygons, String gr
*
* @param datasource input database
* @param gridTable input grid_indicators
* @param resolution grid resolution in meters
* @return a grid formated
*
* @author Erwan Bocher, CNRS
*/
String formatGrid4Target(JdbcDataSource datasource, String gridTable) {
String formatGrid4Target(JdbcDataSource datasource, String gridTable, float resolution) {
//Format target landcover
def grid_target = postfix("grid_target")
try {
Expand All @@ -400,7 +401,9 @@ String formatGrid4Target(JdbcDataSource datasource, String gridTable) {
0 AS "irr",
AVG_HEIGHT_ROOF_AREA_WEIGHTED AS "H",
CASE WHEN
STREET_WIDTH IS NULL THEN 0.1 ELSE STREET_WIDTH END AS "W"
STREET_WIDTH IS NULL THEN 0.1
WHEN STREET_WIDTH > ${resolution} THEN ${resolution}
ELSE STREET_WIDTH END AS "W"
FROM ${gridTable}
""")
return grid_target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ Map osm_processing(JdbcDataSource h2gis_datasource, def processing_parameters, d
}
//We must transform the grid_indicators to produce the target land input
if(rsu_indicators_params.indicatorUse.contains("TARGET")){
results.put("grid_target", Geoindicators.GridIndicators.formatGrid4Target(h2gis_datasource, rasterizedIndicators))
results.put("grid_target", Geoindicators.GridIndicators.formatGrid4Target(h2gis_datasource, rasterizedIndicators, x_size))
}
info("End computing grid_indicators")
}
Expand Down Expand Up @@ -923,6 +923,11 @@ def extractProcessingParameters(def processing_parameters) throws Exception {
"IMPERVIOUS_FRACTION",
"VEGETATION_FRACTION"])
}

if(x_size != y_size){
throw new Exception("TARGET model supports only regular grid. Please set the same x and y resolutions")
}

def grid_indicators_tmp = [
"x_size" : x_size,
"y_size" : y_size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ class WorflowOSMTest extends WorkflowAbstractTest {
def grid_size = 100
location =[47.214976592711274,-1.6425595375815742,47.25814872718718,-1.5659501122281323]
//location=[47.215334,-1.558058,47.216646,-1.556185]
//location = nominatim.bbox
location = nominatim.bbox
//location=[51.2, 1.0, 51.4, 1.2]
/* location =[ 48.84017284026897,
2.3061887733275785,
Expand Down Expand Up @@ -759,7 +759,7 @@ class WorflowOSMTest extends WorkflowAbstractTest {
"parameters" :
["distance" : 0,
"rsu_indicators" : [
"indicatorUse": ["LCZ", "TEB", "TARGET"] //, "UTRF"]
"indicatorUse": ["TARGET"] //, "UTRF"]

], "grid_indicators" : [
"x_size" : grid_size,
Expand Down

0 comments on commit 6aead54

Please sign in to comment.