GreenInfo-Network / seattle-building-dashboard

Energy benchmarking for Seattle
https://greeninfo-network.github.io/seattle-building-dashboard/
ISC License
1 stars 0 forks source link

Troubleshoot building report card records #97

Closed danrademacher closed 7 months ago

danrademacher commented 7 months ago

We’ve recently received some stakeholder feedback about bugs with the Building Reports in the Energy Benchmarking Map. Although we’re going to be overhauling the Building Reports with Stamen fairly soon, we need to resolve these bugs in the meantime. The recurring problem is that the fuel breakdown by GHG and KBtu in the report (the two horizontal bar charts near the top) is either not displaying or displaying incorrectly when complete benchmarking data is available. I’ve reviewed the data inputs from our data ecosystem (Carto_2022_Data_Extra) and they do not appear to be the source of the problem. I’ve attached some examples of the observed problems. Please take a look and let me know if you think these issues will be complicated to resolve.

ID Problem Reporting Year
21741 Building report is not displaying at all for any years All
25414 Building report is saying "We don't have enough data to show fuel use" - but building is seemingly reporting complete data. Building is all electric. Building Report is not showing fuel breakdown for 2022, but did show for 2021. 2022
338 Building is reporting complete data… displaying in building report as incomplete data 2022
338 Building report is only displaying natural gas in fuel breakdown graphic - both electricity and gas present in upload file 2021
50455 Building is not displaying complete gas data in the fuel breakdown 2021
50455 Building report is saying "We don't have enough data to show fuel use" - but building is seemingly reporting complete data. 2022
20201 Showing only gas data in the fuel breakdown 2021
127 Building report is saying "We don't have enough data to show fuel use" - but building is seemingly reporting complete data. 2022
21364 Property has steam, electricity, and gas - is not displaying fuel breakdown correctly 2022
tomay commented 7 months ago

I looked at all of these and found the following

tomay commented 7 months ago

In the meantime, the simplest thing would probably be to just download all the Carto data, manually calculate the percentages in Excel, and then reupload to Carto.

If this is to be the fix, I would recommend calculating the percentages using CARTO SQL, since this is known to be the production data, and routing this through Excel again is problematic. (In addition, I see other issues in the raw CSV from R, it includes extra line returns for some property_types for example)

tomay commented 7 months ago

Link to latest raw CSV from R: https://drive.google.com/file/d/1tcvbihcYGs2JWTfpwMiGvlyQxXp8zwPv/view?usp=drive_link

Starting from this file, as there are many columns in production CARTO that are floats represented as integers

New percent calculations: electricity_pct = (electric 3.412) / ((gas 100) + (electric 3.412) + steam) gas_pct = (gas 100) / ((gas 100) + (electric 3.412) + steam) steam_pct = steam / ((gas 100) + (electric 3.412) + steam) electricity_ghg_percent = electricty_ghg / (gas_ghg + electric_ghg + steam_ghg) gas_ghg_percent = gas_ghg / (gas_ghg + electric_ghg + steam_ghg) steam_ghg_percent = steam_ghg / (gas_ghg + electric_ghg + steam_ghg)

Steps:

Once that's done, confirm that the reports listed at the top of this issue are now correct

tomay commented 7 months ago

After new formulas, this includes additional 0's where previously there were blanks, but I don't think that's necessarily the issue here, as much as the truncation to 0/1

image

Unless buildings are reporting the raw electricity, gas, steam etc. values that go into the percentages, and they are somehow dropped/missing. But that would be upstream of this sheet, and I cannot fix that.

Update: Actually, for 2022 data, there were simply a lot of the percent calcs missing, for uknown reasons

image

tomay commented 7 months ago

Update, while I was working on this Mike sent a complete sheet with updated percentages. That's here: https://docs.google.com/spreadsheets/d/13Qz8187eB4S7PiSQj7yiAyyy-eSO3xtf_c8xIhsb5mk/edit#gid=708118130

We'll use this to update production data on CARTO

tomay commented 7 months ago

New table in CARTO is called "seattle_buildings_update_mr_20240425_final"

Planning to join in the new percents with SQL like this:

UPDATE seattle_buildings_2022_update 
SET electricity_pct = seattle_buildings_update_mr_20240425_final.electricity_pct
FROM seattle_buildings_update_mr_20240425_final
WHERE seattle_buildings_2022_update.unique_id = seattle_buildings_update_mr_20240425_final.unique_id

Unfortunately, this doesn't seem to work - probably because the existing field names are already case as integer

Looks like we have to replace the whole table.

tomay commented 7 months ago

Looking good:

image

tomay commented 7 months ago

Update:

Here’s the updated version of the file with the Electricity and Gas fields for 2015-2017 converted to kWh and Therms, respectively. The fuel breakdowns should be correct now for 2015-2017. Only the 2015-2017 files have changed.

Original XLS saved here: https://docs.google.com/spreadsheets/d/1Clm1Ust8qACUKcnQs_0ewKHWSKMx5z-o/edit?usp=drive_link&ouid=112218622749960089733&rtpof=true&sd=true

Exported to CSV (after fixing 21741 one more time), and uploaded to CARTO, file rename to replace the existing production table

tomay commented 7 months ago

Update: We traced the issue with decimal formatting back to Sheets work in 12/2023

Fixed in this file and uploaded 4/3/2024 to replace the production table on CARTO https://docs.google.com/spreadsheets/d/1k230hmEty7MtL_V1emy_5StOyl4xQUUShRTnSkbfPb0/edit#gid=1775896918

This has

OSE is working on a full update of historic data that will supersede and replace this soon