Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor: Place Characterization - Aggregation #113

Open
Tracked by #15
mvmaltitz opened this issue Aug 20, 2024 · 6 comments
Open
Tracked by #15

Factor: Place Characterization - Aggregation #113

mvmaltitz opened this issue Aug 20, 2024 · 6 comments
Assignees
Labels
🏙️ Place characterization Dimension - place characterization

Comments

@mvmaltitz
Copy link

No description provided.

@mvmaltitz mvmaltitz added this to the Indicator Enhancements milestone Aug 20, 2024
@mvmaltitz mvmaltitz added the 🏙️ Place characterization Dimension - place characterization label Aug 20, 2024
@mvmaltitz mvmaltitz changed the title Place Characterization - Aggregation Factor: Place Characterization - Aggregation Aug 20, 2024
@mvmaltitz
Copy link
Author

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
Copy link
Member

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
Copy link

ClaraIV commented Aug 21, 2024

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
Copy link
Author

Input layers:

Image

Image

Image

Image

Image

Image

Image

Image

Results:

Image

@dragosgontariu

@mvmaltitz
Copy link
Author

@javaftw @osundwajeff

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

Image

@mvmaltitz
Copy link
Author

@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) +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏙️ Place characterization Dimension - place characterization
Projects
None yet
Development

No branches or pull requests

7 participants