Commit
·
f9508fc
1
Parent(s):
ff65346
refactor: changed choropleth map into map
Browse files
climateqa/engine/talk_to_data/drias/plots.py
CHANGED
|
@@ -164,7 +164,7 @@ indicator_evolution_at_location: Plot = {
|
|
| 164 |
"plot_function": plot_indicator_evolution_at_location,
|
| 165 |
"sql_query": indicator_per_year_at_location_query,
|
| 166 |
"plot_information": indicator_evolution_informations,
|
| 167 |
-
'short_name': '
|
| 168 |
}
|
| 169 |
|
| 170 |
|
|
@@ -249,7 +249,7 @@ indicator_number_of_days_per_year_at_location: Plot = {
|
|
| 249 |
"plot_function": plot_indicator_number_of_days_per_year_at_location,
|
| 250 |
"sql_query": indicator_per_year_at_location_query,
|
| 251 |
"plot_information": indicator_number_of_days_per_year_informations,
|
| 252 |
-
"short_name": "
|
| 253 |
}
|
| 254 |
|
| 255 |
|
|
@@ -335,7 +335,7 @@ distribution_of_indicator_for_given_year: Plot = {
|
|
| 335 |
"plot_function": plot_distribution_of_indicator_for_given_year,
|
| 336 |
"sql_query": indicator_for_given_year_query,
|
| 337 |
"plot_information": distribution_of_indicator_for_given_year_informations,
|
| 338 |
-
'short_name': '
|
| 339 |
}
|
| 340 |
|
| 341 |
|
|
|
|
| 164 |
"plot_function": plot_indicator_evolution_at_location,
|
| 165 |
"sql_query": indicator_per_year_at_location_query,
|
| 166 |
"plot_information": indicator_evolution_informations,
|
| 167 |
+
'short_name': 'Evolution'
|
| 168 |
}
|
| 169 |
|
| 170 |
|
|
|
|
| 249 |
"plot_function": plot_indicator_number_of_days_per_year_at_location,
|
| 250 |
"sql_query": indicator_per_year_at_location_query,
|
| 251 |
"plot_information": indicator_number_of_days_per_year_informations,
|
| 252 |
+
"short_name": "Yearly Frequency",
|
| 253 |
}
|
| 254 |
|
| 255 |
|
|
|
|
| 335 |
"plot_function": plot_distribution_of_indicator_for_given_year,
|
| 336 |
"sql_query": indicator_for_given_year_query,
|
| 337 |
"plot_information": distribution_of_indicator_for_given_year_informations,
|
| 338 |
+
'short_name': 'Distribution'
|
| 339 |
}
|
| 340 |
|
| 341 |
|
climateqa/engine/talk_to_data/ipcc/plots.py
CHANGED
|
@@ -99,7 +99,7 @@ indicator_evolution_at_location_historical_and_projections: Plot = {
|
|
| 99 |
"plot_function": plot_indicator_evolution_at_location_historical_and_projections,
|
| 100 |
"sql_query": indicator_per_year_at_location_query,
|
| 101 |
"plot_information": indicator_evolution_informations,
|
| 102 |
-
"short_name": "
|
| 103 |
}
|
| 104 |
|
| 105 |
def plot_choropleth_map_of_country_indicator_for_specific_year(
|
|
@@ -180,7 +180,7 @@ choropleth_map_of_country_indicator_for_specific_year: Plot = {
|
|
| 180 |
"plot_function": plot_choropleth_map_of_country_indicator_for_specific_year,
|
| 181 |
"sql_query": indicator_for_given_year_query,
|
| 182 |
"plot_information": choropleth_map_informations,
|
| 183 |
-
"short_name": "
|
| 184 |
}
|
| 185 |
|
| 186 |
IPCC_PLOTS = [
|
|
|
|
| 99 |
"plot_function": plot_indicator_evolution_at_location_historical_and_projections,
|
| 100 |
"sql_query": indicator_per_year_at_location_query,
|
| 101 |
"plot_information": indicator_evolution_informations,
|
| 102 |
+
"short_name": "Evolution"
|
| 103 |
}
|
| 104 |
|
| 105 |
def plot_choropleth_map_of_country_indicator_for_specific_year(
|
|
|
|
| 180 |
"plot_function": plot_choropleth_map_of_country_indicator_for_specific_year,
|
| 181 |
"sql_query": indicator_for_given_year_query,
|
| 182 |
"plot_information": choropleth_map_informations,
|
| 183 |
+
"short_name": "Map",
|
| 184 |
}
|
| 185 |
|
| 186 |
IPCC_PLOTS = [
|
front/tabs/tab_ipcc.py
CHANGED
|
@@ -60,7 +60,7 @@ def show_results(sql_queries_state, dataframes_state, plots_state, table_names):
|
|
| 60 |
|
| 61 |
|
| 62 |
def show_filter_by_scenario(table_names, index_state, dataframes):
|
| 63 |
-
if len(table_names) > 0 and table_names[index_state].startswith("
|
| 64 |
df = dataframes[index_state]
|
| 65 |
scenarios = sorted(df["scenario"].unique())
|
| 66 |
return gr.update(visible=True, choices=scenarios, value=scenarios[0])
|
|
@@ -69,7 +69,7 @@ def show_filter_by_scenario(table_names, index_state, dataframes):
|
|
| 69 |
|
| 70 |
def filter_by_scenario(dataframes, figures, table_names, index_state, scenario):
|
| 71 |
df = dataframes[index_state]
|
| 72 |
-
if not table_names[index_state].startswith("
|
| 73 |
return df, figures[index_state](df)
|
| 74 |
if df.empty:
|
| 75 |
return df, None
|
|
|
|
| 60 |
|
| 61 |
|
| 62 |
def show_filter_by_scenario(table_names, index_state, dataframes):
|
| 63 |
+
if len(table_names) > 0 and table_names[index_state].startswith("Map"):
|
| 64 |
df = dataframes[index_state]
|
| 65 |
scenarios = sorted(df["scenario"].unique())
|
| 66 |
return gr.update(visible=True, choices=scenarios, value=scenarios[0])
|
|
|
|
| 69 |
|
| 70 |
def filter_by_scenario(dataframes, figures, table_names, index_state, scenario):
|
| 71 |
df = dataframes[index_state]
|
| 72 |
+
if not table_names[index_state].startswith("Map"):
|
| 73 |
return df, figures[index_state](df)
|
| 74 |
if df.empty:
|
| 75 |
return df, None
|