Closed trevorb1 closed 2 months ago
Chatting with @ktehranchi, likely better to turn the Write
strategies into dissagregation strategies instead, then just pass in any renaming dictionaries as kwargs
We should revisist this now that PR #247 has been merged, but not applied
Edit, Found a bug. Not done yet
Hi! I have finished this PR now, I believe. The major update (as described in the original description) is the introduction of a strategy design to handle the reading of different datasets, and the writing via different dissagregation strategies.
The high level UML is given below. Anything in color is implemented, while the white boxes show what I plan to work on next (note, WritePopulation
implements breakthrough energy population, rather than county level population).
Other notable changes in this PR are:
utcoffset()
call, and parsing of EFS was changed to vectorized operations). End results are the same, just processing logic is different. 2019
for example. Finally, the config file has been updated to reflect these changes with the following for electrical demand:
demand:
profile: efs # efs, eia
scale: 1 # efs, aeo, or a number
disaggregation: pop # pop
scenario:
efs_case: reference # reference, medium, high
efs_speed: moderate # slow, moderate, rapid
and the following for sectors
# docs :
sector:
demand:
profile:
residential: eulp # efs, eulp
commercial: eulp # efs, eulp
transport: efs # efs
industry: efs # efs
scale:
residential: aeo # efs, aeo
commercial: aeo # efs, aeo
transport: aeo # efs, aeo
industry: aeo # efs, aeo
disaggregation:
residential: pop # pop
commercial: pop # pop
transport: pop # pop
industry: pop # pop
scenarios:
aeo: reference
Okay great, this should be good to merge. @ktehranchi can you give it a quick run on your side though, please. Make sure you grab the config file demand updates! I have checked that both EFS and EIA data produce the same results from before this PR.
For future reference, I will just leave what I see the pros and cons of this method (expanded from initial PR description):
Pros of this method are:
Cons of this method are:
Changes proposed in this Pull Request
Description
Suggestion to implement a strategy design to work with demand data. This is hopfully a little more extensible for when new demand sources are added for any sector. Im not saying we merge this, just meant to get a conversation going on how to deal with new datasets as they pop up!
In this example I only implement the reading and writing of EIA data (where writing is really just parsing). I think the reading is fairly clean, however, the writing probably needs a little work. I am not super familiar with how to dissagregation happens between different sources. So maybe instead of of a
WriteEia
strategy, it should be more along the lines of dissagregation strategies (based on BA, states, regions, population, ect...) or by sector. @ktehranchi may have better insights here!Or maybe this just over complicates demand. haha. It would just be nice to reuse the demand module to pull heat demand (and eventually transport demand) data, which I think this module should allow.
Adding New Data
To read in a new dataset, the user will:
ReadStrategy
class (ie.ReadEfs
)_read_data(...)
and_format_data(...)
for the new class_format_data(...)
method must output long formatted data (with column labels ofHOUR
,REGION
,YEAR
,FUEL
,SECTOR
. However, format and labels are def up for discussion!To write out a new dataset, the user will:
WriteStrategy
class (ie.WriteEfs
) -- As noted above, this should maybe be changed to dissagregation methods rather than tied to datasets.update_load_dissagregation_names(..)
andget_demand_buses(..)
methodsExample
Other Notes
Pros of this method are:
Cons of this method are:
Checklist
envs/environment.yaml
.config.default.yaml
.doc/configtables/*.csv
.