Spaces:
Sleeping
Sleeping
Fix region selection bug
Browse files
app.py
CHANGED
|
@@ -60,6 +60,10 @@ def get_data():
|
|
| 60 |
# Convert to Xarray
|
| 61 |
obj = df.set_index(pivot_cols)['value'].to_xarray()
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
# Scale units (new CSV data is already aggregated but needs % scaling to match 100% total roughly)
|
| 64 |
# Multiply by 10000 (100 * 100) as per user request to reach expected percentage scale
|
| 65 |
return obj / 0.05*100
|
|
|
|
| 60 |
# Convert to Xarray
|
| 61 |
obj = df.set_index(pivot_cols)['value'].to_xarray()
|
| 62 |
|
| 63 |
+
# Ensure region order matches GeoJSON to prevent mapping bugs
|
| 64 |
+
if 'region_id' in obj.coords:
|
| 65 |
+
obj = obj.reindex(region_id=region_names)
|
| 66 |
+
|
| 67 |
# Scale units (new CSV data is already aggregated but needs % scaling to match 100% total roughly)
|
| 68 |
# Multiply by 10000 (100 * 100) as per user request to reach expected percentage scale
|
| 69 |
return obj / 0.05*100
|