Skip to content

Commit

Permalink
Merge pull request #152 from Abby-Wheelis/add-footprint-to-df
Browse files Browse the repository at this point in the history
Add base mode and footprint to the labeled trips dataframe
  • Loading branch information
shankari authored Sep 27, 2024
2 parents 5794087 + edfc6ec commit 08b9ca4
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 498 deletions.
15 changes: 5 additions & 10 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,16 +426,13 @@
});
}
else if (data.intro.program_or_study == 'program') { //CASE: PROGRAM
// Note: We're disabling energy metrics on public dashboard when dynamic labels are available.
// TODO: Remove the if (data.label_options) in future when energy computation is handled properly.
if (dynamic_labels) {
load_file = "metrics_program_withoutEnergyMetrics.html"
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
}
else {
load_file = "metrics_program.html"
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
}
load_file = "metrics_program.html"
$.get(load_file, function (response) {
const configuredResponse = response.replaceAll("${data.intro.mode_studied}", mode_studied);
console.log("configuring units");
Expand All @@ -454,15 +451,13 @@
else // CASE: STUDY
{
if (dynamic_labels) {
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
load_file = 'metrics_study_withoutEnergyMetrics.html'
// $('#metric').load('metrics_study_withoutEnergyMetrics.html');
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
}
else {
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
load_file = 'metrics_study.html'
// $('#metric').load('metrics_study.html');
};
}
load_file = 'metrics_study.html'
// $('#metric').load('metrics_study.html');
console.log("loading study, replacing units")
$.get(load_file, function (response) {
console.log("configuring units");
Expand Down
34 changes: 0 additions & 34 deletions frontend/metrics_program_withoutEnergyMetrics.html

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/metrics_study_withoutEnergyMetrics.html

This file was deleted.

1 change: 0 additions & 1 deletion viz_scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RUN /bin/bash -c "source setup/activate.sh && conda env update --name emission -
RUN mkdir -p /usr/src/app/saved-notebooks
WORKDIR /usr/src/app/saved-notebooks

COPY auxiliary_files ./auxiliary_files
COPY bin ./bin
COPY *.ipynb .
COPY *.py .
Expand Down
17 changes: 0 additions & 17 deletions viz_scripts/auxiliary_files/energy_intensity.csv

This file was deleted.

33 changes: 0 additions & 33 deletions viz_scripts/auxiliary_files/mode_labels.csv

This file was deleted.

47 changes: 0 additions & 47 deletions viz_scripts/auxiliary_files/purpose_labels.csv

This file was deleted.

1 change: 0 additions & 1 deletion viz_scripts/docker/crontab
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
0 7 * * * python bin/update_mappings.py mapping_dictionaries.ipynb >> /var/log/intake.stdinout 2>&1
0 8 * * * python bin/generate_plots.py generic_metrics.ipynb default >> /var/log/intake.stdinout 2>&1
0 8 * * * python bin/generate_plots.py generic_metrics_sensed.ipynb default >> /var/log/intake.stdinout 2>&1
0 8 * * * python bin/generate_plots.py generic_timeseries.ipynb default >> /var/log/intake.stdinout 2>&1
Expand Down
28 changes: 4 additions & 24 deletions viz_scripts/energy_calculations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,6 @@
" raise Exception(\"The plots in this notebook are only relevant to programs\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "nearby-fruit",
"metadata": {},
"outputs": [],
"source": [
"# Loading mapping dictionaries from mapping_dictionaries notebook\n",
"%store -r df_ei\n",
"%store -r dic_re\n",
"%store -r dic_pur\n",
"%store -r dic_fuel\n",
"\n",
"# convert a dictionary to a defaultdict\n",
"dic_re = defaultdict(lambda: 'Other',dic_re)\n",
"dic_pur = defaultdict(lambda: 'Other',dic_pur)\n",
"dic_fuel = defaultdict(lambda: 'Other',dic_fuel)"
]
},
{
"cell_type": "markdown",
"id": "parallel-patch",
Expand All @@ -111,11 +92,10 @@
" program,\n",
" study_type,\n",
" dynamic_labels,\n",
" dic_re,\n",
" dic_pur=dic_pur,\n",
" include_test_users=include_test_users)\n",
"# CASE 1 of https://github.com/e-mission/em-public-dashboard/issues/69#issuecomment-1256835867 \n",
"expanded_ct = scaffolding.add_energy_impact(expanded_ct, df_ei, dic_fuel, dynamic_labels) if 'Replaced_mode' in expanded_ct.columns else expanded_ct"
" include_test_users=include_test_users,\n",
" add_footprint=True)\n",
"\n",
"expanded_ct = scaffolding.unpack_energy_emissions(expanded_ct) if \"mode_confirm_footprint\" in expanded_ct.columns else expanded_ct"
]
},
{
Expand Down
Loading

0 comments on commit 08b9ca4

Please sign in to comment.