Skip to content

Commit

Permalink
wee score validation ctd
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Dec 18, 2024
1 parent 0f2fae8 commit 3ab6c7b
Show file tree
Hide file tree
Showing 8 changed files with 394 additions and 6 deletions.
23 changes: 23 additions & 0 deletions geest/core/algorithms/wee_score_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ def calculate_wee_score(self) -> None:

log_message(f"Calculating WEE SCORE for area {index}")

# processing.run("gdal:rastercalculator",
# {
# 'INPUT_A':'/home/timlinux/dev/python/GEEST2/test/test_data/wee_score/wee.asc',
# 'BAND_A':1,
# 'INPUT_B':'/home/timlinux/dev/python/GEEST2/test/test_data/wee_score/population/population.asc',
# 'BAND_B':1,
# 'INPUT_C':None,
# 'BAND_C':None,
# 'INPUT_D':None,
# 'BAND_D':None,
# 'INPUT_E':None,
# 'BAND_E':None,
# 'INPUT_F':None,
# 'BAND_F':None,
# 'FORMULA':'((A - 1) * 3) + B',
# 'NO_DATA':None,
# 'EXTENT_OPT':3,
# 'PROJWIN':None,
# 'RTYPE':0,
# 'OPTIONS':'',
# 'EXTRA':'',
# 'OUTPUT':'TEMPORARY_OUTPUT'})

# Raster algebra formula: ((GEEST - 1) * 3) + POP
params = {
"EXPRESSION": f"((A@1 - 1) * 3) + B@1",
Expand Down
8 changes: 4 additions & 4 deletions test/test_data/wee_score/population/population.asc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ xllcorner 0.0
yllcorner 0.0
cellsize 1.0
NODATA_value -9999
1 2 3 -9999
2 3 1 2
3 1 2 3
-9999 1 2 3
1 1 1 1
1 2 2 2
2 2 3 3
3 3 3 -9999
11 changes: 11 additions & 0 deletions test/test_data/wee_score/population/population.asc.aux.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<PAMDataset>
<PAMRasterBand band="1">
<Metadata>
<MDI key="STATISTICS_MINIMUM">1</MDI>
<MDI key="STATISTICS_MAXIMUM">3</MDI>
<MDI key="STATISTICS_MEAN">2.0714285714286</MDI>
<MDI key="STATISTICS_STDDEV">0.79859570624992</MDI>
<MDI key="STATISTICS_VALID_PERCENT">87.5</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
156 changes: 156 additions & 0 deletions test/test_data/wee_score/population/population.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis hasScaleBasedVisibilityFlag="0" styleCategories="AllStyleCategories" minScale="1e+08" maxScale="0" version="3.38.3-Grenoble">
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
<Private>0</Private>
</flags>
<temporal fetchMode="0" enabled="0" mode="0" bandNumber="1">
<fixedRange>
<start></start>
<end></end>
</fixedRange>
</temporal>
<elevation zscale="1" enabled="0" zoffset="0" mode="RepresentsElevationSurface" band="1" symbology="Line">
<data-defined-properties>
<Option type="Map">
<Option value="" name="name" type="QString"/>
<Option name="properties"/>
<Option value="collection" name="type" type="QString"/>
</Option>
</data-defined-properties>
<profileLineSymbol>
<symbol name="" is_animated="0" type="line" alpha="1" force_rhr="0" clip_to_extent="1" frame_rate="10">
<data_defined_properties>
<Option type="Map">
<Option value="" name="name" type="QString"/>
<Option name="properties"/>
<Option value="collection" name="type" type="QString"/>
</Option>
</data_defined_properties>
<layer enabled="1" class="SimpleLine" locked="0" pass="0" id="{7240e22d-3aaa-46dc-ad47-10b7d1d32794}">
<Option type="Map">
<Option value="0" name="align_dash_pattern" type="QString"/>
<Option value="square" name="capstyle" type="QString"/>
<Option value="5;2" name="customdash" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="customdash_map_unit_scale" type="QString"/>
<Option value="MM" name="customdash_unit" type="QString"/>
<Option value="0" name="dash_pattern_offset" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="dash_pattern_offset_map_unit_scale" type="QString"/>
<Option value="MM" name="dash_pattern_offset_unit" type="QString"/>
<Option value="0" name="draw_inside_polygon" type="QString"/>
<Option value="bevel" name="joinstyle" type="QString"/>
<Option value="196,60,57,255,rgb:0.7686274509803922,0.23529411764705882,0.22352941176470589,1" name="line_color" type="QString"/>
<Option value="solid" name="line_style" type="QString"/>
<Option value="0.6" name="line_width" type="QString"/>
<Option value="MM" name="line_width_unit" type="QString"/>
<Option value="0" name="offset" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="offset_map_unit_scale" type="QString"/>
<Option value="MM" name="offset_unit" type="QString"/>
<Option value="0" name="ring_filter" type="QString"/>
<Option value="0" name="trim_distance_end" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="trim_distance_end_map_unit_scale" type="QString"/>
<Option value="MM" name="trim_distance_end_unit" type="QString"/>
<Option value="0" name="trim_distance_start" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="trim_distance_start_map_unit_scale" type="QString"/>
<Option value="MM" name="trim_distance_start_unit" type="QString"/>
<Option value="0" name="tweak_dash_pattern_on_corners" type="QString"/>
<Option value="0" name="use_custom_dash" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="width_map_unit_scale" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" name="name" type="QString"/>
<Option name="properties"/>
<Option value="collection" name="type" type="QString"/>
</Option>
</data_defined_properties>
</layer>
</symbol>
</profileLineSymbol>
<profileFillSymbol>
<symbol name="" is_animated="0" type="fill" alpha="1" force_rhr="0" clip_to_extent="1" frame_rate="10">
<data_defined_properties>
<Option type="Map">
<Option value="" name="name" type="QString"/>
<Option name="properties"/>
<Option value="collection" name="type" type="QString"/>
</Option>
</data_defined_properties>
<layer enabled="1" class="SimpleFill" locked="0" pass="0" id="{5d05f98c-1cdd-4f0b-ab8f-4f19258aaf89}">
<Option type="Map">
<Option value="3x:0,0,0,0,0,0" name="border_width_map_unit_scale" type="QString"/>
<Option value="196,60,57,255,rgb:0.7686274509803922,0.23529411764705882,0.22352941176470589,1" name="color" type="QString"/>
<Option value="bevel" name="joinstyle" type="QString"/>
<Option value="0,0" name="offset" type="QString"/>
<Option value="3x:0,0,0,0,0,0" name="offset_map_unit_scale" type="QString"/>
<Option value="MM" name="offset_unit" type="QString"/>
<Option value="35,35,35,255,rgb:0.13725490196078433,0.13725490196078433,0.13725490196078433,1" name="outline_color" type="QString"/>
<Option value="no" name="outline_style" type="QString"/>
<Option value="0.26" name="outline_width" type="QString"/>
<Option value="MM" name="outline_width_unit" type="QString"/>
<Option value="solid" name="style" type="QString"/>
</Option>
<data_defined_properties>
<Option type="Map">
<Option value="" name="name" type="QString"/>
<Option name="properties"/>
<Option value="collection" name="type" type="QString"/>
</Option>
</data_defined_properties>
</layer>
</symbol>
</profileFillSymbol>
</elevation>
<customproperties>
<Option type="Map">
<Option value="false" name="WMSBackgroundLayer" type="bool"/>
<Option value="false" name="WMSPublishDataSourceUrl" type="bool"/>
<Option value="0" name="embeddedWidgets/count" type="int"/>
<Option value="Value" name="identify/format" type="QString"/>
</Option>
</customproperties>
<mapTip enabled="1"></mapTip>
<pipe-data-defined-properties>
<Option type="Map">
<Option value="" name="name" type="QString"/>
<Option name="properties"/>
<Option value="collection" name="type" type="QString"/>
</Option>
</pipe-data-defined-properties>
<pipe>
<provider>
<resampling maxOversampling="2" enabled="false" zoomedInResamplingMethod="nearestNeighbour" zoomedOutResamplingMethod="nearestNeighbour"/>
</provider>
<rasterrenderer nodataColor="" alphaBand="-1" type="paletted" opacity="1" band="1">
<rasterTransparency/>
<minMaxOrigin>
<limits>None</limits>
<extent>WholeRaster</extent>
<statAccuracy>Estimated</statAccuracy>
<cumulativeCutLower>0.02</cumulativeCutLower>
<cumulativeCutUpper>0.98</cumulativeCutUpper>
<stdDevFactor>2</stdDevFactor>
</minMaxOrigin>
<colorPalette>
<paletteEntry value="1" color="#ffffcc" label="Low Population" alpha="255"/>
<paletteEntry value="2" color="#fd8d3c" label="Medium Population" alpha="255"/>
<paletteEntry value="3" color="#800026" label="High Population" alpha="255"/>
</colorPalette>
<colorramp name="[source]" type="cpt-city">
<Option type="Map">
<Option value="0" name="inverted" type="QString"/>
<Option value="cpt-city" name="rampType" type="QString"/>
<Option value="cb/seq/YlOrRd_09" name="schemeName" type="QString"/>
<Option value="" name="variantName" type="QString"/>
</Option>
</colorramp>
</rasterrenderer>
<brightnesscontrast gamma="1" contrast="0" brightness="0"/>
<huesaturation saturation="0" colorizeStrength="100" colorizeBlue="128" colorizeGreen="128" invertColors="0" colorizeOn="0" colorizeRed="255" grayscaleMode="0"/>
<rasterresampler maxOversampling="2"/>
<resamplingStage>resamplingFilter</resamplingStage>
</pipe>
<blendMode>0</blendMode>
</qgis>
11 changes: 11 additions & 0 deletions test/test_data/wee_score/validation.tif.aux.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<PAMDataset>
<PAMRasterBand band="1">
<Metadata>
<MDI key="STATISTICS_MINIMUM">1</MDI>
<MDI key="STATISTICS_MAXIMUM">14</MDI>
<MDI key="STATISTICS_MEAN">8.2307692307692</MDI>
<MDI key="STATISTICS_STDDEV">4.0601979139682</MDI>
<MDI key="STATISTICS_VALID_PERCENT">81.25</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
4 changes: 2 additions & 2 deletions test/test_data/wee_score/wee.asc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ yllcorner 0.0
cellsize 1.0
NODATA_value -9999
1 2 3 4
2 3 4 5
3 4 5 -9999
5 1 2 3
4 5 1 2
3 4 5 -9999
11 changes: 11 additions & 0 deletions test/test_data/wee_score/wee.asc.aux.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<PAMDataset>
<PAMRasterBand band="1">
<Metadata>
<MDI key="STATISTICS_MINIMUM">1</MDI>
<MDI key="STATISTICS_MAXIMUM">5</MDI>
<MDI key="STATISTICS_MEAN">3.2</MDI>
<MDI key="STATISTICS_STDDEV">1.3266499161422</MDI>
<MDI key="STATISTICS_VALID_PERCENT">93.75</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
Loading

0 comments on commit 3ab6c7b

Please sign in to comment.