Skip to content

Commit

Permalink
Changes on generic_metric and mode_specific_metrics in relation to Mo… (
Browse files Browse the repository at this point in the history
#91)

* Changes on generic_metric and mode_specific_metrics in relation to Mode_confirm mapping with dynamic labels.

* Address Review comments.

* Update generate_plots.py & scaffolding.py

* Fix merge conflict.

* Fix scaffolding, updated mode_specific_metrics.ipynb.

* Revert version changes to 3.7.12.

* Update initialization of dynamic_labels from { } to json object referenced from example-study-label-options.json

* Default initialize dynamic_labels to { }.

* Add an environment variable in Docker Compose to pass dynamic config.

* Chang in docker-compose for STUDY_CONFIG to dev-emulator-study. Reverted changes for DYNAMIC_CONFIG back to STUDY_CONFIG from generate_plots.py

* Change back docker-compose.dev.yml: STUDY_CONFIG to stage-program.

* Replace Mode_confirm with Replaced_mode for barplot_mode() in mode_specific_metrics.ipynb

* 1. Remove extraneous whitespace from generate_plots.py. 2. Revert refactoring colour -> color in plots.py

* Remove extraneous whitespace from line 96 in generate_plots.py

* Introduce defaultdic for dic_translations with Other in analogy to dic_re in scaffolding.py.

* Handle initialization of mode_count_interest. Introduce try-except block to handle raise RuntimeError error.

* Move quality_text code into the if block in the above cell.

* Update log messages for dynamic_labels_url and label_options unavailable cases.

* Update scaffolding to introduce compute_CO2_impact_kg() computation when dynamic label is available.

* 1. Change the plots.py X-axis to showcase CO2 Impact in kg. 2. In scaffolding.py update conversion from lb to kg for final return of CO2_Impact(kg). 3. Update energy_calculations to call new function compute_CO2_impact_kg when dynamic label is available for direct kgCO2 computation.

* Move the compute_CO2_impact_kg() call to scaffolding, such that energy_impact is computed regardless.

* Changes to understand difference between default mapping and dynamic label computation for CO2 Emissions.

* Update scaffolding to create different dictionary mappings for MODE, REPLACED, and PURPOSE on the basis of the dynamic labels.

* Update Trip_purpose to To Work instead of Work whenever dynamic label is available.

* Update scaffolding.py CO2_footprint_lb() to utilize the distance while computing for different fuel types so that Mode_confirm_lb_CO2 and Replaced_mode_lb_CO2 is properly computed. The overall CO2_Impact(lb) computation remains the same. The representation in Energy Emission notebook is same.

* Update changes for generic_timeseries. 1. Inside scaffolding.py introduce new func compute_CO2_footprint_kg() to compute Mode_confirm_kg_CO2 metric only. Update distance computation to be reflected for expanded_ct['Mode_confirm_kg_CO2']. Updated generic_timeseries to showcase metrics in kg and lb for all cases- default mapping and dynamic labels. Added dynamic_labels in call to add_energy_labels.

* Create new metrics_study and metrics_program options html files without energy metrics options.

* Update index.html to use different metrics_ options html when dynamic label is available.

* Remove redundant check for dynamic_labels_urls. Update the message to show the STUDY_CONFIG associated with the success/failure message.

* Remove print statements used to evaluate the difference in energy calculations while using dynamic labels and default mapping (from auxillary_files/energy_intensity).

* Update the mode mapping in accordance to MODE for Daily Mode Share in generic_timeseries.ipynb.

* Refactor the code to load the config and corresponding metrics.html page.,

* Reinstate the comment for energy_calculations.ipynb. Removed extranneous space for generic_timeseries.ipynb. Removed extranneous space for scaffolding.py. Reverted the bumped round off value to 3. This had been bumped up to 5, to make a better comparative study between the CO2 emission computation from energy_intensity.csv and label_options. Since, the comparative changes have been reverted. This has been reverted to pre-existing round-off of 3 places.

* Update data.label_options to dynamic_labels to make it coherent across different notebook and generate_plots.py.

* Created a new function inside scaffolding.py, mapping_labels(dynamic_labels, label_type). This replaces the same/similar logic written across different notebooks. Notably called from generic_metrics notebook - load_viz_notebook_data(), and other calls from generic_timeseries. Updated generic_timeseries.ipynb to call the scaffolding.mapping_labels(dynamic_labels, label_type) to remove redundancy of same code.

* Moving the mapping_labels() call inside the conditional check for each label_type. This way, we would not be looking for REPLACED_MODE for study in label_options.

* Update the purpose mapping for Work to select from scaffolding.mapping_labels() instead of hardcoding it with translation from work to To Work.

* Update the Timeseries of emissions per miles TO Timeseries of emissions per kilometer. We are computing in kg and kilometer for generic_timeseries and energy_calculations.

* Update plots.py CO2_impact to take x and y Labels from the notebook. Update energy_calculations notebook to display Imperic way for non dynamic config, and Metric way for dynamic config. Update scaffolding to compute the CO2 emissions as lbs/mile and kg/km. Both computatoin of default mapping and dynamic config mapping will have lbs/mile and kg/km CO2 emissions.

* Update generic_timeseries to show the CO2 emissions in Imperial system for default mapping, and in Metric system for dynamic config.

* Added print statements to understand the difference in CO2 emissions for default mapping and one with dynamic config.

* Renamed 1. compute_CO2_impact_kg to compute_CO2_impact_dynamic 2. compute_CO2_footprint_kg to compute_footprint_dynamic 3. compute_CO2_impact_lb to compute_CO2_impact_default 4. compute_CO2_footprint_lb to compute_CO2_footprint_default.

* Removed the unnecessary file unde frontend/Dockerfile.dev.

* Showing Timeseries of emissions per mile for default mapping.

* Remove extranneous whitespaces from energy_calculations and generic_timeseries notebook.

* Remove whitespace from generic_timeseries.ipynb

* Fixing the scaffolding calculation for computation of conversion to kg_CO2 from lb_CO2 and vice-versa in both dynamic config and default mapping case.

* Add new function in scaffolding.py to print the computation of CO2 emissions. This will be called from energy_calculations notebook.

* Added is_debug_mode flag, which by default is set to False. When it is set to True, then the print statements associated with the CO2 emissions computation will be called from scaffolding.py print_CO2_emission_calculations(). Removed the duplicate code about print statements, and moved into scaffolding.py.

* Removed energy_impact computation for Dynamic config case.

* Update distace_miles column in the selected_columns in scaffolding.py for print_CO2_emission_calculations() function.

* Setting the default is_debug_mode flag to False. This will disable call to print the CO2 emission calculation.

* Removed redundant if/else case for different label_type inside mapping_labels() function. Refactored compute_CO2_impact_dynamic() and compute_CO2_footprint_dynamic() to compute the CO2 emission in compute_CO2_footprint_dynamic() function and differentiate between Mode_confirm and Replaced_mode CO2 emission in compute_CO2_impact_dynamic().

* Energy_calculations.ipynb added justification for computation of total_lb_CO2 emission in Dynamic Label case, and total_kg_CO2_emission in default config case.

* Refactor both energy_calculations and generic_timeseries notebook to avoid code duplication for dynamic labels and default mapping cases.

* Stored the returned expanded_ct from compute_CO2_footprint_dynamic().

* Fixed try-catch block to handle case where emissions is not defined. Re-added the removed comments.

* Fixed issue with default mapping - calling the right function. Updated prefix to the new functions to reflect its functionality.

* Remove conversion_kilometer_to_mile and vice versa in scaffolding.py CO2_footprint_default() and compute_CO2_footprint_dynamic().

* Removed f{'distance_unit'} with distance_unit for compute_daily_metrics() in generic_timeseries notebook.

* Update sense keyword in the phrase for dropdown menu for Trip miles by mode (sensed).

* Updated the comment to explain this is specically used to test with example-program-label-options for print_CO2_emission_calculations().
  • Loading branch information
iantei authored Dec 3, 2023
1 parent 1372b19 commit abab318
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 188 deletions.
55 changes: 40 additions & 15 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,22 @@
const STUDY_CONFIG = _getStudyName(window.location);
$.getJSON('https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/' + STUDY_CONFIG + '.nrel-op.json', function(data) {
// Load list of plots corresponding to study/program
if (data.intro.program_or_study=='program') {
$.get("metrics_program.html", function(response) {
dynamic_labels = data.label_options
if (data.intro.program_or_study=='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_withoutEnergyMetrics.html"
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
}
$.get(load_file, function(response) {
const configuredResponse = response.replaceAll("${data.intro.mode_studied}", data.intro.mode_studied);
$('#metric').append(configuredResponse);
addPreconfiguredMetrics([
Expand All @@ -387,19 +401,30 @@
`ntrips_${data.intro.mode_studied}_per_weekday`,
`sketch_CO2impact_${data.intro.mode_studied}`
]);
});
} else {
$('#metric').load('metrics_study.html');
addPreconfiguredMetrics([
"ntrips_mode_confirm",
"miles_mode_confirm",
"ntrips_sensed_mode",
"miles_sensed_mode",
"ntrips_purpose",
"ntrips_sensed_per_weekday",
"ts_emissions_user"
]);
};
});
}
else // CASE: STUDY
{
if (dynamic_labels)
{
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
$('#metric').load('metrics_study_withoutEnergyMetrics.html');
}
else
{
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
$('#metric').load('metrics_study.html');
};
addPreconfiguredMetrics([
"ntrips_mode_confirm",
"miles_mode_confirm",
"ntrips_sensed_mode",
"miles_sensed_mode",
"ntrips_purpose",
"ntrips_sensed_per_weekday",
"ts_emissions_user"
]);
}
// Figure out all months since start date to present
var date_options = "<option value=''>All data</option>";
const dates = getMonthList(
Expand Down
2 changes: 1 addition & 1 deletion frontend/metrics_program.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 10 miles</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 10 miles (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip miles by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip miles by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip miles by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip miles by land mode (sensed)</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (sensed)</option>
Expand Down
36 changes: 36 additions & 0 deletions frontend/metrics_program_withoutEnergyMetrics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- Replica of metrics_program.html without energy options-->
<!-- Generic -->
<option value="ntrips_mode_confirm" data-sizex="4" data-sizey="4">Number of trips</option>
<option value="ntrips_commute_mode_confirm" data-sizex="4" data-sizey="4">Number of commute trips</option>
<option value="ntrips_sensed_mode" data-sizex="4" data-sizey="4">Number of trips (sensed)</option>
<option value="ntrips_purpose" data-sizex="4" data-sizey="4">Trip count by purpose</option>
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 10 miles</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 10 miles (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip miles by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip miles by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip miles by land mode (sensed)</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (sensed)</option>
<option value="average_miles_mode_confirm2" data-sizex="6" data-sizey="4">Average trip length (selected by users)</option>
<option value="ntrips_per_day" data-sizex="6" data-sizey="4">Trip frequency</option>
<option value="ntrips_sensed_per_day" data-sizex="6" data-sizey="4">Trip frequency (sensed)</option>
<option value="ntrips_per_weekday" data-sizex="6" data-sizey="4">Trip frequency (weekday)</option>
<option value="ntrips_sensed_per_weekday" data-sizex="6" data-sizey="4">Trip frequency (weekday, sensed)</option>
<option value="ts_emissions_user" data-sizex="8" data-sizey="2">Timeseries of emissions</option>
<option value="ts_emissions_vmt" data-sizex="8" data-sizey="2">Timeseries of emissions per kilometer</option>
<option value="ts_users" data-sizex="8" data-sizey="2">Timeseries of active users</option>
<option value="ts_all_modes" data-sizex="8" data-sizey="2">Timeseries of all mode shares</option>
<!-- Mode Specific -->
<option value="ntrips_${data.intro.mode_studied}_purpose" data-sizex="4" data-sizey="4">`${data.intro.mode_studied}` specific trip count by purpose</option>
<option value="miles_${data.intro.mode_studied}_replaced_mode" data-sizex="4" data-sizey="4">`${data.intro.mode_studied}` specific trip miles by replaced mode</option>
<option value="average_miles_replaced_mode" data-sizex="4" data-sizey="4">Average Miles for each replaced mode (w/Other)</option>
<option value="ntrips_${data.intro.mode_studied}_per_day" data-sizex="6" data-sizey="4">`${data.intro.mode_studied}` specific Trip frequency</option>
<option value="ntrips_${data.intro.mode_studied}_per_weekday" data-sizex="6" data-sizey="4">`${data.intro.mode_studied}` specific Trips per weekday</option>
<option value="sketch_CO2impact_${data.intro.mode_studied}" data-sizex="6" data-sizey="4">Sketch of `${data.intro.mode_studied}` specific emission impact</option>
<option value="ts_${data.intro.mode_studied}_share" data-sizex="8" data-sizey="2">Timeseries of `${data.intro.mode_studied}` specific trips</option>
<option value="ts_${data.intro.mode_studied}_miles" data-sizex="8" data-sizey="2">Timeseries of `${data.intro.mode_studied}` specific milage</option>
<option value="ts_${data.intro.mode_studied}_miles_user" data-sizex="8" data-sizey="2">Timeseries of `${data.intro.mode_studied}` specific milage per user</option>
<option value="ts_${data.intro.mode_studied}_miles_proportion" data-sizex="8" data-sizey="2">Timeseries of proportion of `${data.intro.mode_studied}` specific miles</option>
<option value="ts_${data.intro.mode_studied}_trips_proportion" data-sizex="8" data-sizey="2">Timeseries of mileage per user</option>
<option value="ts_${data.intro.mode_studied}_trip_individual_variation" data-sizex="8" data-sizey="2">`${data.intro.mode_studied}` specific trip variation over time</option>
<option value="ts_${data.intro.mode_studied}_mile_individual_variation" data-sizex="8" data-sizey="2">`${data.intro.mode_studied}` specific mileage variation over time</option>
22 changes: 22 additions & 0 deletions frontend/metrics_study_withoutEnergyMetrics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Replica of metrics_study.html without energy option-->
<!-- Generic -->
<option value="ntrips_mode_confirm" data-sizex="4" data-sizey="4">Number of trips</option>
<option value="ntrips_commute_mode_confirm" data-sizex="4" data-sizey="4">Number of commute trips</option>
<option value="ntrips_sensed_mode" data-sizex="4" data-sizey="4">Number of trips (sensed)</option>
<option value="ntrips_purpose" data-sizex="4" data-sizey="4">Trip count by purpose</option>
<option value="ntrips_under10miles_mode_confirm" data-sizex="4" data-sizey="4">Trip count under 10 miles</option>
<option value="ntrips_under10miles_sensed_mode" data-sizex="4" data-sizey="4">Trip count under 10 miles (sensed)</option>
<option value="miles_mode_confirm" data-sizex="4" data-sizey="4">Trip miles by mode</option>
<option value="miles_sensed_mode" data-sizex="4" data-sizey="4">Trip miles by mode (sensed)</option>
<option value="miles_sensed_mode_land" data-sizex="4" data-sizey="4">Trip miles by land mode (sensed)</option>
<option value="average_miles_mode_confirm" data-sizex="6" data-sizey="4">Average trip length</option>
<option value="average_miles_sensed_mode" data-sizex="6" data-sizey="4">Average trip length (sensed)</option>
<option value="average_miles_mode_confirm2" data-sizex="6" data-sizey="4">Average trip length (selected by users)</option>
<option value="ntrips_per_day" data-sizex="6" data-sizey="4">Trip frequency</option>
<option value="ntrips_sensed_per_day" data-sizex="6" data-sizey="4">Trip frequency (sensed)</option>
<option value="ntrips_per_weekday" data-sizex="6" data-sizey="4">Trip frequency (weekday)</option>
<option value="ntrips_sensed_per_weekday" data-sizex="6" data-sizey="4">Trip frequency (weekday, sensed)</option>
<option value="ts_emissions_user" data-sizex="8" data-sizey="2">Timeseries of emissions</option>
<option value="ts_emissions_vmt" data-sizex="8" data-sizey="2">Timeseries of emissions per kilometer</option>
<option value="ts_users" data-sizex="8" data-sizey="2">Timeseries of active users</option>
<option value="ts_all_modes" data-sizex="8" data-sizey="2">Timeseries of all mode shares</option>
21 changes: 20 additions & 1 deletion viz_scripts/bin/generate_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,31 @@
dynamic_config = json.loads(r.text)
print(f"Successfully downloaded config with version {dynamic_config['version']} "\
f"for {dynamic_config['intro']['translated_text']['en']['deployment_name']} "\
f"and data collection URL {dynamic_config['server']['connectUrl']}")
f"and data collection URL {dynamic_config['server']['connectUrl'] if 'server' in dynamic_config else 'default'}")

if dynamic_config['intro']['program_or_study'] == 'program':
mode_studied = dynamic_config['intro']['mode_studied']
else:
mode_studied = None

# dynamic_labels can be referenced from
# https://github.com/e-mission/nrel-openpath-deploy-configs/blob/main/label_options/example-study-label-options.json
dynamic_labels = { }

# Check if the dynamic config contains dynamic labels 'label_options'
# Parse through the dynamic_labels_url:
if 'label_options' in dynamic_config:
dynamic_labels_url = dynamic_config['label_options']

req = requests.get(dynamic_labels_url)
if req.status_code != 200:
print(f"Unable to download dynamic_labels_url, status code: {req.status_code} for {STUDY_CONFIG}")
else:
dynamic_labels = json.loads(req.text)
print(f"Dynamic labels download was successful for nrel-openpath-deploy-configs: {STUDY_CONFIG}" )
else:
print(f"label_options is unavailable for the dynamic_config in {STUDY_CONFIG}")

if args.date is None:
start_date = arrow.get(int(dynamic_config['intro']['start_year']),
int(dynamic_config['intro']['start_month']), 1)
Expand Down Expand Up @@ -70,6 +88,7 @@ def compute_for_date(month, year):
study_type=dynamic_config['intro']['program_or_study'],
mode_of_interest=mode_studied,
include_test_users=dynamic_config.get('metrics', {}).get('include_test_users', False),
dynamic_labels = dynamic_labels,
sensed_algo_prefix=dynamic_config.get('metrics', {}).get('sensed_algo_prefix', "cleaned"))

print(f"Running at {arrow.get()} with params {params}")
Expand Down
50 changes: 36 additions & 14 deletions viz_scripts/energy_calculations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"program = \"default\"\n",
"study_type = \"program\"\n",
"mode_of_interest = \"e-bike\"\n",
"include_test_users = False"
"include_test_users = False\n",
"is_debug_mode = False\n",
"dynamic_labels = {}"
]
},
{
Expand Down Expand Up @@ -107,11 +109,12 @@
" month,\n",
" 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) if len(expanded_ct) > 0 else expanded_ct"
"expanded_ct = scaffolding.add_energy_impact(expanded_ct, df_ei, dic_fuel, dynamic_labels) if len(expanded_ct) > 0 else expanded_ct"
]
},
{
Expand Down Expand Up @@ -212,24 +215,43 @@
"metadata": {},
"outputs": [],
"source": [
"plot_title_no_quality=f\"Sketch of Total Pounds of CO2 Emissions of {mode_of_interest} trips\"\n",
"file_name =f'sketch_CO2impact_{mode_of_interest}%s' % file_suffix\n",
"\n",
"try:\n",
" ebco2=data_eb.groupby('Replaced_mode').agg({'CO2_Impact(lb)': ['sum', 'mean']},)\n",
" ebco2.columns = ['total_lb_CO2_emissions', 'average_lb_CO2_emission']\n",
"def ebco2_compute(data_eb, weight_unit):\n",
" ebco2=data_eb.groupby('Replaced_mode').agg({f'CO2_Impact({weight_unit})': ['sum', 'mean']},)\n",
" ebco2.columns = [f'total_{weight_unit}_CO2_emissions', f'average_{weight_unit}_CO2_emission']\n",
" ebco2 = ebco2.reset_index()\n",
" ebco2 = ebco2.sort_values(by=['total_lb_CO2_emissions'], ascending=False)\n",
" ebco2['boolean'] = ebco2['total_lb_CO2_emissions'] > 0\n",
" net_CO2_emissions = round(sum(ebco2['total_lb_CO2_emissions']), 2)\n",
" ebco2 = ebco2.sort_values(by=[f'total_{weight_unit}_CO2_emissions'], ascending=False)\n",
" return ebco2\n",
"\n",
" x = ebco2['total_lb_CO2_emissions']\n",
"def display_total_CO2_emissions(data_eb, weight_unit, weight_unit_debug, mode_of_interest):\n",
" plot_title_no_quality=f\"Sketch of Total {weight_unit} of CO2 Emissions of {mode_of_interest} trips\"\n",
" file_name =f'sketch_CO2impact_{mode_of_interest}%s' % file_suffix\n",
" \n",
" ebco2 = ebco2_compute(data_eb, weight_unit)\n",
" net_CO2_emissions = round(sum(ebco2[f'total_{weight_unit}_CO2_emissions']), 2)\n",
" ebco2['boolean'] = ebco2[f'total_{weight_unit}_CO2_emissions'] > 0\n",
" x = ebco2[f'total_{weight_unit}_CO2_emissions']\n",
" y = ebco2['Replaced_mode']\n",
" xLabel = f'CO2 Emissions ({weight_unit})'\n",
" yLabel = 'Replaced Mode'\n",
" color = ebco2['boolean']\n",
"\n",
" plot_title= plot_title_no_quality+f\"\\n Contribution by replaced mode towards a total of {net_CO2_emissions}(lb CO2 Emissions )\\n\"+quality_text\n",
" CO2_impact(x,y,color,plot_title,file_name)\n",
" plot_title= plot_title_no_quality+f\"\\n Contribution by replaced mode towards a total of {net_CO2_emissions}({weight_unit} CO2 Emissions )\\n\"+quality_text\n",
" CO2_impact(x,y,color,plot_title, xLabel,yLabel,file_name)\n",
" alt_text = store_alt_text_bar(pd.DataFrame(x.values,y), file_name, plot_title)\n",
"\n",
" # For debugging: Computing and displaying Total CO2 emissions in both Metric(kg) and Imperial(lb) unit system for easy comparison.\n",
" if (is_debug_mode == True):\n",
" ebco2_debug = ebco2_compute(data_eb, weight_unit_debug)\n",
" if (weight_unit == 'kg'):\n",
" scaffolding.print_CO2_emission_calculations(data_eb, ebco2_debug, ebco2, dynamic_labels)\n",
" else:\n",
" scaffolding.print_CO2_emission_calculations(data_eb, ebco2, ebco2_debug, dynamic_labels)\n",
"\n",
"try:\n",
" if (len(dynamic_labels) > 0):\n",
" display_total_CO2_emissions(data_eb,'kg','lb', mode_of_interest)\n",
" else:\n",
" display_total_CO2_emissions(data_eb,'lb','kg', mode_of_interest)\n",
"except:\n",
" generate_missing_plot(plot_title_no_quality,debug_df,file_name)\n",
" alt_text = store_alt_text_missing(debug_df, file_name, plot_title_no_quality)"
Expand Down
Loading

0 comments on commit abab318

Please sign in to comment.