-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demand mapping #717
Demand mapping #717
Conversation
Minor merge conflicts to resolve. All Travis / fast tests pass, with the exception of the known non_net_metering_eia861 duplicate rows issue. Also had to re-format docstrings in demand_mapping.py
Codecov Report
@@ Coverage Diff @@
## sprint22 #717 +/- ##
============================================
- Coverage 74.39% 71.22% -3.17%
============================================
Files 39 39
Lines 4639 4819 +180
============================================
- Hits 3451 3432 -19
- Misses 1188 1387 +199
Continue to review full report at Codecov.
|
Hey @yashkumar1803 it's not technically part of this PR, but I do want to check in about a few things in the most recent version of your notebook, over in the demand mapping repo.
pudl_settings = pudl.workspace.setup.get_defaults()
pudl_engine = sa.create_engine(pudl_settings['pudl_db'])
pudl_out = pudl.output.pudltabl.PudlTabl(pudl_engine)
# Get the county level Census geometries / data:
county_gdf = pudl.analysis.service_territory.get_census2010_gdf(pudl_settings, layer="counties")
ferc714_out = pudl.output.ferc714.Respondents(pudl_out)
ba_county_map = ferc714_out.georef_counties()
# FERC 714 hourly demand data:
dhpa_ferc714 = pudl_out.demand_hourly_pa_ferc714()
|
…ggregation criteria
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get to everything, but there's a lot here already. We should probably merge it, but keep working on the module as a whole in smaller chunks, one function at a time.
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']) | ||
|
||
|
||
def uncovered_area_mismatch(disagg_geom, total_geom, title="Area Coverage (By Planning Area)"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the notebook output for this map, the PJM territory seems vastly overrepresented, since there are several FERC 714 respondent IDs that have been assigned to the PJM EIA ID. However, only one of them has any demand associated with it. Would it make sense to exclude any area that doesn't have any reported demand at all in the year in question from consideration? Probable sometime early on -- the annualized()
version of the FERC714 respondents output includes the annual sum of that respondent's reported demand.
|
||
def error_heatmap(alloc_df, actual_df, demand_columns, region_col="pca", error_metric="r2", leap_exception=False): | ||
""" | ||
Create heatmap of 365X24 dimension to visualize the annual hourly error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function does a very particular thing, and I think it might be better separated into a few smaller functions that are more reusable -- like one which, given a year of hourly data (a Datetime index + a data column) makes a heatmap, and another separate one which takes 2 hourly demand allocations and calculates the delta between them, the output for which can be fed into the plotting function. That we we can make other 365 x 24 heatmaps to show other kinds of variables that make sense that way too.
Visually, can we scale it down so it fits on one screen? I think the Y-axis can also be simplified to have day-of-year (integer) as the labels. Could label every 7 days to highlight the weekly pattern? Could just have the first letters of the months JFMAMJJASOND. Allowing the UTC time to be localized for display so that the zero hour is local zero would also be good, since it would make the familiar diurnal pattern clearer, and allow uniform visual comparison between different plots of this type.
Added `pudl.analysis.demand_mapping.sales_ratio_by_class_fips()` function which uses the EIA 861 Sales and Service Territory tables to estimate the breakdown of electricity sales to residential, commercial, industrial, and transportation customers in each year and county. Closes #720
…ive/pudl into demand_mapping
* Along with the county geometries, bring in county area and population in the `pudl.analysis.service_territory.add_geometry()` function. This means calculating the true areas of the counties in a projected (equal area) coordinate system. * When service territory geometries are being dissolved, sum the areas and populations similarly to keep them self-consistent. * In the FERC 714 territory demand summary method, also make sure that the population and area are available, and calculate some informative ratios (population density, demand per unit area, and demand per capita) for use in identifying bad service territory geometries. * Add the mccabe Flake8 plugin to the pudl-dev to calculate function complexity Progress toward #716
Added new visualization functions, which can be analyzed in the electricity-demand-mapping repo