kartoza / GEEST

Gender Enabling Environments Spatial Tool (GEEST)
https://worldbank.github.io/GEEST/
MIT License
1 stars 2 forks source link

Factor: Place Characterization - Aggregation #113

Open mvmaltitz opened 3 months ago

mvmaltitz commented 3 months ago

I am getting the following output which is incorrect and makes the output smaller that it should be:

Image

The inputs are:

Image

Image

dimasciput commented 3 months ago

Found the issue is due to the difference in metadata for each raster layer.

Proposed workaround : loop through all the layers and find the largest transform :

def find_largest_transform(raster_files):
    transforms = []
    for raster_file in raster_files:
        with rasterio.open(raster_file) as src:
            transforms.append(src.transform)

    largest_transform = max(transforms, key=lambda t: abs(t.a * t.e - t.b * t.d))

    return largest_transform
largest_transform = find_largest_transform(rasLayers)
meta1.update(transform=largest_transform)
ClaraIV commented 2 months ago

Please ensure the testing is performed using every possible combination of data inputs for each factor (eg. For Safety: use all options, iteratively). Thanks! @osundwajeff @mvmaltitz @dragosgontariu

mvmaltitz commented 2 months ago

Input layers:

Image

Image

Image

Image

Image

Image

Image

Image

Results:

Image

@dragosgontariu

mvmaltitz commented 2 months ago

@javaftw @osundwajeff

I get the following error message and no place score error.

Image

mvmaltitz commented 1 month ago

@timlinux

Using self and manually generated other Factors that failed during process via Plugin, the Place score aggregation also experiencing an error with trigger Python error below

2024-09-12T23:18:14     WARNING    Traceback (most recent call last):
              File "C:\Users/benny/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gender_indicator_tool\gender_indicator_tool.py", line 6320, in place_characterization_aggregation
              (np.where(WLK_ras != -9999, WLK_ras, 0) * WLK_weight / 100) +
             ValueError: operands could not be broadcast together with shapes (10756,4352) (10756,4364) 

Screenshot 2024-09-12 232044

And Python warning below

2024-09-12T23:18:14     WARNING    warning:C:\Users/benny/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gender_indicator_tool\gender_indicator_tool.py:6320: RuntimeWarning: overflow encountered in multiply
              (np.where(WLK_ras != -9999, WLK_ras, 0) * WLK_weight / 100) +

             traceback: File "C:\Users/benny/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gender_indicator_tool\gender_indicator_tool.py", line 6320, in place_characterization_aggregation
              (np.where(WLK_ras != -9999, WLK_ras, 0) * WLK_weight / 100) +