Spaces:
Sleeping
Sleeping
Commit 路
aa615b0
1
Parent(s): d238bb5
Change % to pct
Browse files- app.py +3 -3
- data_utils.py +7 -7
app.py
CHANGED
|
@@ -111,7 +111,7 @@ def server(input, output, session):
|
|
| 111 |
apply_filter = input.split_filter()
|
| 112 |
|
| 113 |
if apply_filter == "Filtro":
|
| 114 |
-
split = '
|
| 115 |
else:
|
| 116 |
split = False
|
| 117 |
|
|
@@ -158,7 +158,7 @@ def server(input, output, session):
|
|
| 158 |
apply_filter = input.split_filter()
|
| 159 |
|
| 160 |
if apply_filter == "Filtro":
|
| 161 |
-
split = '
|
| 162 |
else:
|
| 163 |
split = False
|
| 164 |
|
|
@@ -170,7 +170,7 @@ def server(input, output, session):
|
|
| 170 |
if simulation_mode == "Usar control deslizante":
|
| 171 |
title = f"Estimaci贸n de cobertura arb贸rea necesaria para una disminuci贸n de {value_temp}掳C"
|
| 172 |
try:
|
| 173 |
-
fig = show_two_plots(gdf_temp, '
|
| 174 |
min_cobertura_veg, max_cobertura, 'YlGn',
|
| 175 |
title,"Cobertura arb贸rea antes",
|
| 176 |
"Cobertura arb贸rea (%)", split=split)
|
|
|
|
| 111 |
apply_filter = input.split_filter()
|
| 112 |
|
| 113 |
if apply_filter == "Filtro":
|
| 114 |
+
split = 'pct_total_trees'
|
| 115 |
else:
|
| 116 |
split = False
|
| 117 |
|
|
|
|
| 158 |
apply_filter = input.split_filter()
|
| 159 |
|
| 160 |
if apply_filter == "Filtro":
|
| 161 |
+
split = 'pct_total_trees'
|
| 162 |
else:
|
| 163 |
split = False
|
| 164 |
|
|
|
|
| 170 |
if simulation_mode == "Usar control deslizante":
|
| 171 |
title = f"Estimaci贸n de cobertura arb贸rea necesaria para una disminuci贸n de {value_temp}掳C"
|
| 172 |
try:
|
| 173 |
+
fig = show_two_plots(gdf_temp, 'pct_total_trees', 'Pct_CoberturaVeg',
|
| 174 |
min_cobertura_veg, max_cobertura, 'YlGn',
|
| 175 |
title,"Cobertura arb贸rea antes",
|
| 176 |
"Cobertura arb贸rea (%)", split=split)
|
data_utils.py
CHANGED
|
@@ -63,8 +63,8 @@ def run_treatment_increase(X, T, original_df, df, value, name, simulation_mode):
|
|
| 63 |
print("Request failed:", response.status_code, response.text)
|
| 64 |
|
| 65 |
treatment_df[name] = result["effect"]
|
| 66 |
-
treatment_df['
|
| 67 |
-
treatment_df['pp_trees_increase'] = treatment_df['
|
| 68 |
|
| 69 |
return treatment_df
|
| 70 |
|
|
@@ -76,10 +76,10 @@ def process_data_trees_to_temp(value, simulation_mode, original_df, df, X, Y, T)
|
|
| 76 |
|
| 77 |
#add columns translated to square meters
|
| 78 |
treatment_df['sqm_trees_increase'] = (treatment_df['pp_trees_increase']/100)*cell_area
|
| 79 |
-
treatment_df['sqm_total_trees'] = (treatment_df['
|
| 80 |
|
| 81 |
col_order = ['index', 'x', 'y', 'Pct_CoberturaVeg', 'Pct_Construccion', 'LST','temp_decrease',
|
| 82 |
-
'new_temp', 'pp_trees_increase','
|
| 83 |
|
| 84 |
treatment_df = treatment_df[col_order]
|
| 85 |
|
|
@@ -115,14 +115,14 @@ def process_data_temp_to_trees(goal, simulation_mode, original_df, df, X, Y, T):
|
|
| 115 |
name = 'pp_trees_increase'
|
| 116 |
treatment_df = run_temp_decrease(X, original_df, df, goal, name,simulation_mode)
|
| 117 |
|
| 118 |
-
treatment_df['
|
| 119 |
|
| 120 |
#add columns translated to square meters
|
| 121 |
-
treatment_df['sqm_total_trees'] = (treatment_df['
|
| 122 |
treatment_df['sqm_trees_increase'] = (treatment_df['pp_trees_increase']/100)*cell_area
|
| 123 |
|
| 124 |
col_order = ['index', 'x', 'y', 'Pct_CoberturaVeg', 'Pct_Construccion', 'LST','temp_decrease',
|
| 125 |
-
'new_temp', 'pp_trees_increase','
|
| 126 |
|
| 127 |
treatment_df = treatment_df[col_order]
|
| 128 |
|
|
|
|
| 63 |
print("Request failed:", response.status_code, response.text)
|
| 64 |
|
| 65 |
treatment_df[name] = result["effect"]
|
| 66 |
+
treatment_df['pct_total_trees'] = T_sim
|
| 67 |
+
treatment_df['pp_trees_increase'] = treatment_df['pct_total_trees'] - treatment_df['Pct_CoberturaVeg']
|
| 68 |
|
| 69 |
return treatment_df
|
| 70 |
|
|
|
|
| 76 |
|
| 77 |
#add columns translated to square meters
|
| 78 |
treatment_df['sqm_trees_increase'] = (treatment_df['pp_trees_increase']/100)*cell_area
|
| 79 |
+
treatment_df['sqm_total_trees'] = (treatment_df['pct_total_trees']/100)*cell_area
|
| 80 |
|
| 81 |
col_order = ['index', 'x', 'y', 'Pct_CoberturaVeg', 'Pct_Construccion', 'LST','temp_decrease',
|
| 82 |
+
'new_temp', 'pp_trees_increase','pct_total_trees', 'sqm_trees_increase','sqm_total_trees',] # to match gdf trees
|
| 83 |
|
| 84 |
treatment_df = treatment_df[col_order]
|
| 85 |
|
|
|
|
| 115 |
name = 'pp_trees_increase'
|
| 116 |
treatment_df = run_temp_decrease(X, original_df, df, goal, name,simulation_mode)
|
| 117 |
|
| 118 |
+
treatment_df['pct_total_trees'] = treatment_df['Pct_CoberturaVeg'] + treatment_df[name]
|
| 119 |
|
| 120 |
#add columns translated to square meters
|
| 121 |
+
treatment_df['sqm_total_trees'] = (treatment_df['pct_total_trees']/100)*cell_area
|
| 122 |
treatment_df['sqm_trees_increase'] = (treatment_df['pp_trees_increase']/100)*cell_area
|
| 123 |
|
| 124 |
col_order = ['index', 'x', 'y', 'Pct_CoberturaVeg', 'Pct_Construccion', 'LST','temp_decrease',
|
| 125 |
+
'new_temp', 'pp_trees_increase','pct_total_trees', 'sqm_trees_increase','sqm_total_trees',] # to match gdf trees
|
| 126 |
|
| 127 |
treatment_df = treatment_df[col_order]
|
| 128 |
|