carolinejean-pierre commited on
Commit
4aff08b
·
1 Parent(s): b088181

Update display impact with range visualisation

Browse files
Files changed (1) hide show
  1. src/impacts.py +32 -18
src/impacts.py CHANGED
@@ -6,7 +6,7 @@ from src.utils import (
6
  format_energy_eq_electricity_production,
7
  format_energy_eq_physical_activity,
8
  format_gwp_eq_airplane_paris_nyc,
9
- format_gwp_eq_streaming,
10
  PhysicalActivity,
11
  EnergyProduction
12
  )
@@ -24,32 +24,45 @@ def display_impacts(impacts):
24
 
25
  st.divider()
26
 
27
- col_energy, col_ghg, col_adpe, col_pe, col_water = st.columns(5)
28
 
29
  with col_energy:
30
- st.markdown('<h4 align="center">⚡️ Energy</h4>', unsafe_allow_html = True)
31
- st.latex(f'\Large {impacts.energy.magnitude:.3g} \ \large {impacts.energy.units}')
32
- st.markdown(f'<p align="center"><i>Evaluates the electricity consumption<i></p>', unsafe_allow_html = True)
 
 
33
 
34
  with col_ghg:
35
- st.markdown('<h4 align="center">🌍️ GHG Emissions</h4>', unsafe_allow_html = True)
36
- st.latex(f'\Large {impacts.gwp.magnitude:.3g} \ \large {impacts.gwp.units}')
37
- st.markdown(f'<p align="center"><i>Evaluates the effect on global warming<i></p>', unsafe_allow_html = True)
 
 
 
 
 
38
 
39
  with col_adpe:
40
- st.markdown('<h4 align="center">🪨 Abiotic Resources</h4>', unsafe_allow_html = True)
41
- st.latex(f'\Large {impacts.adpe.magnitude:.3g} \ \large {impacts.adpe.units}')
42
- st.markdown(f'<p align="center"><i>Evaluates the use of metals and minerals<i></p>', unsafe_allow_html = True)
 
 
43
 
44
  with col_pe:
45
- st.markdown('<h4 align="center">⛽️ Primary Energy</h4>', unsafe_allow_html = True)
46
- st.latex(f'\Large {impacts.pe.magnitude:.3g} \ \large {impacts.pe.units}')
47
- st.markdown(f'<p align="center"><i>Evaluates the use of energy resources<i></p>', unsafe_allow_html = True)
 
48
 
49
  with col_water:
50
- st.markdown('<h4 align="center">🚰 Water</h4>', unsafe_allow_html = True)
51
- st.latex('\Large Upcoming...')
52
- st.markdown(f'<p align="center"><i>Evaluates the use of water<i></p>', unsafe_allow_html = True)
 
 
 
53
 
54
  ############################################################################################################
55
 
@@ -113,4 +126,5 @@ def display_equivalent(impacts):
113
  with col6:
114
  paris_nyc_airplane = format_gwp_eq_airplane_paris_nyc(impacts.gwp)
115
  st.markdown(f'<h4 align="center">✈️ {round(paris_nyc_airplane.magnitude):,} Paris ↔ NYC</h4>', unsafe_allow_html = True)
116
- st.markdown(f'<p align="center"><i>Based on GHG emissions<i></p>', unsafe_allow_html = True)
 
 
6
  format_energy_eq_electricity_production,
7
  format_energy_eq_physical_activity,
8
  format_gwp_eq_airplane_paris_nyc,
9
+ format_gwp_eq_streaming, range_plot,
10
  PhysicalActivity,
11
  EnergyProduction
12
  )
 
24
 
25
  st.divider()
26
 
27
+ col1, col_energy, col_ghg, col2 = st.columns([1,2,2,1])
28
 
29
  with col_energy:
30
+
31
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'>⚡️</p><p style='font-size:30px;text-align: center;margin-bottom :2px'><strong>Energy</p>""", unsafe_allow_html = True)
32
+ st.markdown(f'<p align="center">Electricity consumption</p>', unsafe_allow_html = True)
33
+ range_plot(impacts.energy.magnitude,impacts.energy_min.magnitude, impacts.energy_max.magnitude, impacts.energy.units)
34
+
35
 
36
  with col_ghg:
37
+
38
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'>🌍️</p><p style='font-size:30px;text-align: center;margin-bottom :2px'><strong>GHG Emissions</p>""", unsafe_allow_html = True)
39
+ st.markdown(f'<p align="center">Effect on global warming</p>', unsafe_allow_html = True)
40
+ range_plot(impacts.gwp.magnitude,impacts.gwp_min.magnitude, impacts.gwp_max.magnitude, impacts.gwp.units)
41
+
42
+ st.markdown(f'<br>', unsafe_allow_html = True)
43
+
44
+ col_adpe, col_pe, col_water = st.columns(3)
45
 
46
  with col_adpe:
47
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'>🪨</p>""", unsafe_allow_html = True)
48
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'><strong>Abiotic Resources</p>""", unsafe_allow_html = True)
49
+ st.markdown('<p align="center"> Use of metals and minerals</p>', unsafe_allow_html = True)
50
+ range_plot(impacts.adpe.magnitude,impacts.adpe_min.magnitude, impacts.adpe_max.magnitude, impacts.adpe.units)
51
+
52
 
53
  with col_pe:
54
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'>⛽️</p>""", unsafe_allow_html = True)
55
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'><strong>Primary Energy</p>""", unsafe_allow_html = True)
56
+ st.markdown(f'<p align="center">Use of natural energy resources</p>', unsafe_allow_html = True)
57
+ range_plot(impacts.pe.magnitude,impacts.pe_min.magnitude, impacts.pe_max.magnitude, impacts.pe.units)
58
 
59
  with col_water:
60
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'>🚰</p>""", unsafe_allow_html = True)
61
+ st.markdown(f"""<p style='font-size:30px;text-align: center;margin-bottom :2px'><strong>Water</p>""", unsafe_allow_html = True)
62
+ st.markdown(f'<p align="center">Evaluates the use of water</p>', unsafe_allow_html = True)
63
+ st.markdown(f"""<p style='font-size:35px;text-align: center'> Upcoming... </p>""", unsafe_allow_html = True)
64
+
65
+
66
 
67
  ############################################################################################################
68
 
 
126
  with col6:
127
  paris_nyc_airplane = format_gwp_eq_airplane_paris_nyc(impacts.gwp)
128
  st.markdown(f'<h4 align="center">✈️ {round(paris_nyc_airplane.magnitude):,} Paris ↔ NYC</h4>', unsafe_allow_html = True)
129
+ st.markdown(f'<p align="center"><i>Based on GHG emissions<i></p>', unsafe_allow_html = True)
130
+