Commit 5784357d authored by Samuël Weber's avatar Samuël Weber
Browse files

Clean, layout work, add contribution graph, etc.

parent 082cee35
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd
......@@ -284,10 +285,9 @@ def get_profile_component():
profile_component = html.Div(
id="tab-concentration",
children=[
dcc.Markdown(
html.H3(
"""Dispersion of the concentration of specie in factor from the
constrained run of all sites.""",
className="helping-text"
),
dcc.Graph(
id="concentration-graph",
......@@ -305,6 +305,14 @@ def get_uncertainty_component():
uncertainty_component = html.Div(
id="uncertainty-component",
children=[
dcc.Markdown("""
### Uncertainties of the PMF results
The uncertainties are estimated thanks to the *Bootstrap* (`BS-`) and *Displacement* (`DISP-`) methods.
Select of PMF factor in the `Sources` dropdown and one specie in the `Species` dropdown to see the uncertainties.
The *base run* is the reference value, used herafter in this study.
"""),
dcc.Graph(
id="uncertainty-graph-conc",
figure={'data': [], 'layout': {'title': 'Uncertainties'}}
......@@ -322,6 +330,18 @@ def get_deltatool_component():
children=[
html.Div(
children=[
dcc.Markdown(
"""
### Deltatool-like plot
The PD (Pearson distance) and SID (standardized identity distance) are two
metrics to evaluate the similarity between two profiles. Here, every possible
pairs of profiles are compared when they belong to the same category.
The green rectangle highlights the "acceptable area" PD < 0.4 and SID < 1 as
suggested by [Pernigotti & Belis
(2018)](http://fairmode.jrc.ec.europa.eu/document/fairmode/WG3/DeltaSA_tool_for_source_apportionment.pdf).
"""
),
html.Label('Display: '),
dcc.RadioItems(
id="deltatool-options",
......@@ -347,54 +367,47 @@ def get_deltatool_component():
'y1': 0.6,
'line': {
'width': 0,
},
},
'fillcolor': 'rgba(0, 255, 0, 0.1)',
}
]
}
}
]
}
)
}
)
]
),
html.Div(
html.Div(
id="deltatool-description",
children=[
dcc.Markdown(
"""
### Deltatool-like plot
The PD (Pearson distance) and SID (standardized identity distance) are two
metrics to evaluate the similarity between two profiles. Here, every possible
pairs of profiles are compared when they belong to the same category.
The green rectangle highlights the "acceptable area" PD < 0.4 and SID < 1 as
suggested by [Pernigotti & Belis
(2018)](http://fairmode.jrc.ec.europa.eu/document/fairmode/WG3/DeltaSA_tool_for_source_apportionment.pdf).
"""
)
],
)
)
]
)
)
return deltatool_component
def get_specie_repartition_component():
specie_repartition_component = html.Div(
id="specie-repartition-component",
children=[
dcc.Loading(
dcc.Graph(
id="repartition-graph",
figure={
'data': [],
'layout': {
'title': 'Specie repartition among factors (Loading...)',
}
}
)
html.Div(
children=dcc.Markdown("""
### Species repartition among factors
Theses barplot express how much is apportioned each species by each factors, normalized to 100%. It may take some time to generate.
"""),
),
html.Div(
id="specie-repartition-component",
children=[
dcc.Loading(
dcc.Graph(
id="repartition-graph",
figure={
'data': [],
'layout': {
'title': 'Specie repartition among factors (Loading...)',
}
}
)
)
]
)
])
]
)
return specie_repartition_component
def get_op_beta_component():
......@@ -405,7 +418,14 @@ def get_op_beta_component():
model_component = html.Div(
id="model-component",
children=[
html.H3("Intrinsic OP of the PMF factors"),
dcc.Markdown("""
### Intrinsic OP of the PMF factors
The intrinsic OP is how much the OP would increase if we increase 1 µg.m⁻³ of the given source. They are the coefficients from the MLR model.
You can select several PMF factor (`Sources` dropdown) and OP (`OP` dropdown) at a time.
The values reported here are the mean and standard deviation of the 500 boostraps of the solution, with randomly selected 70% of the input dataset each time.
"""),
dcc.Loading(
dcc.Graph(
id="beta-coefficient-graph",
......@@ -434,10 +454,10 @@ def get_op_contribution_component():
options=[
{'label': 'Daily barplot', 'value': 'daily'},
{'label': 'Seasonal barplot', 'value': 'seasonal'},
{'label': 'Daily timeserie', 'value': 'ts'}
],
value='daily',
),
dcc.Markdown("**Daily** present the mean and median daily contribution and **seasonal** aggregated it by season (DJF, MAM, JJA, SON). The values of all factors from all the selected stations are taken into account for this plot."),
dcc.Loading(
dcc.Graph(
id="op-contribution-graph",
......@@ -451,6 +471,45 @@ def get_op_contribution_component():
)
return contribution_component
def get_op_contribution_ts_component():
component = html.Div(
id="op-contribution-ts-component",
children=[
html.H3("Contribution of PMF factors to the OP (timeserie per site)"),
dcc.RadioItems(
id='op-contribution-ts-plottype',
className='options-items',
options=[
{'label': 'Daily timeserie', 'value': 'daily'},
{'label': 'Monthly timeserie', 'value': 'monthly'},
{'label': 'Quaterly timeserie', 'value': 'quaterly'},
],
value='monthly',
),
html.Br(),
dcc.RadioItems(
id='op-contribution-ts-estimator',
className='options-items',
options=[
{'label': 'Mean', 'value': 'mean'},
{'label': 'Median', 'value': 'median'}
],
value='median',
),
dcc.Markdown("**Daily** is the daily reconstructed OP from the regression model. **Monthly** (mean or median) are the monthly aggregated mean or median for each station. **Quaterly** is the seasonal (4 seasons: DJF, MAM, JJA, SON) mean or median aggratation per station. This plot may take some time to generate..."),
dcc.Loading(
dcc.Graph(
id="op-contribution-ts-graph",
figure={
'data': [],
'layout': {'title': 'OP contribution timeseries (Loading...)'}
}
)
)
]
)
return component
def get_map_component(stations):
"""TODO: Docstring for get_map_component.
......@@ -474,6 +533,16 @@ def get_map_component(stations):
return map_component
def get_about_app_results_component():
component = dbc.Row(
dbc.Col(
width=12, sm=12, md=11, lg=10, xl=9,
children=dcc.Markdown(open("how_to.mdwn", "r").read(), dangerously_allow_html=True)
),
justify="center",
)
return component
def about_graph_source_contribution():
station_order = ["REV", "MRS", "PdB", "PROV", "NIC", "TAL", "POI", "LEN",
"NGT", "ROU", "LY", "GRE", "CHAM", "RBX", "STRAS"]
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,16 +2,24 @@
width: 95%;
}
#map-component {
margin: 20px 0px;
/* height: 200px; */
display: block;
#main {
margin-top: 10px;
}
.text {
display: block;
#main h2 {
color: darkmagenta;
}
#main h3 {
color: darkolivegreen;
}
.equation {
text-align: center;
}
.text {
display: block;
}
.helping-text {
......
## How to use it?
This dashboard let you interactively plot different informative results obtain in this research program.
For the context and discussion of the results, we invite you to read the
manuscript of [Weber et al. 2020]() that present this work.
Different kind of plot are available and listed on the left. For most of them,
you can choose which variables you would like to plot from the dropdown lists at the top panel.
All plots are interactive. You can zoom in, hover data to get more info, and updated automatically.
Some of them may take some time to render, so be patient (few seconds).
### Raw data
This part present the raw signal of the input variables selected on the top panel.
Notably, you can select the PMF factor for each site and the OP measurements.
* **Timeserie**: Line plot of the concentration, the `x` axis being the date;
* **Monthly**: Aggregated monthly boxplot or barplot;
* **Seasonal**: Aggregated seasonal (4 seasons: DJF, MAM, JJA, SON) boxplot or barplot.
### PMF (Positive Matrix Factorization)
This part present the results of the PMF studies used as input variable for the
attribution of the OP to the PM sources.
* **Profiles**: display the species concentration in each selected PMF profile (in µg/µg or in µg/m⁻³);
* **DeltaTool**: plot each profile of each stations against the other similar profile, to assess the chemical similarity of the different profiles, following the approach proposed by
[Pernigotti & Belis, 2018](https://doi.org/10.1016/j.atmosenv.2018.02.046).
* **Uncertainties**: give an estimation of the uncertainties of the profiles species concentration thanks to both the *Bootstrap* and *Displacement* estimates of the EPA PMF5 software.
* **Species repartition**: display what fraction of each species are apportioned by each PMF factors.
### OP (Oxidative Potential)
This part is the results of the multiple linear regression (MLR) of the PMF
factors against the OP<sup>AA</sup> and OP<sup>DTT</sup> measurements, following
the equation:
<p class="equation">
OP<sub>obs</sub> = G × β + ε
</p>
where G is the contribution of each factor given by the PMF, OP is the observed OP
(DTT or AA), β is the *intrinsic OP* and ε the residual term.
* **Intrinsic OP**: display the intrinsic OP (i.e. coefficient of the MLR)
for each PMF factor at each site, together with their uncertainties;
* **OP contribution (all)**: give the overall PMF factor contribution to the
OP (daily and seasonal mean or median), taking into account all the selected
site;
* **OP contribution (timeseries)**: display individual timeseries of the PMF
factor contribution to the OP. You can select to see the daily contribution
or the monthly or season mean and median contribution.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment