PyPSA / pypsa-usa

PyPSA-USA: An Open-Source Energy System Optimization Model for the United States
https://pypsa-usa.readthedocs.io
MIT License
52 stars 20 forks source link

Add GitHub Action for testing of Networks #207

Open trevorb1 opened 7 months ago

trevorb1 commented 7 months ago

Feature Request

Similar to PyPSA-Eur implementation here, adding in a GitHub action to test network configurations would be good.

Suggested Solution

No response

Additional Info

No response

ktehranchi commented 7 months ago

9777d41d260933686baf58d11e56e377063f7e90 created main.yml file for github CI actions. Pulled directly from PyPSA-EUR with modification for our repo.....

Workflow fails- I disabled the action workflow until we spend time to fix the issues

ktehranchi commented 7 months ago

208 fixed the issue with the action not running.... Now I'm looking at the way we call the .test.sh script.... currently when you want to run a specific config.****.yaml you need to change the snakemake file to uncomment out the config you want to use...

We need to change this so the config is called directly from the snakemake run command.

trevorb1 commented 5 months ago

While this does not test the networks, the Calliope team showcase a nice way of validating all configuration files against standardized schemas, here

trevorb1 commented 5 months ago

Chatting with @ktehranchi, a potential way of testing workflow functionality is to:

  1. For each test config, supply the existing intermediate network files
  2. Generate new network files for the proposed changes (not sure how we go about this)
  3. Test dataframes against one another
import pypsa 
from pandas.testing import assert_frame_equal

n_fixture = pypsa.Network(fixture.nc)
n_new = pypsa.Network(new.nc)

assert_frame_equal(n_fixture.loads_t["p_set"], n_new.loads_t["p_set"]
shankarkarki commented 1 month ago

Is this still opened? I think I can work on this.

trevorb1 commented 1 month ago

@shankarkarki - it is still open! It does feels like a few things have been discussed in this thread, that may be worth breaking out:

May be worth breaking this out into separate issues to facilitate discussion on each topic. Replicating the PyPSA-Eur testing of the workflow (ie. item 3) for PyPSA-USA would probably be doable! But maybe @ktehranchi has other thoughts.

ktehranchi commented 1 month ago

@shankarkarki let me know if you would like to chat about this issue! I agree with trevor on breaking out this ticket. A good place to start would be to reference the testing set up in pypsa-eur for inspiration