|
from climateqa.engine.talk_to_data.drias.config import DRIAS_INDICATOR_TO_UNIT |
|
|
|
def indicator_evolution_informations( |
|
indicator: str, |
|
params: dict[str, str] |
|
) -> str: |
|
unit = DRIAS_INDICATOR_TO_UNIT[indicator] |
|
if "location" not in params: |
|
raise ValueError('"location" must be provided in params') |
|
location = params["location"] |
|
return f""" |
|
This plot shows how the climate indicator **{indicator}** evolves over time in **{location}**. |
|
|
|
It combines both historical observations and future projections according to the climate scenario RCP8.5. |
|
|
|
The x-axis represents the years, and the y-axis shows the value of the indicator ({unit}). |
|
|
|
A 10-year rolling average curve is displayed to give a better idea of the overall trend. |
|
|
|
**Data source:** |
|
- The data come from the DRIAS TRACC data. The data were initially extracted from [the DRIAS website](https://www.drias-climat.fr/drias_prod/accueil/okapiWebDrias/index.jsp?iddrias=climat) and then preprocessed to a tabular format and uploaded as parquet in this [Hugging Face dataset](https://huggingface.co/datasets/timeki/drias_db). |
|
- For each year and climate model, the value of {indicator} in {location} is collected, to build the time series. |
|
- The coordinates used for {location} correspond to the closest available point in the DRIAS database, which uses a regular grid with a spatial resolution of 8 km. |
|
- The indicator values shown are those for the selected climate model. |
|
- If ALL climate model is selected, the average value of the indicator between all the climate models is used. |
|
""" |
|
|
|
def indicator_number_of_days_per_year_informations( |
|
indicator: str, |
|
params: dict[str, str] |
|
) -> str: |
|
unit = DRIAS_INDICATOR_TO_UNIT[indicator] |
|
if "location" not in params: |
|
raise ValueError('"location" must be provided in params') |
|
location = params["location"] |
|
return f""" |
|
This plot displays a bar chart showing the yearly frequency of the climate indicator **{indicator}** in **{location}**. |
|
|
|
The x-axis represents the years, and the y-axis shows the frequency of {indicator} ({unit}) per year. |
|
|
|
**Data source:** |
|
- The data come from the DRIAS TRACC data. The data were initially extracted from [the DRIAS website](https://www.drias-climat.fr/drias_prod/accueil/okapiWebDrias/index.jsp?iddrias=climat) and then preprocessed to a tabular format and uploaded as parquet in this [Hugging Face dataset](https://huggingface.co/datasets/timeki/drias_db). |
|
- For each year and climate model, the value of {indicator} in {location} is collected, to build the time series. |
|
- The coordinates used for {location} correspond to the closest available point in the DRIAS database, which uses a regular grid with a spatial resolution of 8 km. |
|
- The indicator values shown are those for the selected climate model. |
|
- If ALL climate model is selected, the average value of the indicator between all the climate models is used. |
|
""" |
|
|
|
def distribution_of_indicator_for_given_year_informations( |
|
indicator: str, |
|
params: dict[str, str] |
|
) -> str: |
|
unit = DRIAS_INDICATOR_TO_UNIT[indicator] |
|
year = params["year"] |
|
if year is None: |
|
year = 2030 |
|
return f""" |
|
This plot shows a histogram of the distribution of the climate indicator **{indicator}** across all locations for the year **{year}**. |
|
|
|
It allows you to visualize how the values of {indicator} ({unit}) are spread for a given year. |
|
|
|
**Data source:** |
|
- The data come from the DRIAS TRACC data. The data were initially extracted from [the DRIAS website](https://www.drias-climat.fr/drias_prod/accueil/okapiWebDrias/index.jsp?iddrias=climat) and then preprocessed to a tabular format and uploaded as parquet in this [Hugging Face dataset](https://huggingface.co/datasets/timeki/drias_db). |
|
- For each grid point in the dataset and climate model, the value of {indicator} for the year {year} is extracted. |
|
- The indicator values shown are those for the selected climate model. |
|
- If ALL climate model is selected, the average value of the indicator between all the climate models is used. |
|
""" |
|
|
|
def map_of_france_of_indicator_for_given_year_informations( |
|
indicator: str, |
|
params: dict[str, str] |
|
) -> str: |
|
unit = DRIAS_INDICATOR_TO_UNIT[indicator] |
|
year = params["year"] |
|
if year is None: |
|
year = 2030 |
|
return f""" |
|
This plot displays a choropleth map showing the spatial distribution of **{indicator}** across all regions of France for the year **{year}**. |
|
|
|
Each region is colored according to the value of the indicator ({unit}), allowing you to visually compare how {indicator} varies geographically within France for the selected year and climate model. |
|
|
|
**Data source:** |
|
- The data come from the DRIAS TRACC data. The data were initially extracted from [the DRIAS website](https://www.drias-climat.fr/drias_prod/accueil/okapiWebDrias/index.jsp?iddrias=climat) and then preprocessed to a tabular format and uploaded as parquet in this [Hugging Face dataset](https://huggingface.co/datasets/timeki/drias_db). |
|
- For each region of France, the value of {indicator} in {year} and for the selected climate model is extracted and mapped to its geographic coordinates. |
|
- The regions correspond to 8 km squares centered on the grid points of the DRIAS dataset. |
|
- The indicator values shown are those for the selected climate model. |
|
- If ALL climate model is selected, the average value of the indicator between all the climate models is used. |
|
""" |