From 7685a69003650ef82b85c894d233e785c61d2bab Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 11:52:26 -0600 Subject: [PATCH 01/36] hotfix --- examples/02_onshore/inputs/ard_system.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/02_onshore/inputs/ard_system.yaml b/examples/02_onshore/inputs/ard_system.yaml index 90601197..c77fd5fc 100644 --- a/examples/02_onshore/inputs/ard_system.yaml +++ b/examples/02_onshore/inputs/ard_system.yaml @@ -18,10 +18,14 @@ modeling_options: turbine: !include turbine_spec_IEA-3p4-130-RWT.yaml collection: max_turbines_per_string: 8 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" solver_name: "highs" solver_options: time_limit: 60 - mip_gap: 0.005 + mip_gap: 0.02 offshore: false floating: false From 86858a24cf952ecb0b543d3adcd1952d58e68651 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 13:09:15 -0600 Subject: [PATCH 02/36] add the actual hotfix --- examples/02_onshore/optimization_demo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/02_onshore/optimization_demo.py b/examples/02_onshore/optimization_demo.py index 3f020ae5..648ad3e7 100644 --- a/examples/02_onshore/optimization_demo.py +++ b/examples/02_onshore/optimization_demo.py @@ -28,7 +28,7 @@ def run_example(): test_data = { "AEP_val": float(prob.get_val("AEP_farm", units="GW*h")[0]), "CapEx_val": float(prob.get_val("tcc.tcc", units="MUSD")[0]), - "BOS_val": float(prob.get_val("landbosse.total_capex", units="MUSD")[0]), + "BOS_val": float(prob.get_val("total_capex", units="MUSD")[0]), "OpEx_val": float(prob.get_val("opex.opex", units="MUSD/yr")[0]), "LCOE_val": float(prob.get_val("financese.lcoe", units="USD/MW/h")[0]), "area_tight": float(prob.get_val("landuse.area_tight", units="km**2")[0]), @@ -56,7 +56,7 @@ def run_example(): test_data = { "AEP_val": float(prob.get_val("AEP_farm", units="GW*h")[0]), "CapEx_val": float(prob.get_val("tcc.tcc", units="MUSD")[0]), - "BOS_val": float(prob.get_val("landbosse.total_capex", units="MUSD")[0]), + "BOS_val": float(prob.get_val("total_capex", units="MUSD")[0]), "OpEx_val": float(prob.get_val("opex.opex", units="MUSD/yr")[0]), "LCOE_val": float(prob.get_val("financese.lcoe", units="USD/MW/h")[0]), "area_tight": float(prob.get_val("landuse.area_tight", units="km**2")[0]), From 9d34460bce4684572b878dd048a0aabb21d06db3 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 13:19:31 -0600 Subject: [PATCH 03/36] update all examples --- examples/02_onshore/inputs/ard_system.yaml | 8 ++++---- examples/03_offshore_fixed/inputs/ard_system.yaml | 6 +++++- examples/04_offshore_floating/inputs/ard_system.yaml | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/02_onshore/inputs/ard_system.yaml b/examples/02_onshore/inputs/ard_system.yaml index c77fd5fc..238d4ac2 100644 --- a/examples/02_onshore/inputs/ard_system.yaml +++ b/examples/02_onshore/inputs/ard_system.yaml @@ -18,14 +18,14 @@ modeling_options: turbine: !include turbine_spec_IEA-3p4-130-RWT.yaml collection: max_turbines_per_string: 8 - model_options: - topology: "branched" - feeder_route: "segmented" - feeder_limit: "unlimited" solver_name: "highs" solver_options: time_limit: 60 mip_gap: 0.02 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" offshore: false floating: false diff --git a/examples/03_offshore_fixed/inputs/ard_system.yaml b/examples/03_offshore_fixed/inputs/ard_system.yaml index 055c61ed..0a76338e 100644 --- a/examples/03_offshore_fixed/inputs/ard_system.yaml +++ b/examples/03_offshore_fixed/inputs/ard_system.yaml @@ -49,7 +49,11 @@ modeling_options: &modeling_options solver_name: "highs" solver_options: time_limit: 60 - mip_gap: 0.005 + mip_gap: 0.02 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" offshore: true floating: false site_depth: 50.0 diff --git a/examples/04_offshore_floating/inputs/ard_system.yaml b/examples/04_offshore_floating/inputs/ard_system.yaml index c34f5514..b61d5dde 100644 --- a/examples/04_offshore_floating/inputs/ard_system.yaml +++ b/examples/04_offshore_floating/inputs/ard_system.yaml @@ -24,7 +24,11 @@ modeling_options: &modeling_options solver_name: "highs" solver_options: time_limit: 60 - mip_gap: 0.005 + mip_gap: 0.02 + model_options: + topology: "branched" + feeder_route: "segmented" + feeder_limit: "unlimited" offshore: true floating: true From 3b861247cdb1d9958734510e118962684863783f Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 13:28:33 -0600 Subject: [PATCH 04/36] added example testing routine to test --- .github/workflows/python-tests-example.yml | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/python-tests-example.yml diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml new file mode 100644 index 00000000..1906b89e --- /dev/null +++ b/.github/workflows/python-tests-example.yml @@ -0,0 +1,50 @@ +name: Run Example Scripts + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + test-example: + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + + - name: Install Ard + run: | + pip install .[dev] + + - name: Run examples + run: | + export RETURN_TO=$CWD + for DIR in examples/* ; do + echo $DIR + cd $DIR + python *.py + cd $RETURN_TO + done + + # - name: Upload coverage report + # uses: codecov/codecov-action@v2 + # with: + # file: ./coverage.xml + # flags: unittests + # name: codecov-umbrella From 4ba5fdb231ade46262d783d1fc85b4df1bfadf56 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 13:33:36 -0600 Subject: [PATCH 05/36] adjust cwd command --- .github/workflows/python-tests-example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index 1906b89e..d409f4ac 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -34,7 +34,7 @@ jobs: - name: Run examples run: | - export RETURN_TO=$CWD + export RETURN_TO=$PWD for DIR in examples/* ; do echo $DIR cd $DIR From d9ce4e5d613347e9679895d193205705d28d7392 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 13:51:23 -0600 Subject: [PATCH 06/36] reorganize some examples --- ard/api/interface.py | 1 + .../inputs/ard/ard_driver.yaml | 0 .../inputs/ard/ard_system.yaml | 16 ----- .../inputs/ard/modeling_options.yaml | 0 .../inputs/data/IEA37_10MW_turbine.yaml | 14 ---- .../inputs/data/ROWP_Regular.yaml | 64 ------------------- .../inputs/data/ROWP_Regular_System.yaml | 9 --- .../run-iea-wind-740-10-rowp.py | 0 .../inputs/ard_system.yaml | 0 ...r_thrust_table_ccblade_IEA-3p4-130-RWT.csv | 0 .../inputs/turbine_spec_IEA-3p4-130-RWT.yaml | 0 .../inputs/wrg_example.wrg | 0 .../optimization_analysis.ipynb | 0 .../optimization_demo.py | 0 .../inputs/ard_system.yaml | 0 ...er_thrust_table_ccblade_IEA-22-284-RWT.csv | 0 .../inputs/turbine_spec_IEA-22-284-RWT.yaml | 0 .../inputs/wrg_example.wrg | 0 .../optimization_demo.py | 0 .../inputs/ard_system.yaml | 0 ...er_thrust_table_ccblade_IEA-22-284-RWT.csv | 0 .../inputs/turbine_spec_IEA-22-284-RWT.yaml | 0 .../inputs/wrg_example.wrg | 0 .../optimization_demo.py | 0 24 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 examples/01-iea-wind-740-10-rowp/inputs/ard/ard_driver.yaml delete mode 100644 examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml delete mode 100644 examples/01-iea-wind-740-10-rowp/inputs/ard/modeling_options.yaml delete mode 100644 examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml delete mode 100644 examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml delete mode 100644 examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml delete mode 100644 examples/01-iea-wind-740-10-rowp/run-iea-wind-740-10-rowp.py rename examples/{02_onshore => 01_onshore}/inputs/ard_system.yaml (100%) rename examples/{02_onshore => 01_onshore}/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv (100%) rename examples/{02_onshore => 01_onshore}/inputs/turbine_spec_IEA-3p4-130-RWT.yaml (100%) rename examples/{02_onshore => 01_onshore}/inputs/wrg_example.wrg (100%) rename examples/{02_onshore => 01_onshore}/optimization_analysis.ipynb (100%) rename examples/{02_onshore => 01_onshore}/optimization_demo.py (100%) rename examples/{03_offshore_fixed => 02_offshore_fixed}/inputs/ard_system.yaml (100%) rename examples/{03_offshore_fixed => 02_offshore_fixed}/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv (100%) rename examples/{03_offshore_fixed => 02_offshore_fixed}/inputs/turbine_spec_IEA-22-284-RWT.yaml (100%) rename examples/{03_offshore_fixed => 02_offshore_fixed}/inputs/wrg_example.wrg (100%) rename examples/{03_offshore_fixed => 02_offshore_fixed}/optimization_demo.py (100%) rename examples/{04_offshore_floating => 03_offshore_floating}/inputs/ard_system.yaml (100%) rename examples/{04_offshore_floating => 03_offshore_floating}/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv (100%) rename examples/{04_offshore_floating => 03_offshore_floating}/inputs/turbine_spec_IEA-22-284-RWT.yaml (100%) rename examples/{04_offshore_floating => 03_offshore_floating}/inputs/wrg_example.wrg (100%) rename examples/{04_offshore_floating => 03_offshore_floating}/optimization_demo.py (100%) diff --git a/ard/api/interface.py b/ard/api/interface.py index dd11fb8b..337b1b88 100644 --- a/ard/api/interface.py +++ b/ard/api/interface.py @@ -71,6 +71,7 @@ def set_up_ard_model(input_dict: Union[str, dict], root_data_path: str = None): if isinstance(input_dict["system"], str): if input_dict["system"] in available_default_systems: + print(f"DEBUG!!!!! ASSET_DIR: {ASSET_DIR}") system = load_yaml(ASSET_DIR / f"ard_system_{input_dict["system"]}.yaml") input_dict["system"] = replace_key_value( diff --git a/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_driver.yaml b/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_driver.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml b/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml deleted file mode 100644 index 069da571..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/ard/ard_system.yaml +++ /dev/null @@ -1,16 +0,0 @@ -groups: - aerodynamics: - promotes: ["*"] - systems: - aep: - type: group - promotes: ["*"] - systems: - floris: - name: farm_aero.floris - object: FLORISAEP - type: component - promotes: ["*"] - kwargs: - case_title: "test" - modeling_options: "example_value" \ No newline at end of file diff --git a/examples/01-iea-wind-740-10-rowp/inputs/ard/modeling_options.yaml b/examples/01-iea-wind-740-10-rowp/inputs/ard/modeling_options.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml b/examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml deleted file mode 100644 index d170e1e4..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/data/IEA37_10MW_turbine.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: IEA Wind Task 37 10MW Offshore Reference Turbine -performance: - rated_power: 10000000 - cutin_wind_speed: 4.0 - cutout_wind_speed: 25.0 - power_curve: - power_values: [387510.9723, 644692.8925, 937974.799, 1257928.478, 1604119.995, 1969504.269, 2340111.432, 2708595.63, 3067098.715, 3408654.893, 3723706.607, 4003354.317, 4239645.746, 4425830.055, 4556570.854, 4628112.983, 4638399.089, 4690045.495, 4804899.691, 4985748.651, 5236938.939, 5564425.114, 5975831.243, 6480522.086, 7089679.768, 7816381.143, 8690612.607, 9716655.499, 10000000, 9999999.662, 10000000.11, 9999986.888, 10000034.43, 10000023.5, 10000017.75, 10000014.23, 10000011.69, 10000009.65, 10000007.96, 10000006.47, 10000005.1, 10000003.98, 10000003.09, 10000002.36, 10000001.76, 10000001.26, 10000000.85, 10000000.53, 10000000.28, 10000041.66] - power_wind_speeds: [4, 4.514652562, 5.000795688, 5.457350016, 5.883301884, 6.277705571, 6.639685402, 6.968437691, 7.263232527, 7.523415391, 7.748408611, 7.937712648, 8.090907197, 8.20765213, 8.287688244, 8.330837837, 8.337005108, 8.367833853, 8.435590166, 8.540123611, 8.681202099, 8.858512398, 9.071660837, 9.320174171, 9.603500641, 9.921011189, 10.27200086, 10.65569038, 10.75773635, 11.51769068, 11.9940876, 12.49936091, 13.03238875, 13.59198769, 14.17691527, 14.7858728, 15.41750825, 16.07041923, 16.74315611, 17.43422525, 18.1420923, 18.86518562, 19.60189976, 20.35059904, 21.10962115, 21.87728087, 22.65187381, 23.43168018, 24.21496861, 25] - Ct_curve: - Ct_values: [0.770113776, 0.776301765, 0.782430404, 0.781982993, 0.780246928, 0.777153006, 0.771853687, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.776845963, 0.767521911, 0.765104347, 0.758675026, 0.505649564, 0.431035612, 0.370827539, 0.320855929, 0.278805531, 0.243151019, 0.212773558, 0.186803785, 0.164542221, 0.145414565, 0.128943645, 0.114730283, 0.102438991, 0.091786964, 0.082535328, 0.074482009, 0.067455867, 0.061311766, 0.05592648, 0.051195261, 0.047029125] - Ct_wind_speeds: [4, 4.514652562, 5.000795688, 5.457350016, 5.883301884, 6.277705571, 6.639685402, 6.968437691, 7.263232527, 7.523415391, 7.748408611, 7.937712648, 8.090907197, 8.20765213, 8.287688244, 8.330837837, 8.337005108, 8.367833853, 8.435590166, 8.540123611, 8.681202099, 8.858512398, 9.071660837, 9.320174171, 9.603500641, 9.921011189, 10.27200086, 10.65569038, 10.75773635, 11.51769068, 11.9940876, 12.49936091, 13.03238875, 13.59198769, 14.17691527, 14.7858728, 15.41750825, 16.07041923, 16.74315611, 17.43422525, 18.1420923, 18.86518562, 19.60189976, 20.35059904, 21.10962115, 21.87728087, 22.65187381, 23.43168018, 24.21496861, 25] -hub_height: 119.0 -rotor_diameter: 198.0 -tilt: 5.0 diff --git a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml b/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml deleted file mode 100644 index a16fcaf3..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: IEA Wind 740-10-MW Reference Offshore Wind Plant with regular layout (plant) -layouts: - initial_layout: - coordinates: - x: [ - 500968.1461, 499748.6565, 501245.7744, 500026.2848, 498527.8286, - 497308.339, 501523.4027, 500303.9131, 498805.4569, 497585.9673, - 496087.5111, 494868.0215, 501801.031, 500581.5414, 499083.0852, - 497863.5956, 496365.1394, 495145.6498, 493647.1936, 492427.704, - 502078.6593, 500859.1697, 499360.7135, 498141.2239, 496642.7677, - 495423.2781, 493924.8219, 492705.3323, 491206.8762, 489987.3865, - 502356.2876, 501136.798, 499638.3418, 498418.8522, 496920.396, - 495700.9064, 494202.4502, 492982.9606, 491484.5045, 490265.0148, - 488766.5587, 487547.069, 502633.9159, 501414.4263, 499915.9701, - 498696.4805, 497198.0243, 495978.5347, 494480.0786, 493260.5889, - 491762.1328, 490542.6431, 489044.187, 487824.6973, 486326.2412, - 485106.7515, 497475.6526, 496256.163, 494757.7069, 493538.2172, - 492039.7611, 490820.2714, 489321.8153, 488102.3256, 486603.8695, - 497753.2809, 496533.7913, 495035.3352, 493815.8455, 492317.3894, - 489599.4436, 498030.9093, 496811.4196, 495312.9635 - ] - y: [ - 5716452.784, 5717635.848, 5718427.22, 5719610.283, 5718809.394, - 5719992.458, 5720401.656, 5721584.719, 5720783.83, 5721966.894, - 5721166.004, 5722349.068, 5722376.092, 5723559.155, 5722758.266, - 5723941.33, 5723140.44, 5724323.504, 5723522.615, 5724705.678, - 5724350.528, 5725533.591, 5724732.702, 5725915.765, 5725114.876, - 5726297.94, 5725497.051, 5726680.114, 5725879.225, 5727062.288, - 5726324.963, 5727508.027, 5726707.138, 5727890.201, 5727089.312, - 5728272.376, 5727471.486, 5728654.55, 5727853.661, 5729036.724, - 5728235.835, 5729418.899, 5728299.399, 5729482.463, 5728681.574, - 5729864.637, 5729063.748, 5730246.812, 5729445.922, 5730628.986, - 5729828.097, 5731011.16, 5730210.271, 5731393.335, 5730592.445, - 5731775.509, 5731038.184, 5732221.248, 5731420.358, 5732603.422, - 5731802.533, 5732985.596, 5732184.707, 5733367.77, 5732566.881, - 5733012.62, 5734195.683, 5733394.794, 5734577.858, 5733776.968, - 5734159.143, 5734987.056, 5736170.119, 5735369.23 - ] - -electrical_substations: - coordinates: - x: [497620.7] - y: [5730622.0] -electrical_collection_array: - edges: [[0, 2, 0], [1, 4, 0], [2, 6, 0], [3, 8, 0], [4, 5, 0], [5, 10, 0], [6, 7, 0], - [7, 14, 1], [8, 9, 0], [9, 15, 0], [10, 16, 1], [11, 18, 0], [12, 13, 0], - [13, 20, 0], [14, 22, 1], [15, 24, 1], [16, 17, 1], [17, 25, 2], [18, 19, 0], - [19, 26, 0], [20, 21, 0], [21, 32, 1], [21, 30, 0], [22, 23, 2], [23, -1, 2], - [24, 34, 1], [25, -1, 2], [26, 27, 1], [27, 36, 1], [28, 29, 0], [29, 38, 0], - [29, 40, 0], [31, 44, 0], [31, 42, 0], [32, 33, 2], [33, -1, 2], [34, 46, 2], - [35, -1, 2], [35, 36, 2], [37, 48, 1], [37, 38, 1], [39, 50, 1], [39, 52, 1], - [41, 52, 0], [41, 54, 0], [43, 44, 0], [44, 45, 1], [45, -1, 1], [46, -1, 2], - [47, -1, 2], [47, 48, 2], [49, -1, 2], [49, 50, 2], [51, 60, 1], [51, 62, 0], - [53, 62, 0], [53, 64, 0], [54, 55, 0], [56, -1, 2], [56, 65, 1], [57, -1, 2], - [57, 67, 2], [58, -1, 2], [58, 59, 2], [59, 60, 1], [61, 69, 0], [61, 70, 0], - [63, 70, 0], [65, 66, 1], [66, 71, 0], [66, 73, 0], [67, 68, 1], [68, 69, 1], - [71, 72, 0]] - cables: - cable_type: [0, 1, 2] - cross_section: [95, 240, 500] - current_capacity: [300, 480, 655] - turbines_supplied: [3, 5, 7] - -turbines: !include IEA37_10MW_turbine.yaml diff --git a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml b/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml deleted file mode 100644 index b7660054..00000000 --- a/examples/01-iea-wind-740-10-rowp/inputs/data/ROWP_Regular_System.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: IEA Wind 740-10-MW Reference Offshore Wind Plant with regular layout (system) -site: !include Site.yaml -wind_farm: !include ROWP_Regular.yaml -attributes: - net_AEP: 3385.51 - analyses: - wake_model: - name: Jensen - diff --git a/examples/01-iea-wind-740-10-rowp/run-iea-wind-740-10-rowp.py b/examples/01-iea-wind-740-10-rowp/run-iea-wind-740-10-rowp.py deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/02_onshore/inputs/ard_system.yaml b/examples/01_onshore/inputs/ard_system.yaml similarity index 100% rename from examples/02_onshore/inputs/ard_system.yaml rename to examples/01_onshore/inputs/ard_system.yaml diff --git a/examples/02_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv b/examples/01_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv similarity index 100% rename from examples/02_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv rename to examples/01_onshore/inputs/power_thrust_table_ccblade_IEA-3p4-130-RWT.csv diff --git a/examples/02_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml b/examples/01_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml similarity index 100% rename from examples/02_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml rename to examples/01_onshore/inputs/turbine_spec_IEA-3p4-130-RWT.yaml diff --git a/examples/02_onshore/inputs/wrg_example.wrg b/examples/01_onshore/inputs/wrg_example.wrg similarity index 100% rename from examples/02_onshore/inputs/wrg_example.wrg rename to examples/01_onshore/inputs/wrg_example.wrg diff --git a/examples/02_onshore/optimization_analysis.ipynb b/examples/01_onshore/optimization_analysis.ipynb similarity index 100% rename from examples/02_onshore/optimization_analysis.ipynb rename to examples/01_onshore/optimization_analysis.ipynb diff --git a/examples/02_onshore/optimization_demo.py b/examples/01_onshore/optimization_demo.py similarity index 100% rename from examples/02_onshore/optimization_demo.py rename to examples/01_onshore/optimization_demo.py diff --git a/examples/03_offshore_fixed/inputs/ard_system.yaml b/examples/02_offshore_fixed/inputs/ard_system.yaml similarity index 100% rename from examples/03_offshore_fixed/inputs/ard_system.yaml rename to examples/02_offshore_fixed/inputs/ard_system.yaml diff --git a/examples/03_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv b/examples/02_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv similarity index 100% rename from examples/03_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv rename to examples/02_offshore_fixed/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv diff --git a/examples/03_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml b/examples/02_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml similarity index 100% rename from examples/03_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml rename to examples/02_offshore_fixed/inputs/turbine_spec_IEA-22-284-RWT.yaml diff --git a/examples/03_offshore_fixed/inputs/wrg_example.wrg b/examples/02_offshore_fixed/inputs/wrg_example.wrg similarity index 100% rename from examples/03_offshore_fixed/inputs/wrg_example.wrg rename to examples/02_offshore_fixed/inputs/wrg_example.wrg diff --git a/examples/03_offshore_fixed/optimization_demo.py b/examples/02_offshore_fixed/optimization_demo.py similarity index 100% rename from examples/03_offshore_fixed/optimization_demo.py rename to examples/02_offshore_fixed/optimization_demo.py diff --git a/examples/04_offshore_floating/inputs/ard_system.yaml b/examples/03_offshore_floating/inputs/ard_system.yaml similarity index 100% rename from examples/04_offshore_floating/inputs/ard_system.yaml rename to examples/03_offshore_floating/inputs/ard_system.yaml diff --git a/examples/04_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv b/examples/03_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv similarity index 100% rename from examples/04_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv rename to examples/03_offshore_floating/inputs/power_thrust_table_ccblade_IEA-22-284-RWT.csv diff --git a/examples/04_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml b/examples/03_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml similarity index 100% rename from examples/04_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml rename to examples/03_offshore_floating/inputs/turbine_spec_IEA-22-284-RWT.yaml diff --git a/examples/04_offshore_floating/inputs/wrg_example.wrg b/examples/03_offshore_floating/inputs/wrg_example.wrg similarity index 100% rename from examples/04_offshore_floating/inputs/wrg_example.wrg rename to examples/03_offshore_floating/inputs/wrg_example.wrg diff --git a/examples/04_offshore_floating/optimization_demo.py b/examples/03_offshore_floating/optimization_demo.py similarity index 100% rename from examples/04_offshore_floating/optimization_demo.py rename to examples/03_offshore_floating/optimization_demo.py From 674f75b28d04f5cc52231611bf67b9de63f2c112 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:01:15 -0600 Subject: [PATCH 07/36] attempt fix --- ard/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ard/__init__.py b/ard/__init__.py index ab3d9d1c..bb7d3643 100644 --- a/ard/__init__.py +++ b/ard/__init__.py @@ -6,5 +6,7 @@ from pathlib import Path -BASE_DIR = Path(__file__).resolve().parent +BASE_DIR = Path(__file__).absolute().parent ASSET_DIR = BASE_DIR / "api" / "default_systems" +print(f"DEBUG!!!!! BASE_DIR: {BASE_DIR}") +print(f"DEBUG!!!!! ASSET_DIR: {ASSET_DIR}") \ No newline at end of file From a72e3a5000be842c151b0008b381a5466d7d126d Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:04:36 -0600 Subject: [PATCH 08/36] black reformat, pip statsmodels again after their hotfix --- ard/__init__.py | 2 +- pyproject.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ard/__init__.py b/ard/__init__.py index bb7d3643..153c7330 100644 --- a/ard/__init__.py +++ b/ard/__init__.py @@ -9,4 +9,4 @@ BASE_DIR = Path(__file__).absolute().parent ASSET_DIR = BASE_DIR / "api" / "default_systems" print(f"DEBUG!!!!! BASE_DIR: {BASE_DIR}") -print(f"DEBUG!!!!! ASSET_DIR: {ASSET_DIR}") \ No newline at end of file +print(f"DEBUG!!!!! ASSET_DIR: {ASSET_DIR}") diff --git a/pyproject.toml b/pyproject.toml index 84861cb4..95ab2376 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,8 @@ dependencies = [ "shapely", "jax", "optiwindnet>=0.0.4", - "statsmodels@git+https://github.com/statsmodels/statsmodels.git@main", + "statsmodels", + # "statsmodels@git+https://github.com/statsmodels/statsmodels.git@main", "highspy", "pyyaml", ] From 63fd540d8573b17d12fcb0aa375dde8f9b3087fe Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:21:42 -0600 Subject: [PATCH 09/36] ok think i fixed it --- ard/__init__.py | 2 -- pyproject.toml | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ard/__init__.py b/ard/__init__.py index 153c7330..0f68643f 100644 --- a/ard/__init__.py +++ b/ard/__init__.py @@ -8,5 +8,3 @@ BASE_DIR = Path(__file__).absolute().parent ASSET_DIR = BASE_DIR / "api" / "default_systems" -print(f"DEBUG!!!!! BASE_DIR: {BASE_DIR}") -print(f"DEBUG!!!!! ASSET_DIR: {ASSET_DIR}") diff --git a/pyproject.toml b/pyproject.toml index 95ab2376..b004ee66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,9 @@ build-backend = "setuptools.build_meta" where = ["."] include = ["ard", "ard.*"] +[tool.setuptools.package-data] +"ard.api.default_systems" = ["*.yaml"] + [project] name = "Ard" version = "1.0.0-alpha0" From 95938e885d374576a7a182c13311804d32a5f728 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:24:10 -0600 Subject: [PATCH 10/36] cleanup runner --- .github/workflows/python-tests-example.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index d409f4ac..9c85d515 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -36,15 +36,8 @@ jobs: run: | export RETURN_TO=$PWD for DIR in examples/* ; do - echo $DIR + echo "RUNNING $DIR" cd $DIR python *.py cd $RETURN_TO done - - # - name: Upload coverage report - # uses: codecov/codecov-action@v2 - # with: - # file: ./coverage.xml - # flags: unittests - # name: codecov-umbrella From 88e6550f72cd9c6d4a4b995850eb1ef65a0550ca Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:27:08 -0600 Subject: [PATCH 11/36] try system-agnostic runner --- .github/workflows/python-tests-example.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index 9c85d515..edea8ac4 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -33,11 +33,12 @@ jobs: pip install .[dev] - name: Run examples + shell: python run: | - export RETURN_TO=$PWD - for DIR in examples/* ; do - echo "RUNNING $DIR" - cd $DIR - python *.py - cd $RETURN_TO - done + import pathlib + import subprocess + for example_dir in pathlib.Path("examples").iterdir(): + if example_dir.is_dir(): + print(f"RUNNING {example_dir}") + for pyfile in example_dir.glob("*.py"): + subprocess.run(["python", str(pyfile)], check=True) From 58ff31fa2ad45644b168323a6d6cfdc51ecc8f15 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:35:25 -0600 Subject: [PATCH 12/36] try system-agnostic runner again --- .github/workflows/python-tests-example.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index edea8ac4..2234893f 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -39,6 +39,10 @@ jobs: import subprocess for example_dir in pathlib.Path("examples").iterdir(): if example_dir.is_dir(): - print(f"RUNNING {example_dir}") - for pyfile in example_dir.glob("*.py"): - subprocess.run(["python", str(pyfile)], check=True) + print(f"RUNNING {example_dir}") + for pyfile in example_dir.glob("*.py"): + subprocess.run( + ["python", str(pyfile.name)], + check=True, + cwd=str(example_dir) + ) From 3db2ebebbccb54460020e943f740b8105af47f7c Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:37:01 -0600 Subject: [PATCH 13/36] indent fix --- .github/workflows/python-tests-example.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index 2234893f..b9713968 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -39,10 +39,10 @@ jobs: import subprocess for example_dir in pathlib.Path("examples").iterdir(): if example_dir.is_dir(): - print(f"RUNNING {example_dir}") - for pyfile in example_dir.glob("*.py"): - subprocess.run( - ["python", str(pyfile.name)], - check=True, - cwd=str(example_dir) - ) + print(f"RUNNING {example_dir}") + for pyfile in example_dir.glob("*.py"): + subprocess.run( + ["python", str(pyfile.name)], + check=True, + cwd=str(example_dir) + ) From 1c3a2dc2a14347b6ec6ded5b7a57d5ac9e1388e5 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 14:41:10 -0600 Subject: [PATCH 14/36] turn off n2 diagrams --- examples/02_offshore_fixed/optimization_demo.py | 5 +++-- examples/03_offshore_floating/optimization_demo.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/02_offshore_fixed/optimization_demo.py b/examples/02_offshore_fixed/optimization_demo.py index a8cf32d7..4fc7d441 100644 --- a/examples/02_offshore_fixed/optimization_demo.py +++ b/examples/02_offshore_fixed/optimization_demo.py @@ -20,8 +20,9 @@ def run_example(): # run the model prob.run_model() - # Visualize model - om.n2(prob) + if False: + # visualize model + om.n2(prob) # collapse the test result data test_data = { diff --git a/examples/03_offshore_floating/optimization_demo.py b/examples/03_offshore_floating/optimization_demo.py index ff9026fc..39daf62b 100644 --- a/examples/03_offshore_floating/optimization_demo.py +++ b/examples/03_offshore_floating/optimization_demo.py @@ -24,8 +24,9 @@ def run_example(): # run the model prob.run_model() - # visualize model - # om.n2(prob, "new") + if False: + # visualize model + om.n2(prob) # collapse the test result data test_data = { From 6e549a35c7a896eb73146a69a3232e9d4e9f848d Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:02:41 -0600 Subject: [PATCH 15/36] test consolidated CI/CD workflow --- .../workflows/python-tests-consolidated.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/python-tests-consolidated.yaml diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml new file mode 100644 index 00000000..9c89b56f --- /dev/null +++ b/.github/workflows/python-tests-consolidated.yaml @@ -0,0 +1,94 @@ +name: CI/CD stack + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + + test-unit: + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run unit tests with coverage + run: | + pytest --cov=ard --cov-fail-under=80 test/unit + + test-system: + needs: test-unit + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run system tests with coverage + run: | + pytest --cov=ard --cov-fail-under=50 test/system + # pytest --cov=ard --cov-fail-under=80 test/system + + test-example: + needs: [test-unit, test-system] + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run examples + shell: python + run: | + import pathlib + import subprocess + for example_dir in pathlib.Path("examples").iterdir(): + if example_dir.is_dir(): + print(f"RUNNING {example_dir}") + for pyfile in example_dir.glob("*.py"): + subprocess.run( + ["python", str(pyfile.name)], + check=True, + cwd=str(example_dir) + ) From eabcf3f9c56bf4b482c9262190e0d62134305aba Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:21:04 -0600 Subject: [PATCH 16/36] attempt improved consolidated script --- .../workflows/python-tests-consolidated.yaml | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 9c89b56f..08cdfb23 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -11,6 +11,7 @@ on: jobs: test-unit: + name: Run unit tests strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] @@ -34,6 +35,7 @@ jobs: pytest --cov=ard --cov-fail-under=80 test/unit test-system: + name: Run system tests needs: test-unit strategy: matrix: @@ -58,13 +60,15 @@ jobs: pytest --cov=ard --cov-fail-under=50 test/system # pytest --cov=ard --cov-fail-under=80 test/system - test-example: + test-examples: + name: Run all examples needs: [test-unit, test-system] - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # script: + # # this will be replaced dynamically steps: - name: Checkout code uses: actions/checkout@v4 @@ -72,6 +76,25 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Find example scripts + id: find_scripts + run: | + echo "scripts<> $GITHUB_OUTPUT + find examples -mindepth 2 -maxdepth 2 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + outputs: + scripts: ${{ steps.find_scripts.outputs.scripts }} + + run-examples: + needs: test-examples + strategy: + fail-fast: false + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + script: ${{fromJson(needs.test-examples.outputs.scripts)}} + runs-on: ${{ matrix.os }} + steps: - name: Install dependencies run: | python -m pip install --upgrade pip @@ -87,8 +110,8 @@ jobs: if example_dir.is_dir(): print(f"RUNNING {example_dir}") for pyfile in example_dir.glob("*.py"): - subprocess.run( - ["python", str(pyfile.name)], - check=True, - cwd=str(example_dir) - ) + subprocess.run( + ["python", str(pyfile.name)], + check=True, + cwd=str(example_dir) + ) From 7217283be2d91d5dbe4bccc0defe23e494c8a09f Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:26:12 -0600 Subject: [PATCH 17/36] direct parallel example runner test --- .github/workflows/python-tests-example.yml | 72 ++++++++++++++++++---- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index b9713968..d73b7dab 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -9,36 +9,48 @@ on: - '*' jobs: - test-example: - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} + find-examples: + name: Find all examples + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Find example python scripts + id: find_scripts + run: | + echo "scripts<> $GITHUB_OUTPUT + find examples -mindepth 2 -maxdepth 2 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + outputs: + scripts: ${{ steps.find_scripts.outputs.scripts }} + test-examples: + needs: find-examples + strategy: + fail-fast: false + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + script: ${{fromJson(needs.find-examples.outputs.scripts)}} + runs-on: ${{ matrix.os }} + steps: - name: Install dependencies run: | - python -m pip install --upgrade pip - + python -m pip install --upgrade pip - name: Install Ard run: | pip install .[dev] - - name: Run examples shell: python run: | import pathlib import subprocess for example_dir in pathlib.Path("examples").iterdir(): - if example_dir.is_dir(): + if example_dir.is_dir(): print(f"RUNNING {example_dir}") for pyfile in example_dir.glob("*.py"): subprocess.run( @@ -46,3 +58,41 @@ jobs: check=True, cwd=str(example_dir) ) + +# test-example: +# strategy: +# matrix: +# python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] +# os: [macos-latest, ubuntu-latest, windows-latest] +# runs-on: ${{ matrix.os }} +# steps: +# - name: Checkout code +# uses: actions/checkout@v4 +# +# - name: Set up Python ${{ matrix.python-version }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# +# - name: Install Ard +# run: | +# pip install .[dev] +# +# - name: Run examples +# shell: python +# run: | +# import pathlib +# import subprocess +# for example_dir in pathlib.Path("examples").iterdir(): +# if example_dir.is_dir(): +# print(f"RUNNING {example_dir}") +# for pyfile in example_dir.glob("*.py"): +# subprocess.run( +# ["python", str(pyfile.name)], +# check=True, +# cwd=str(example_dir) +# ) From 4001df6d5764c2351ffb7fb67664fff64d898ac2 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:30:03 -0600 Subject: [PATCH 18/36] complete runner code --- .github/workflows/python-tests-example.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index d73b7dab..05252bf4 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -38,9 +38,15 @@ jobs: script: ${{fromJson(needs.find-examples.outputs.scripts)}} runs-on: ${{ matrix.os }} steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip - name: Install Ard run: | pip install .[dev] From 246d3468ceea940c370c1214a3b28a60d4f9e95b Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:42:05 -0600 Subject: [PATCH 19/36] a new test that should maybe actually work --- .github/workflows/python-tests-example.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index 05252bf4..352c08e5 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -55,15 +55,13 @@ jobs: run: | import pathlib import subprocess - for example_dir in pathlib.Path("examples").iterdir(): - if example_dir.is_dir(): - print(f"RUNNING {example_dir}") - for pyfile in example_dir.glob("*.py"): - subprocess.run( - ["python", str(pyfile.name)], - check=True, - cwd=str(example_dir) - ) + path_script = pathlib.Path(${{ matrix.script }}).absolute() + print(f"RUNNING {path_script}") + subprocess.run( + ["python", str(path_script.name)], + check=True, + cwd=str(path_script.parent) + ) # test-example: # strategy: From 2b28d20283e42609a2eb7d3564eb5e7ab32ced66 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:44:03 -0600 Subject: [PATCH 20/36] add missing file and quotation marks --- .../workflows/python-tests-consolidated.yaml | 60 +++++++++---------- .github/workflows/python-tests-example.yml | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 08cdfb23..86c960d6 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -85,33 +85,33 @@ jobs: outputs: scripts: ${{ steps.find_scripts.outputs.scripts }} - run-examples: - needs: test-examples - strategy: - fail-fast: false - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - script: ${{fromJson(needs.test-examples.outputs.scripts)}} - runs-on: ${{ matrix.os }} - steps: - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Install Ard - run: | - pip install .[dev] - - name: Run examples - shell: python - run: | - import pathlib - import subprocess - for example_dir in pathlib.Path("examples").iterdir(): - if example_dir.is_dir(): - print(f"RUNNING {example_dir}") - for pyfile in example_dir.glob("*.py"): - subprocess.run( - ["python", str(pyfile.name)], - check=True, - cwd=str(example_dir) - ) + # run-examples: + # needs: test-examples + # strategy: + # fail-fast: false + # matrix: + # python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + # os: [macos-latest, ubuntu-latest, windows-latest] + # script: ${{fromJson(needs.test-examples.outputs.scripts)}} + # runs-on: ${{ matrix.os }} + # steps: + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # - name: Install Ard + # run: | + # pip install .[dev] + # - name: Run examples + # shell: python + # run: | + # import pathlib + # import subprocess + # for example_dir in pathlib.Path("examples").iterdir(): + # if example_dir.is_dir(): + # print(f"RUNNING {example_dir}") + # for pyfile in example_dir.glob("*.py"): + # subprocess.run( + # ["python", str(pyfile.name)], + # check=True, + # cwd=str(example_dir) + # ) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml index 352c08e5..725ca9ea 100644 --- a/.github/workflows/python-tests-example.yml +++ b/.github/workflows/python-tests-example.yml @@ -55,7 +55,7 @@ jobs: run: | import pathlib import subprocess - path_script = pathlib.Path(${{ matrix.script }}).absolute() + path_script = pathlib.Path("${{ matrix.script }}").absolute() print(f"RUNNING {path_script}") subprocess.run( ["python", str(path_script.name)], From 1a3cd01f3d0bc92880c1a684a6749b5720034cbe Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:52:24 -0600 Subject: [PATCH 21/36] switch to consolidated with parallel examples --- .../workflows/python-tests-consolidated.yaml | 77 +++++++------ .github/workflows/python-tests-example.yml | 102 ------------------ .github/workflows/python-tests-system.yml | 47 -------- .github/workflows/python-tests-unit.yml | 44 -------- 4 files changed, 38 insertions(+), 232 deletions(-) delete mode 100644 .github/workflows/python-tests-example.yml delete mode 100644 .github/workflows/python-tests-system.yml delete mode 100644 .github/workflows/python-tests-unit.yml diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 86c960d6..0f763da2 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -1,4 +1,4 @@ -name: CI/CD stack +name: Consolidated CI/CD testing on: push: @@ -60,15 +60,10 @@ jobs: pytest --cov=ard --cov-fail-under=50 test/system # pytest --cov=ard --cov-fail-under=80 test/system - test-examples: - name: Run all examples + find-examples: + name: Find all examples needs: [test-unit, test-system] runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # script: - # # this will be replaced dynamically steps: - name: Checkout code uses: actions/checkout@v4 @@ -76,7 +71,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Find example scripts + - name: Find example python scripts id: find_scripts run: | echo "scripts<> $GITHUB_OUTPUT @@ -85,33 +80,37 @@ jobs: outputs: scripts: ${{ steps.find_scripts.outputs.scripts }} - # run-examples: - # needs: test-examples - # strategy: - # fail-fast: false - # matrix: - # python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - # os: [macos-latest, ubuntu-latest, windows-latest] - # script: ${{fromJson(needs.test-examples.outputs.scripts)}} - # runs-on: ${{ matrix.os }} - # steps: - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # - name: Install Ard - # run: | - # pip install .[dev] - # - name: Run examples - # shell: python - # run: | - # import pathlib - # import subprocess - # for example_dir in pathlib.Path("examples").iterdir(): - # if example_dir.is_dir(): - # print(f"RUNNING {example_dir}") - # for pyfile in example_dir.glob("*.py"): - # subprocess.run( - # ["python", str(pyfile.name)], - # check=True, - # cwd=str(example_dir) - # ) + test-examples: + needs: find-examples + strategy: + fail-fast: false + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + script: ${{fromJson(needs.find-examples.outputs.scripts)}} + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] + - name: Run examples + shell: python + run: | + import pathlib + import subprocess + path_script = pathlib.Path("${{ matrix.script }}").absolute() + print(f"RUNNING {path_script}") + subprocess.run( + ["python", str(path_script.name)], + check=True, + cwd=str(path_script.parent) + ) diff --git a/.github/workflows/python-tests-example.yml b/.github/workflows/python-tests-example.yml deleted file mode 100644 index 725ca9ea..00000000 --- a/.github/workflows/python-tests-example.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Run Example Scripts - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - find-examples: - name: Find all examples - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Find example python scripts - id: find_scripts - run: | - echo "scripts<> $GITHUB_OUTPUT - find examples -mindepth 2 -maxdepth 2 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - outputs: - scripts: ${{ steps.find_scripts.outputs.scripts }} - - test-examples: - needs: find-examples - strategy: - fail-fast: false - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - script: ${{fromJson(needs.find-examples.outputs.scripts)}} - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Install Ard - run: | - pip install .[dev] - - name: Run examples - shell: python - run: | - import pathlib - import subprocess - path_script = pathlib.Path("${{ matrix.script }}").absolute() - print(f"RUNNING {path_script}") - subprocess.run( - ["python", str(path_script.name)], - check=True, - cwd=str(path_script.parent) - ) - -# test-example: -# strategy: -# matrix: -# python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] -# os: [macos-latest, ubuntu-latest, windows-latest] -# runs-on: ${{ matrix.os }} -# steps: -# - name: Checkout code -# uses: actions/checkout@v4 -# -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# -# - name: Install Ard -# run: | -# pip install .[dev] -# -# - name: Run examples -# shell: python -# run: | -# import pathlib -# import subprocess -# for example_dir in pathlib.Path("examples").iterdir(): -# if example_dir.is_dir(): -# print(f"RUNNING {example_dir}") -# for pyfile in example_dir.glob("*.py"): -# subprocess.run( -# ["python", str(pyfile.name)], -# check=True, -# cwd=str(example_dir) -# ) diff --git a/.github/workflows/python-tests-system.yml b/.github/workflows/python-tests-system.yml deleted file mode 100644 index bddbae4f..00000000 --- a/.github/workflows/python-tests-system.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Python System Tests with Coverage - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - test: - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - - name: Install Ard - run: | - pip install .[dev] - - - name: Run system tests with coverage - run: | - pytest --cov=ard --cov-fail-under=50 test/system - # pytest --cov=ard --cov-fail-under=80 test/system - - # - name: Upload coverage report - # uses: codecov/codecov-action@v2 - # with: - # file: ./coverage.xml - # flags: unittests - # name: codecov-umbrella - diff --git a/.github/workflows/python-tests-unit.yml b/.github/workflows/python-tests-unit.yml deleted file mode 100644 index cd4f88e6..00000000 --- a/.github/workflows/python-tests-unit.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Python Unit Tests with Coverage - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - test: - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - - name: Install Ard - run: | - pip install .[dev] - - - name: Run unit tests with coverage - run: | - pytest --cov=ard --cov-fail-under=80 test/unit - - # - name: Upload coverage report - # uses: codecov/codecov-action@v2 - # with: - # file: ./coverage.xml - # flags: unittests - # name: codecov-umbrella From dfa6a3bd3c0445cf5f14596603ea6b54ab67b585 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 15:57:47 -0600 Subject: [PATCH 22/36] rectify author attribution in pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b004ee66..6416397a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ version = "1.0.0-alpha0" authors = [ {name = "Cory Frontin", email = "cory.frontin@nrel.gov"}, {name = "Rafael Mudafort", email = "rafael.mudafort@nrel.gov"}, + {name = "Jared Thomas", email = "jared.thomas@nrel.gov"}, ] description = "A package for multidisciplinary and/or multifidelity wind farm design" readme= "README.md" From 907ab414038e5d20c4030fbfbce1cad555680dd4 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 16:01:20 -0600 Subject: [PATCH 23/36] remove commented dependency --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6416397a..a09bcdb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,6 @@ dependencies = [ "jax", "optiwindnet>=0.0.4", "statsmodels", - # "statsmodels@git+https://github.com/statsmodels/statsmodels.git@main", "highspy", "pyyaml", ] From e36651ac9094d8a4fdce3d3949d118a3edcb3cc3 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Thu, 17 Jul 2025 16:34:56 -0600 Subject: [PATCH 24/36] cleaner gui interaction --- .github/workflows/python-tests-consolidated.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 0f763da2..894a609b 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -81,6 +81,7 @@ jobs: scripts: ${{ steps.find_scripts.outputs.scripts }} test-examples: + name: Run all examples needs: find-examples strategy: fail-fast: false From 5bf6c49f6ab325d256a86373b4a8a18e4114d461 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 09:48:01 -0600 Subject: [PATCH 25/36] modified consolidated tests --- .github/workflows/python-tests-consolidated.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 894a609b..5812dc27 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -106,12 +106,18 @@ jobs: - name: Run examples shell: python run: | + import os import pathlib import subprocess + + env = os.environ.copy() + env["MPLBACKEND"] = "Agg" # Non-interactive backend + path_script = pathlib.Path("${{ matrix.script }}").absolute() print(f"RUNNING {path_script}") subprocess.run( ["python", str(path_script.name)], check=True, - cwd=str(path_script.parent) + cwd=str(path_script.parent), + env=env, ) From ee8e65603a8bf44e936d526b5b57bef46115a097 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 10:03:15 -0600 Subject: [PATCH 26/36] faster consolidated ci/cd --- .../workflows/python-tests-consolidated.yaml | 71 ++++++++++++------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 5812dc27..e4ee2c09 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -10,13 +10,17 @@ on: jobs: - test-unit: - name: Run unit tests + setup: + name: Setup Python and Install Dependencies + runs-on: ${{ matrix.os }} strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} + outputs: + python-version: ${{ matrix.python-version }} + os: ${{ matrix.os }} + cache-path: ${{ steps.cache.outputs.cache-path }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -24,12 +28,33 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Cache pip + id: cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - name: Install dependencies run: | python -m pip install --upgrade pip - - name: Install Ard - run: | pip install .[dev] + + test-unit: + name: Run unit tests + needs: setup + runs-on: ${{ needs.setup.outputs.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ needs.setup.outputs.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ needs.setup.outputs.python-version }} + - name: Restore pip cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - name: Run unit tests with coverage run: | pytest --cov=ard --cov-fail-under=80 test/unit @@ -37,28 +62,22 @@ jobs: test-system: name: Run system tests needs: test-unit - strategy: - matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} + runs-on: ${{ needs.setup.outputs.os }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ needs.setup.outputs.python-version }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Install Ard - run: | - pip install .[dev] + python-version: ${{ needs.setup.outputs.python-version }} + - name: Restore pip cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - name: Run system tests with coverage run: | pytest --cov=ard --cov-fail-under=50 test/system - # pytest --cov=ard --cov-fail-under=80 test/system find-examples: name: Find all examples @@ -67,10 +86,10 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: 3.12 - name: Find example python scripts id: find_scripts run: | @@ -97,10 +116,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - - name: Install Ard + - name: Restore pip cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} + - name: Install Ard (if needed) run: | pip install .[dev] - name: Run examples From 95c29996090de0a20f30d4ffca9ecf0d2b04ae2b Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 10:08:14 -0600 Subject: [PATCH 27/36] rollback action --- .../workflows/python-tests-consolidated.yaml | 71 +++++++------------ 1 file changed, 25 insertions(+), 46 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index e4ee2c09..5812dc27 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -10,17 +10,13 @@ on: jobs: - setup: - name: Setup Python and Install Dependencies - runs-on: ${{ matrix.os }} + test-unit: + name: Run unit tests strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] - outputs: - python-version: ${{ matrix.python-version }} - os: ${{ matrix.os }} - cache-path: ${{ steps.cache.outputs.cache-path }} + runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -28,33 +24,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache pip - id: cache - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - name: Install dependencies run: | python -m pip install --upgrade pip + - name: Install Ard + run: | pip install .[dev] - - test-unit: - name: Run unit tests - needs: setup - runs-on: ${{ needs.setup.outputs.os }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up Python ${{ needs.setup.outputs.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ needs.setup.outputs.python-version }} - - name: Restore pip cache - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - name: Run unit tests with coverage run: | pytest --cov=ard --cov-fail-under=80 test/unit @@ -62,22 +37,28 @@ jobs: test-system: name: Run system tests needs: test-unit - runs-on: ${{ needs.setup.outputs.os }} + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python ${{ needs.setup.outputs.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: ${{ needs.setup.outputs.python-version }} - - name: Restore pip cache - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard + run: | + pip install .[dev] - name: Run system tests with coverage run: | pytest --cov=ard --cov-fail-under=50 test/system + # pytest --cov=ard --cov-fail-under=80 test/system find-examples: name: Find all examples @@ -86,10 +67,10 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: 3.12 + python-version: ${{ matrix.python-version }} - name: Find example python scripts id: find_scripts run: | @@ -116,12 +97,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Restore pip cache - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - - name: Install Ard (if needed) + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install Ard run: | pip install .[dev] - name: Run examples From e38c97233d776c667a90b3ad717dc0a0e3006343 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 10:19:28 -0600 Subject: [PATCH 28/36] take 2 on caching --- .../workflows/python-tests-consolidated.yaml | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 5812dc27..9f3728da 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -10,8 +10,8 @@ on: jobs: - test-unit: - name: Run unit tests + setup-install: + name: Setup and install Ard strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] @@ -30,6 +30,43 @@ jobs: - name: Install Ard run: | pip install .[dev] + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ env.pythonLocation }}- + + test-unit: + name: Run unit tests + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ env.pythonLocation }} + key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} + - if: steps.cache.outputs.cache-hit != 'true' + name: Install dependencies + run: | + python -m pip install --upgrade pip + - if: steps.cache.outputs.cache-hit != 'true' + name: Install Ard + run: | + pip install .[dev] - name: Run unit tests with coverage run: | pytest --cov=ard --cov-fail-under=80 test/unit @@ -49,10 +86,18 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ env.pythonLocation }} + key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} + - if: steps.cache.outputs.cache-hit != 'true' + name: Install dependencies run: | python -m pip install --upgrade pip - - name: Install Ard + - if: steps.cache.outputs.cache-hit != 'true' + name: Install Ard run: | pip install .[dev] - name: Run system tests with coverage From 5c4f7c42bcad07a2a359d0a1745434092e209e8e Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 10:20:23 -0600 Subject: [PATCH 29/36] update dependency --- .github/workflows/python-tests-consolidated.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 9f3728da..a1769f88 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -41,6 +41,7 @@ jobs: test-unit: name: Run unit tests + needs: setup-install strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] From eef64fba1c8275c6fd7c63515aebb4b852ff3856 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 10:25:52 -0600 Subject: [PATCH 30/36] slight bugfix mod --- .github/workflows/python-tests-consolidated.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index a1769f88..0bebcd24 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -60,11 +60,11 @@ jobs: with: path: ${{ env.pythonLocation }} key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} - - if: steps.cache.outputs.cache-hit != 'true' + - # if: steps.cache.outputs.cache-hit != 'true' name: Install dependencies run: | python -m pip install --upgrade pip - - if: steps.cache.outputs.cache-hit != 'true' + - # if: steps.cache.outputs.cache-hit != 'true' name: Install Ard run: | pip install .[dev] @@ -93,11 +93,11 @@ jobs: with: path: ${{ env.pythonLocation }} key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} - - if: steps.cache.outputs.cache-hit != 'true' + - # if: steps.cache.outputs.cache-hit != 'true' name: Install dependencies run: | python -m pip install --upgrade pip - - if: steps.cache.outputs.cache-hit != 'true' + - # if: steps.cache.outputs.cache-hit != 'true' name: Install Ard run: | pip install .[dev] From 84473d829e96dd3d967719b38d4bd53d32c537cb Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 10:42:57 -0600 Subject: [PATCH 31/36] try cache again --- .../workflows/python-tests-consolidated.yaml | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 0bebcd24..f09083b8 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -16,6 +16,13 @@ jobs: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache runs-on: ${{ matrix.os }} steps: - name: Checkout code @@ -32,12 +39,12 @@ jobs: pip install .[dev] - name: Cache dependencies id: cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: - ${{ env.pythonLocation }}- + ${{ runner.os }}-pip- test-unit: name: Run unit tests @@ -46,6 +53,13 @@ jobs: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache runs-on: ${{ matrix.os }} steps: - name: Checkout code @@ -54,18 +68,18 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache dependencies + - name: Get cache dependencies id: cache uses: actions/cache@v4 with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} - - # if: steps.cache.outputs.cache-hit != 'true' - name: Install dependencies + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- + - name: Install dependencies run: | python -m pip install --upgrade pip - - # if: steps.cache.outputs.cache-hit != 'true' - name: Install Ard + - name: Install Ard run: | pip install .[dev] - name: Run unit tests with coverage @@ -93,12 +107,10 @@ jobs: with: path: ${{ env.pythonLocation }} key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} - - # if: steps.cache.outputs.cache-hit != 'true' - name: Install dependencies + - name: Install dependencies run: | python -m pip install --upgrade pip - - # if: steps.cache.outputs.cache-hit != 'true' - name: Install Ard + - name: Install Ard run: | pip install .[dev] - name: Run system tests with coverage From 7500e48670a73ee402e4bc8030c3abdbc29182c7 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 11:14:05 -0600 Subject: [PATCH 32/36] iterating on cicd cache --- .../workflows/python-tests-consolidated.yaml | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index f09083b8..f98bf976 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -93,6 +93,13 @@ jobs: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache runs-on: ${{ matrix.os }} steps: - name: Checkout code @@ -101,12 +108,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Cache dependencies + - name: Get cache dependencies id: cache uses: actions/cache@v4 with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- - name: Install dependencies run: | python -m pip install --upgrade pip @@ -146,6 +155,13 @@ jobs: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + - os: macos-latest + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache script: ${{fromJson(needs.find-examples.outputs.scripts)}} runs-on: ${{ matrix.os }} steps: From d85bf4fbef430c171f33d32a2e5b4c6b75ff2e5e Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 11:18:27 -0600 Subject: [PATCH 33/36] reorder --- .../workflows/python-tests-consolidated.yaml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index f98bf976..617788d5 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -27,6 +27,14 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -37,14 +45,6 @@ jobs: - name: Install Ard run: | pip install .[dev] - - name: Cache dependencies - id: cache - uses: actions/cache@v4 - with: - path: ${{ matrix.path }} - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} - restore-keys: - ${{ runner.os }}-pip- test-unit: name: Run unit tests @@ -171,6 +171,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Get cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: + ${{ runner.os }}-pip- - name: Install dependencies run: | python -m pip install --upgrade pip From 03391361f37d8d83b37f617f4d0c186e96c046d3 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 11:24:51 -0600 Subject: [PATCH 34/36] rename test --- .github/workflows/python-tests-consolidated.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index 617788d5..481933b3 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -1,4 +1,4 @@ -name: Consolidated CI/CD testing +name: CI/CD test suite on: push: From 73e0c850df6f58f621d43f7d8fcd4cd0a0bdd73c Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 13:25:15 -0600 Subject: [PATCH 35/36] address some of jareds comments and remove commented code --- ard/api/interface.py | 1 - examples/01_onshore/optimization_demo.py | 38 ------------ .../02_offshore_fixed/optimization_demo.py | 58 ------------------- 3 files changed, 97 deletions(-) diff --git a/ard/api/interface.py b/ard/api/interface.py index 337b1b88..dd11fb8b 100644 --- a/ard/api/interface.py +++ b/ard/api/interface.py @@ -71,7 +71,6 @@ def set_up_ard_model(input_dict: Union[str, dict], root_data_path: str = None): if isinstance(input_dict["system"], str): if input_dict["system"] in available_default_systems: - print(f"DEBUG!!!!! ASSET_DIR: {ASSET_DIR}") system = load_yaml(ASSET_DIR / f"ard_system_{input_dict["system"]}.yaml") input_dict["system"] = replace_key_value( diff --git a/examples/01_onshore/optimization_demo.py b/examples/01_onshore/optimization_demo.py index 648ad3e7..b42cd7a4 100644 --- a/examples/01_onshore/optimization_demo.py +++ b/examples/01_onshore/optimization_demo.py @@ -76,44 +76,6 @@ def run_example(): pp.pprint(test_data) print("\n\n") - -# # plot convergence -# ## read cases -# cr = om.CaseReader( -# prob.get_outputs_dir() -# / input_dict["analysis_options"]["recorder"]["filepath"] -# ) -# -# # Extract the driver cases -# cases = cr.get_cases("driver") -# -# # Initialize lists to store iteration data -# iterations = [] -# objective_values = [] -# -# # Loop through the cases and extract iteration number and objective value -# for i, case in enumerate(cases): -# iterations.append(i) -# objective_values.append( -# case.get_objectives()[ -# input_dict["analysis_options"]["objective"]["name"] -# ] -# ) -# -# # Plot the convergence -# plt.figure(figsize=(8, 6)) -# plt.plot(iterations, objective_values, marker="o", label="Objective (LCOE)") -# plt.xlabel("Iteration") -# plt.ylabel("Objective Value (Total Cable Length (m))") -# plt.title("Convergence Plot") -# plt.legend() -# plt.grid() -# plt.show() -# -# optiwindnet.plotting.gplot(prob.model.optiwindnet_coll.graph) -# -# plt.show() - if __name__ == "__main__": run_example() diff --git a/examples/02_offshore_fixed/optimization_demo.py b/examples/02_offshore_fixed/optimization_demo.py index 4fc7d441..179fa93d 100644 --- a/examples/02_offshore_fixed/optimization_demo.py +++ b/examples/02_offshore_fixed/optimization_demo.py @@ -117,61 +117,3 @@ def run_example(): if __name__ == "__main__": run_example() - -# RESULTS: - - -# {'AEP_val': 4818.0, -# 'BOS_val': 2127.5924853696597, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 57.63858824842508, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 63.234304, -# 'coll_length': 47.761107521256534, -# 'mooring_spacing': 1.1208759839268934} - - -# /opt/anaconda3/envs/ard/lib/python3.12/site-packages/openmdao/recorders/sqlite_recorder.py:231: UserWarning:The existing case recorder file, /Users/jthomas2/Documents/programs/Ard/examples/offshore/optimization_demo_out/opt_results.sql, is being overwritten. -# Optimization terminated successfully (Exit mode 0) -# Current function value: 20495.94468696311 -# Iterations: 13 -# Function evaluations: 9 -# Gradient evaluations: 9 -# Optimization Complete -# ----------------------------------- - - -# RESULTS (opt): - -# {'AEP_val': 4818.0, -# 'BOS_val': 2113.9686662769814, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 57.42651136342073, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 11.614464, -# 'coll_length': 20.49594468696311, -# 'mooring_spacing': 0.0582385263254008, -# 'turbine_spacing': 0.8519999999999998} - - -## 20250714 -# RESULTS: - -# {'AEP_val': 4818.0, -# 'BOS_val': 1431.448205129097, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 46.80197118365915, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 63.234304, -# 'coll_length': 47.712041428901635} - -# RESULTS (opt): - -# {'AEP_val': 4818.0, -# 'BOS_val': 1412.8143111685533, -# 'CapEx_val': 768.4437570425, -# 'LCOE_val': 46.51190434118493, -# 'OpEx_val': 60.50000000000001, -# 'area_tight': 11.614464, -# 'coll_length': 20.507898644867613, -# 'turbine_spacing': 0.8519999999999999} From 1f6f9473d4db95dbcf47728046d0922e059c80ae Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 21 Jul 2025 15:31:13 -0600 Subject: [PATCH 36/36] black reformat --- examples/01_onshore/optimization_demo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/01_onshore/optimization_demo.py b/examples/01_onshore/optimization_demo.py index b42cd7a4..ab8eb598 100644 --- a/examples/01_onshore/optimization_demo.py +++ b/examples/01_onshore/optimization_demo.py @@ -76,6 +76,7 @@ def run_example(): pp.pprint(test_data) print("\n\n") + if __name__ == "__main__": run_example()