Source code for diva.gui.service_streamlit.tab2

# Copyright 2024 Mews
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.

import streamlit as st


[docs] def main(tab2_options): """ Defines the content and layout of Tab 2, which includes documentation and examples for using the DIVA application. This function sets up the user interface for Tab 2, providing examples of natural language queries, links to documentation, and information about the available data within the DIVA package. It includes code snippets, links to external resources, and a summary of data availability. Parameters: ---------- tab2_options : dict A dictionary containing options related to the current tab. (Not currently used in this function.) Returns: ------- None """ # ------------------------ st.title("DIVA Demonstrator Overview") url = "https://destination-earth.eu/" st.markdown(f"""DIVA is part of the [Destination Earth]({url}) initiative, funded by the European Commission and implemented by ECMWF, ESA and EUMETSAT. DIVA is a demonstrator which has been designed to showcase how the Destination Earth platform and its data can be effectively utilized. As a demonstrator, DIVA focuses on providing practical examples and technological demonstration rather than achieving full performance for end-users. DIVA has been designed to empower journalists - and more generally non-expert users - to easily access complex data and generate/download graphical illustration on past and future climate-related analysis. DIVA is not an operational service. This project have been developed my Mews Labs with the contribution from several journalists. """) html_url = "http://diva.destine.eurobios.com:8000/index.html" st.markdown( f"For detailed documentation of the DIVA package, please refer to [THIS LINK]({html_url})", unsafe_allow_html=True, ) st.markdown( "This is an AI-powered chatbot designed to assist you. All interactions are generated by an advanced language model.", unsafe_allow_html=True) # ------------------------ st.divider() st.title("Information about data") st.write( "⚠️ The latest available data date from 2023-12-31. All dates after this one are considered as projections." ) st.subheader("Available variables") cols = st.columns(2) with cols[0]: st.code("Temperature", language=None) with cols[1]: st.code("Wind", language=None) cols = st.columns(2) with cols[0]: st.code("Precipitation", language=None) with cols[1]: st.code("Pressure", language=None) st.subheader("Data availability period") st.write("**History**") cols = st.columns(4) with cols[0]: st.code("From") with cols[1]: st.code("01-01-1970", language="python") with cols[2]: st.code("To") with cols[3]: st.code("31-12-2023", language="python") st.write("**Projection**") cols = st.columns(4) with cols[0]: st.code("From") with cols[1]: st.code("2024", language="python") with cols[2]: st.code("To") with cols[3]: st.code("2039", language="python") cols = st.columns(2) with cols[0]: st.subheader("Data source - Past") link = "https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview" st.write( f"- **:violet[Temperature | Wind | Pressure | Precipitation]** : *ERA5 hourly data on single levels from 1940 to present*. " f"Available at: [THIS LINK]({link})" ) with cols[1]: st.subheader("Data source - Projection") link = "https://cacheb.dcms.destine.eu/d1-climate-dt/ScenarioMIP-SSP3-7.0-IFS-NEMO-0001-high-sfc-v0.zarr" st.write( f"- **:violet[Temperature | Wind]** : *From Cache B. On: {link}*") link = "https://cds.climate.copernicus.eu/datasets/sis-hydrology-meteorology-derived-projections?tab=overview" st.write( "- **:violet[Precipitation]** : *Temperature and precipitation climate impact indicators from 1970 to 2100 derived from European climate projections*. " f"Available at: [THIS LINK]({link})" ) link = "https://cds.climate.copernicus.eu/datasets/projections-cmip6?tab=overview" st.write( "- **:violet[Pressure]** : *CMIP6 climate projections*. " f"Available at: [THIS LINK]({link})" ) link = "https://destine.ecmwf.int/climate-change-adaptation-digital-twin-climate-dt/#1730797255342-9325b8df-088d" st.write( f"You can find more information on the Climate Digital Twin [HERE]({link})" ) # shapefiles st.subheader("Data source - Shapefiles") linkshp_cntr = "https://ec.europa.eu/eurostat/web/gisco/geodata/statistical-units/territorial-units-statistics" st.write( "- **:violet[Shapefile for countries]** : *Territorial units for statistics (NUTS)*. " f"Available at: [THIS LINK]({linkshp_cntr})" ) linkshp_cities = "https://ec.europa.eu/eurostat/web/gisco/geodata/statistical-units/local-administrative-units" st.write( "- **:violet[Shapefile for cities]** : *Local administrative units (LAU)*. " f"Available at: [THIS LINK]({linkshp_cities})" ) linkshp_uk = "https://data.cambridgeshireinsight.org.uk/dataset/major-towns-and-cities" st.write( "- **:violet[Shapefile for UK cities]** : *Major Towns and Cities*. " f"Available at: [THIS LINK]({linkshp_uk})" ) st.divider() cols = st.columns(2) with cols[0]: st.subheader("Available chart types") st.write( "- **:blue[line chart]** : A graph that displays data points connected by a continuous line, ideal for showing trends over time." ) st.write( "- **:blue[bar chart]** : A chart that represents data with rectangular bars, useful for comparing quantities across categories." ) st.write( "- **:blue[histogram]** : A plot that shows the distribution of a dataset by grouping data into bins, commonly used to understand the frequency distribution." ) st.write( "- **:blue[box plot]** : A graphical representation of the distribution of a dataset, displaying the median, quartiles, and potential outliers." ) st.write( "- **:blue[heatmap]** : A data visualization technique that uses color to represent the magnitude of values in a matrix, often used to identify patterns or correlations." ) st.write( "- **:blue[warming stripes]** : A data visualization technique that representation of data in a minimalist, intuitive style illustrating the acceleration of global warming." ) with cols[1]: st.subheader("Available aggregation types") st.write( "- **:blue[raw data]** : The original data as collected, without any aggregation or transformation." ) st.write( "- **:blue[daily]** : Data aggregated on a daily basis, summarizing the information for each individual day." ) st.write( "- **:blue[weekly]** : Data aggregated on a weekly basis, combining and summarizing information across seven-day periods." ) st.write( "- **:blue[monthly]** : Data aggregated on a monthly basis, providing a summary of data for each month." ) st.write( "- **:blue[yearly]** : Data aggregated on a yearly basis, summarizing the information for each calendar year." ) html_url = "http://diva.destine.eurobios.com:8000/catalogue_figs.html" st.markdown( f"Take a look at the catalogue of figure types available [THIS LINK 🔗]({html_url})", unsafe_allow_html=True, ) st.subheader("Data availability zone") path_map_europe = "../images/zone_europe_data.png" st.image(path_map_europe, width=1000) st.title("Examples") st.code("Show me the temperature during 2018 in Rome", language=None) st.code("the temperature from 1990 to 2050 in Rome", language=None) ex_discussion = """ 🙋‍♂️: Show me the temperature from january to september 2016 🖥️: Thank you for your request, I can give you a graphical view of the temperature. Could you please precise me where you want to make the study ? 🙋‍♂️: I want it in Frascati 🖥️: #Display Graph """ st.code(ex_discussion, language=None)