pypsa-usa icon indicating copy to clipboard operation
pypsa-usa copied to clipboard

Add GitHub Action for testing of Networks

Open trevorb1 opened this issue 1 year ago • 8 comments

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

trevorb1 avatar Feb 28 '24 18:02 trevorb1

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 avatar Mar 02 '24 04:03 ktehranchi

#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.

ktehranchi avatar Mar 07 '24 07:03 ktehranchi

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

trevorb1 avatar Apr 10 '24 20:04 trevorb1

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"]

trevorb1 avatar Apr 18 '24 23:04 trevorb1

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

shankarkarki avatar Aug 25 '24 18:08 shankarkarki

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

  • The testing for valid configuration files (see also issue #382)
  • The testing of modules and functions
  • The testing of the entire workflow (ie. given specific config files, a workflow should run)

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.

trevorb1 avatar Aug 26 '24 15:08 trevorb1

@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

ktehranchi avatar Aug 30 '24 23:08 ktehranchi

On the testing of the entire workflow front, this repository may be a good reference. They give examples on how to call different config files for their CI, and how to set up simple data + config files for their tests.

trevorb1 avatar Oct 16 '24 15:10 trevorb1