Skip to content

Merge improvements from SWITCH-WECC #143

Open
@staadecker

Description

@staadecker

This issue will serve as a central point to discuss merging the issues from the SWITCH WECC repo.
As of now the plan is as follows.

Action plan

  1. Move the SWITCH WECC latest version into a wecc branch in this repo.
  2. Move all wecc specific files into a wecc package.
  3. Create branches master-with-black-formatted-history and wecc-with-black-formatted-history which are the master and wecc branches rewritten but with their history modified such that every commit is formatted according to black. This reduces merge conflicts in the next step (see notes on how this was done below).
  4. Merge master into wecc
  5. Create merge requests one after another to include the changes from the wecc branch into the main branch as small features. These merge requests will have to be merged more or less in order. See chart below.

WECC features to include into master

  • Graph generation (status: not started)
  • Auto input data loading (status: not started)
  • Tracking of other GHGs (status: not started)
  • Variable scaling for numerical properties (status: not started)
  • Addition of documentation (status: not started)
  • Addition of switch drop tool (status: not started)
  • Addition on some dual values in the output (status: not started)
  • Improving README and docs (e.g. switch to .md format) (status: not started)
  • Include wecc folder for others to see / use (status: not started)
  • New policy modules (status: not started)
  • Add switch compare (status: not started)

master features to include in WECC

  • Specification of dimen in set definition

Conflicting changes

  • Changes related to simultaneous upgrade to latest version of Pyomo
  • Use of ordered=False in wecc but unique_list in master
  • wecc specific examples e.g. ca_policies or stochastic example
  • config.yaml approach to generating scenarios

Notes

Process for creating master-with-black-formatted-history and wecc-with-black-formatted-history

This is achieved with the following commands in Powershell.

  1. Run git merge-base wecc master to find the commit where the two branches first diverged.

  2. Checkout that commit on a new branch called common-wecc-parent.

  3. Reformat the code with black --fast -t py310 --extend-exclude 'switch_wecc/wecc' ./switch_model and make a new commit.

  4. Checkout master on switch to a new branch master-with-black-formatted-history.

  5. Run git rebase --rebase-merges --exec "black --fast -t py310 --extend-exclude 'switch_wecc/wecc' ./switch_model; git commit -a --amend --allow-empty" common-wecc-parent
    a. The --rebase-merges ensures we keep the topography of the merges
    b. The --exec "black --fast -t py310 --extend-exclude 'switch_wecc/wecc' ./switch_model; git commit -a --amend --allow-empty" means that after every commit, we amend the commit such that the switch_model files are reformatted.

  6. This will generate significant merge conflicts. For each one run
    a. git restore --theirs -s REBASE_HEAD . to update the local files to the commit that is being applied.
    b. black --fast -t py310 --extend-exclude 'switch_wecc/wecc' ./switch_model to reformat the files.
    c. git add . to mark any conflicts as resolved.
    d. git rebase --continue to continue with the rebase. To avoid the popup to edit the commit message see instructions here.
    To make these commands automatically run up to 100 times in a loop, in Powershell simply run
    1..10 | % {git restore --theirs -s REBASE_HEAD . ; black --fast -t py310 --extend-exclude 'switch_wecc/wecc' ./switch_model ; git add . ; git rebase --continue}

  7. Check that there are no differences between master-with-black-formatted-history and master (you might need to run black on master)

  8. Redo step 4 to 7 but for the wecc branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions