Skip to content

Commit 0f47884

Browse files
KS-HTKvogt31337heckstrahlerFynnIEElezneew
authored
Feature/generate doc csv (#2941)
* fix which will not add non required columns. * add descriptions to schemata, add b2b_vsc, bus_dc and load_dc schemata * add schema for dcline, measurement, source_dc, ward, xward * add schemata for bi_vsc, impedance, line_dc, tcsc, trafo3w * add res schema to elements * add 3ph res tables to elements * remove introduced inplace methods * fix if condition for dataframe * add metadata to elements * add additional schema (#2738) * add motor.py * add motor.py * adding pa.Check to bus adding min and max value * adding import for motor * adding asymmetric_sgen.py adding import for asymmetric_sgen.py * deleting import for asymmetric_sgen deleting current_source from asymmetric_load adding import for asymmetric_load note: asymmetric_sgen was not added in the last commit (spelling mistake) * adding asymmetric_sgen.py adding import for asymmetric_sgen * adding storage.py adding import for storage * fix doc for gen (cos_phi in csv) adding gen.py adding import for gen * adding shunt.py adding import for shunt * fixed formatting in svc_par.csv (max_angle_degree) adding svc.py adding import for svc * adding res_schema for svc editing schema names adding format for res_scv * editing schema names back * adding vsc.py adding import for vsc adding res_schema for vsc adding import for res_schema * adding res_schema for motor adding import for res_motor adding res_schema for asymmetric_load adding import for res_asymmetric_load adding res_schema for asymmetric_sgen adding import for res_asymmetric_sgen * adding res_schema for storage adding import for res_storage adding res_schema for gen adding import for res_gen adding res_schema for shunt adding import for res_shunt * deleting strict_False from res_schema * adding 3ph for asymmetric_load adding import for res_schema_3ph adding 3ph for asymmetric_sgen adding import for res_schema_3ph adding 3ph for storage adding import for res_schema_3ph * adding metadata to storage adding metadata to gen * fix less equals error * reformat imports * set correct dtype for id_characteristic_table, and set tap_dependency_table to required * fix typo, fix small slow list/dict creation * make comments into TODOs * fixed failing sq_lite test * add schema for ssc element, bug fixes * revert breaking change, other bugfixes * fixed test for subnet * fix typing in build_branch * add metadata to csv creation * update get_std_type_structure_dict * fixed path loading added pandera stubs to requirements * set required correctly for bus, bus_dc * Structure dict rework add additional schemas (#2745) * add motor.py * add motor.py * adding pa.Check to bus adding min and max value * adding import for motor * adding asymmetric_sgen.py adding import for asymmetric_sgen.py * deleting import for asymmetric_sgen deleting current_source from asymmetric_load adding import for asymmetric_load note: asymmetric_sgen was not added in the last commit (spelling mistake) * adding asymmetric_sgen.py adding import for asymmetric_sgen * adding storage.py adding import for storage * fix doc for gen (cos_phi in csv) adding gen.py adding import for gen * adding shunt.py adding import for shunt * fixed formatting in svc_par.csv (max_angle_degree) adding svc.py adding import for svc * adding res_schema for svc editing schema names adding format for res_scv * editing schema names back * adding vsc.py adding import for vsc adding res_schema for vsc adding import for res_schema * adding res_schema for motor adding import for res_motor adding res_schema for asymmetric_load adding import for res_asymmetric_load adding res_schema for asymmetric_sgen adding import for res_asymmetric_sgen * adding res_schema for storage adding import for res_storage adding res_schema for gen adding import for res_gen adding res_schema for shunt adding import for res_shunt * deleting strict_False from res_schema * adding 3ph for asymmetric_load adding import for res_schema_3ph adding 3ph for asymmetric_sgen adding import for res_schema_3ph adding 3ph for storage adding import for res_schema_3ph * adding metadata to storage adding metadata to gen * adding optional parameter to the line * adding optional parameter to the line_dc adding metadata tdpf to line * adding optional parameter to bus_dc * adding optional parameter to gen * adding optional parameter to impedance * adding optional parameter to sgen * adding metadata opf for bus and gen * creating to do for in_ka in create.py adding optional parameter to trafo * Update gen.py * Update impedance.py * Update line.py * Update gen.py * Update trafo.py * Update line_dc.py --------- Co-authored-by: David Heck <david@heck.info> * set better variable names, correct imports, add missing res schemata * set required according to documentation * fix bus creation when there is no geo data, other schema fixes * make test_create as runable as possible -> update create, allow non required from network_structure, update schemas * further changes for test create * fix errors for merge, fix dtype in _set_multiple * fixed nullable strings dtype, some typing, some sonarlint warnings * add bus index validation method * add foreign key for bus in schematas * check bus, bus_dc, dcline, ext_grid, gen, set name to pd.StringDtype * make res nullable * set nullable = true if required = False * add validation for columns which need to exist together * fix import * add hint to trafo check * update pandera definitions * update schemata after plausibility check * fix import get_dtypes * fixes for test_create * add tests for pandera get_dtypes and group_dependency, fix error in group_dependency * fix dtype in set_multiple_entries, fix geodata init in bus_create, fix dtype tests in test_create * fix group_dependency * fix various create problems * remove old tools file * update repo * add pandera bus schema test * move numbers to helper * fix pandera test bus * update schemata * improve test variables * add zero number so helper * fix description errors * update bus schema test * serveral schema fixes * fix max step for shunt schema * fixes for shunt and sgen schemata * fixes for gen and trafo runpp * revert build branch calc tap from dataframe problem.. * set switch z_ohm to required * add column_condition, lower equals check creation method * add fixes for test_create * fix group validation error * fix create test * rename pandera test folder * fix some cgmes converter problems * fix more errors in converter * fix asmcsgen type * fixes in build_branch.py (#2804) * fixes for all network and plotting tests (#2805) * restore opf check in bus schema * fixed issues in test_auxiliary.py (#2808) * add lower than vor vkr and vk at trafo and trafo3w * add comment * update schemata * add 3ph to rx min max for ext grid * fix create lower than column check * fix problems with bus max min vmpu creation * fix NA from excel, current_source in sgen, discretetapcontrol comparison * fix run3ph when type is not set * fix add dcline gens * Issues/structure dict extension test fixes (#2824) * fixed std_type errors * fixed topology tests * fixed test_nets_equal * fixes for grid equivalents * Issues/structure dict extension fix issues (#2825) * fixed api.test_diagnostic * fixed trafo create * fixed issue with NA in _calculate_3w_tap_changers * fixed use of .values in _calculate_3w_tap_changers * fixed use isna only working on non scalar objects * fixed issues in test_cost_consideration * fix bus dc opf nullable * Issues/structure dict extension fix issues (#2827) * split test with for loop into single executions * fixed order of bus table entries to avoid dtype loss * fix sgen create kappa default * Issues/structure dict extension fix issues (#2830) * replaced query with direct access %timeit net.gen.query("in_service").bus 1.02 ms ± 34 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each) %timeit net.gen.where(net.gen.in_service).bus 894 μs ± 33.7 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each) %timeit net.gen[net.gen.in_service] 145 μs ± 3.75 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each) * fixed typo in comment * fixed _get_slack_weights * fixed some grid_equivalents tests fixed gen schema and create methods * fixed std_type containing nan for trafo * fixed boundary_testnet using ints in string column 'name' * fixed issue where empty series had incorrect index * fixed issue when accessing name column while not present * fixed creat_buses creating the elements before adding all values to entries fixed the test_get_exivalent.test_basic_usecases test * fixed use of is_object_dtype to determine if column can contain None/NaN/Null/NA elements. * refactored function for better legibility * add phases for sn_mva in asym load/sgen * fix bus create for opf parameter * fix bus test * fix test_grid_equivalents_auxiliary (test_trafo_phase_shifter) * tap_side fix in _calculate_3w_tap_changers * added not_ints_list in helper.py (#2798) * added not_ints_list in helper.py added tscs test file * fixed stuff * [fixed] test_optional_fields_with_nulls comment * [added] bus_dc pandera test * tcsc: changed optional test and name bus_dc: changed optional test and name bus: changed helper path * [added] test_pandera_dcline_elements.py * refactor * [added] test_pandera_asymetric_load_elements.py * [added] test_pandera_asymetric_sgen_elements.py * [fixed] bus schema check list * refactored code. trafo schema issue * [added] b2b_vsc pandera test * [added] bi_vsc pandera test [refactored] b2b_vsc. only has 1 optional. redundand tests * [added] ext_grid pandera test * [fixed] order in bus_create.py * added schema tests * fixed. bool type issue remains * added schema tests * added schema tests refactored code * fixed issues in trafo pandera test but still fails * added tests --------- Co-authored-by: David Heck <david.heck@iee.fraunhofer.de> * remove redundant test * fix sgen , line, lindc tests * fix storage tests * fix svc test * fix trafo and shunt tests * fix line test * fix tests * fix test_get_min_max_q_capability * fix for contingency * fix test_recycle_dc_trafo_shift * compare_tcsc_impedance * fix trafo test * fix test_ext_grid_gen_order_in_ppc * fix test_merge_with_characteristics * trafo and other smaller fixes * fix _add_dcline_gens * trafo and sc fixes * fix test_characteristic * fixes and sonarcube fixes * fix typing * fix test for change element name * fix network structre res vsc * rename bivsc to vscbipolar * add add column to df * Structure dict extension (#2882) * added not_ints_list in helper.py added tscs test file * fixed stuff * [fixed] test_optional_fields_with_nulls comment * [added] bus_dc pandera test * tcsc: changed optional test and name bus_dc: changed optional test and name bus: changed helper path * [added] test_pandera_dcline_elements.py * refactor * [added] test_pandera_asymetric_load_elements.py * [added] test_pandera_asymetric_sgen_elements.py * [fixed] bus schema check list * refactored code. trafo schema issue * [added] b2b_vsc pandera test * [added] bi_vsc pandera test [refactored] b2b_vsc. only has 1 optional. redundand tests * [added] ext_grid pandera test * [fixed] order in bus_create.py * added schema tests * fixed. bool type issue remains * added schema tests * added schema tests refactored code * fixed issues in trafo pandera test but still fails * added tests * updated vsc_bipolar test to use create function deleted old test file for bi_vsc --------- Co-authored-by: David Heck <david.heck@iee.fraunhofer.de> * fix for dev merge introduced errors * set controallable to default false when optional * fix tests * fix create controllable errors * fix name in ucte converter * fix trafo.df for ucte converter * fix stationcontrol * fix sonar warnings * Structure dict extension fixes (#2891) * fixed multiple issues in create * fix of api tests * fixed some tests * fixed rei_generation summing bools * fixed gird_equivalent tests fixed loadDC casting of bool col to boolean * fixed issue with incorrect dtypes set by cim converter. --------- Co-authored-by: Hjalmar Koertge <hkoertge@node3.omnia.cluster> * fix test_lightsim2grid_phase_shifters * structure dict extension more fixes (#2892) * fixed multiple issues in create * fix of api tests * fixed some tests * fixed rei_generation summing bools * fixed gird_equivalent tests fixed loadDC casting of bool col to boolean * fixed issue with incorrect dtypes set by cim converter. * ignore_errors should not be True if run_powerflow could fail * set default value for leakage_resistance_ratio_hv to 0.5 * compare default geodata with isna not isnan * fixed typo --------- Co-authored-by: Hjalmar Koertge <hkoertge@node3.omnia.cluster> * Issues/fixes in structure dict extension (#2900) * formatting improvements * fixed issue in runpp where voltage_depend_loads would not be disabled if conts params were not set * minor improvement in code complexity * fixed int passed as name to create_impedance * fixed typo in table name * readded missing line * fixed slack_weight for gen set without default in test network removed slack_weight on sgen: correct? * removed todo note * add default values to metadata * Issues/fixes in structure dict extension (#2904) * formatting improvements * fixed issue in runpp where voltage_depend_loads would not be disabled if conts params were not set * minor improvement in code complexity * fixed int passed as name to create_impedance * fixed typo in table name * readded missing line * fixed slack_weight for gen set without default in test network removed slack_weight on sgen: correct? * removed todo note * fixed test failing because of missing columns in dcline changed check, nan in these columns would not fail so no column should also not fail * fixed test_q_capability_curve failing due to missing column * formatting and typo fixes * added missing reactive_capability_curve column to sgen test net. * fixed missing columns in ucte converter minor typo fixes * fixed shunt characteristic table diagnostic test. * fixed trafo characteristic table diagnostic test. * improvement in lightsim2grid error logging * parameterized test and added skip for a case that fails from error in a dependencie * Issues/fixes in structure dict extension (#2920) * skips for tests erroring because of issue in lightsim2grid * added missing columns to test_qlimits_with_capability_curve test * added column sorting to add_column_to_df * fixed issue in test_from_mpc_mat * updated comment in test_from_mpc.py * fixed ucte converter not creating all required columns * fixed ppc test * added missing column max_vm_pu for rei test * added missing columns min_q_mvar and max_q_mvar to sgen for BinarySearchControl * fix BinarySearchControl * introduce cim metadata, create columns for cim2pp from schemata, all networkcreation with given structure * fix _update_min_max_q_mvar for station_control * Fix facts structure dict extension (#2922) * added missing column slack_weight to test_svc_tcsc_case_study test * added temporary skip for PGM tests due to issue in their converter * added controllable=True to gens for test_only_gen_slack_vm_setpoint * added missing columns to gen table for test_gen_violated_p_vm_limits minor improvement in warning for opf param check * added missing columns to gen table for test_gen_p_vm_limits * added missing columns to gen table for test_cost_piecewise_linear_eg * added missing columns to gen table for test_minimize_active_power_curtailment * added missing columns to dcline table for test_opf_task fixed issue in validate_opf_input.py * fixes for cim2pp * fix mypy * fix todos * updated docstings (#2934) deprecated unused keyword args * add ucte converter tags * fix bool defaults * Feature/get all elements (#2939) * Hallo * Hallo Leute * adding first draft of simple_hl_plot a function to easily highlight buses and lines paired with a hover functionality * added function to get a dataframe of all elements in the net * add test clean comments renaming * add test * add docu * add changelog entry * ltds_fix (#2938) * updated ltds notebooks * updated ltds notebooks, fixed LTDS converter * added pytest split to tutorial_test pipeline (#2935) * added pytest split to tutorial_test pipeline * added notebook test times * added names to pandera schema * removed old manual .csv files * fixed many links (#2937) other formatting Co-authored-by: V3 <mike.vogt@iee.fraunhofer.de> * update pandera version * set pandera version interval * set pandaer 0.29.0 as max version * readded removed csv files that are not generated added generated csv folder to .gitignore * added sphinx extension for generating csv files updated .rst to use generated csv files * added missing schemas to __init__.py fixed incorrect schema name * added css for rtd theme * updated sphinx extension and schema to enable hiding columns from doc tables * improved sizing of pandapower logo with wider rtd layout * added custom theming * added updated logo and text logo for custom theming * added image link targets * Fix copyright text formatting in LICENSE file (#2914) * Fix copyright text formatting in LICENSE file * Refactor copyright notice in LICENSE Updated copyright notice formatting in LICENSE file following [upstream changes](licensee/licensee#950) to handle multi-line attribution. --------- Co-authored-by: KS_HTK <2981026+KS-HTK@users.noreply.github.com> * Renamed sections Removed * notes under Table Structures * added PowerElectronicsConnection to the LTDS converter, updated LTDS notebooks (PowerElectronicsConnection) (#2942) Co-authored-by: David Heck <david.heck@iee.fraunhofer.de> * fixes from review * ltds_pce (#2944) * added PowerElectronicsConnection to the LTDS converter, updated LTDS notebooks (PowerElectronicsConnection) * updated LTDS notebooks for mapping Excel data * ltds_notebook (#2949) * updated ltds notebooks * updated LTDS notebooks for mapping Excel data * updated LTDS notebooks for mapping Excel data * ltds_notebook (#2950) * updated ltds notebooks * updated LTDS notebooks for mapping Excel data * updated LTDS notebooks for mapping Excel data * UKPN Jupiter Notebook * fix UKPN Jupiter Notebook * Feature check vkr percent (#2948) * added check to check if vkr_percent values are reasonable. * added changelog entry. --------- Co-authored-by: KS_HTK <2981026+KS-HTK@users.noreply.github.com> * Feature additional diagnostic functions (#2952) * added more diagnostic functions. * added changelog entry. * fixed a small bug, used the wrong value in the reactance field. * Correct loading_percent description in motor_par.csv (#2947) Updated the description of loading_percent. * ucte2pp conversion fixes (#2823) * consider empty R dataframe in ucte conversion * convert impedances and trafos with G/B=NaN to G/B=0 * change fillna for trafos and impedances to the ucte_parser * fillna df if 0 * fix nan values in impedances and trafos * ucte2pp: averaging voltages and clean up parser * changelog entries for ucte2pp fixes * average voltage setpoints using topological search instead of ucte name * empty space at EOF * fix codacy issue * remove create_switch from pp_import_functions * fix create_vsc functions * changelog :) * change symmetrical tap changer to 90 degree tap step degree * correct handling of symmetrical PSTs in ucte2pp * comment averaging function based on PR review * changes ucte converter * ucte2pp: add flag for voltage harmonization, with default false * fix test * fix tests and restrict tolerances a bit --------- Co-authored-by: mrichter <mario.richter@iee.fraunhofer.de> Co-authored-by: V3 <mike.vogt@iee.fraunhofer.de> * Fix 2733 (#2951) * change patch sizes for plot (#2733) * fix patch sizes for plot only once (#2733) `get_collection_sizes()` takes arguments to adjust the relative size of an element. --------- Co-authored-by: V3 <mike.vogt@iee.fraunhofer.de> * Fix runopp(init="results") so the OPF solver preserves the model initial vector (#2902) * Fix runopp(init=results) warm-start handling in pips OPF * Update CHANGELOG for upcoming release fixes and features --------- Co-authored-by: jereOG <jerelang@users.noreply.github.com> Co-authored-by: V3 <mike.vogt@iee.fraunhofer.de> * Feature/highlight plot (#2833) * integrated highlighting feature into simple_plot * integrated hover feature into simple_plot * update plotting tutorial * adjust color * fixes for review * typing for for network_create * updated pandera version to fix tests on 3.14 * updated to now branding * due to high amount of test the pipeline has been split more. * added explanation comment * removed slow python version 3.10 from pandera tests * reduced numpy1-support splits as it no longer tests the network schema * fixed network schema coverage report same name as normal report error * fix for pq_control trying to access nonexistent columns * Fixed issues resulting from merge * Fixed issues resulting from merge * Removed duplicate function definition from merge * Removed duplicate import --------- Co-authored-by: Mike Vogt <mike.vogt@iee.fraunhofer.de> Co-authored-by: David Heck <david.heck@iee.fraunhofer.de> Co-authored-by: FynnIEE <fynn.torben.mehlig@iee.fraunhofer.de> Co-authored-by: David Heck <david@heck.info> Co-authored-by: lezneew <wenzelgri@gmail.com> Co-authored-by: Hjalmar Koertge <hkoertge@node3.omnia.cluster> Co-authored-by: paul david heck <pheck@cpu5.omnia.cluster> Co-authored-by: Jan Wiemer <32835953+jwiemer112@users.noreply.github.com> Co-authored-by: mrifraunhofer <94368111+mrifraunhofer@users.noreply.github.com> Co-authored-by: Bryn Pickering <17178478+brynpickering@users.noreply.github.com> Co-authored-by: Arisaka97 <solitaire2312@gmail.com> Co-authored-by: pawellytaev <86314586+pawellytaev@users.noreply.github.com> Co-authored-by: mrichter <mario.richter@iee.fraunhofer.de> Co-authored-by: Moritz <29129441+MoritzHauff@users.noreply.github.com> Co-authored-by: Jeremias Lang <158100420+jerelang@users.noreply.github.com> Co-authored-by: jereOG <jerelang@users.noreply.github.com>
1 parent da64267 commit 0f47884

147 files changed

Lines changed: 22425 additions & 2787 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/github_test_action.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,42 @@ jobs:
6868
name: coverage-${{ matrix.group }}
6969
path: ./coverage-${{ matrix.group }}.xml
7070

71+
network_schema:
72+
# This tests only the network_schema tests due to the large amount these are only tested on min/max python version
73+
runs-on: ubuntu-latest
74+
timeout-minutes: 20
75+
strategy:
76+
matrix:
77+
#python-version: ['3.10', '3.14']
78+
# Reminder: when removing the support of an old python version here, then don't forget to
79+
# remove it also in pyproject.toml 'requires-python' and the release pipelines
80+
group: [ 1, 2, 3, 4 ]
81+
steps:
82+
# - uses: julia-actions/setup-julia # Update version when using this by adding commit sha!
83+
- uses: actions/checkout@v6
84+
- name: Install uv
85+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
86+
with:
87+
#python-version: ${{ matrix.python-version }}
88+
python-version: '3.14'
89+
- name: Install dependencies
90+
run: |
91+
uv sync --extra dev
92+
uv pip install pytest-split
93+
- name: List of installed packages
94+
run: |
95+
uv pip list
96+
- name: Test with pytest, Codecov and Coverage
97+
run: |
98+
uv pip install pytest-cov numpy~=1.26
99+
uv run pytest --cov=./ --cov-report=xml --splits 4 --group ${{ matrix.group }} pandapower/test/network_schema
100+
cp ./coverage.xml ./coverage-net-schema-${{ matrix.group }}.xml
101+
- name: Upload coverage as artifact
102+
uses: actions/upload-artifact@v7
103+
with:
104+
name: coverage-net-schema-${{ matrix.group }}
105+
path: ./coverage-net-schema-${{ matrix.group }}.xml
106+
71107
numpy1-support:
72108
runs-on: ubuntu-latest
73109
timeout-minutes: 20
@@ -209,7 +245,7 @@ jobs:
209245
strategy:
210246
matrix:
211247
python-version: ['3.14']
212-
group: [ 1, 2 ]
248+
group: [ 1, 2, 3, 4 ]
213249
steps:
214250
- uses: actions/checkout@v6
215251
- name: Install uv
@@ -226,7 +262,7 @@ jobs:
226262
uv pip list
227263
- name: Test with pytest
228264
run: |
229-
uv run pytest -W error --splits 2 --group ${{ matrix.group }}
265+
uv run pytest -W error --splits 4 --group ${{ matrix.group }}
230266
231267
relying: # packages that rely on pandapower
232268
needs: build
@@ -384,6 +420,9 @@ jobs:
384420
tutorial_warnings_tests:
385421
needs: build
386422
runs-on: ubuntu-latest
423+
strategy:
424+
matrix:
425+
group: [ 1, 2, 3 ]
387426
steps:
388427
# UV does not work for julia, do not add it here!
389428
- uses: actions/checkout@v6
@@ -395,7 +434,7 @@ jobs:
395434
python -m pip list
396435
- name: Test with pytest
397436
run: |
398-
pytest -W error --nbmake --nbmake-timeout=900 --timeout=900 "./tutorials"
437+
pytest -W error --splits 3 --group ${{ matrix.group }} --nbmake --nbmake-timeout=900 --timeout=900 "./tutorials"
399438
400439
docs_check:
401440
needs: build

.github/workflows/test_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
matrix:
2323
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
2424
os: [ ubuntu-latest, windows-latest ]
25-
group: [ 1, 2 ]
25+
group: [ 1, 2, 3, 4 ]
2626

2727
steps:
2828
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
@@ -58,4 +58,4 @@ jobs:
5858
5959
- name: Test with pytest
6060
run: |
61-
uv run pytest --splits 2 --group ${{ matrix.group }}
61+
uv run pytest --splits 4 --group ${{ matrix.group }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pandapower.egg-info/
1111
doc/api/
1212
doc/.build/*
1313
doc/_build/*
14+
doc/elements/table_structures/
1415
*.ipynb_checkpoints
1516
.cache
1617
*__pycache__*

.test_durations

Lines changed: 21428 additions & 1216 deletions
Large diffs are not rendered by default.

doc/_exts/__init__.py

Whitespace-only changes.

doc/_exts/gen_csv.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
"""
2+
Sphinx extension for generating the element csv's for pandapower use.
3+
"""
4+
import os
5+
import shutil
6+
7+
import json
8+
import pandas as pd
9+
from pandera.api.pandas.container import DataFrameSchema
10+
11+
file_path = os.path.dirname(os.path.realpath(__file__))
12+
13+
check_name_to_symbol: dict[str, str] = {
14+
"greater_than": ">",
15+
"greater_than_or_equal_to": ">=",
16+
"less_than": "<",
17+
"less_than_or_equal_to": "<=",
18+
"isin": ""
19+
}
20+
21+
dtype_to_str: dict[str, str] = {
22+
"float64": "float",
23+
"string[python]": "string",
24+
"str": "string",
25+
"int64": "int",
26+
"Int64": "int",
27+
"bool": "bool",
28+
"boolean": "bool",
29+
"": "",
30+
}
31+
32+
bool_to_checkmark: dict[bool, str] = {
33+
True: '✓',
34+
False: pd.NA
35+
}
36+
37+
def get_dtype(dtype: str):
38+
if dtype in dtype_to_str:
39+
return dtype_to_str[dtype]
40+
print(f"Unknown dtype {dtype}")
41+
return ""
42+
43+
def create_docu_csv_from_schema(schema: DataFrameSchema, path: str, filename: str | None = None):
44+
schema_json = schema.to_json()
45+
schema_dict = json.loads(schema_json)
46+
47+
columns_info = []
48+
49+
def get_checks(checks: list):
50+
if checks is None:
51+
return pd.NA
52+
53+
for check in checks:
54+
if check["options"]["check_name"] == "in_range":
55+
return f"[{check['min_value']}, {check['max_value']}]"
56+
return f"{check_name_to_symbol[check["options"]["check_name"]]}{check['value']}"
57+
return pd.NA
58+
59+
def _get_metadata(name: str, kind: str, default: bool = False):
60+
metadata = schema.columns[name].metadata
61+
if metadata is None:
62+
return default
63+
return metadata.get(kind, default)
64+
65+
for col_name, col_details in schema_dict["columns"].items():
66+
columns_info.append(
67+
{
68+
"Parameter": col_name,
69+
"Datatype": get_dtype(col_details.get("dtype", "")),
70+
"Value Range": get_checks(col_details.get("checks")),
71+
"Explanation": col_details.get("description", ""),
72+
"nullable": bool_to_checkmark[col_details.get("nullable", True)],
73+
"required": bool_to_checkmark[col_details.get("required", False)],
74+
"optimal power flow": bool_to_checkmark[_get_metadata(col_name, "opf")],
75+
"short circuit": bool_to_checkmark[_get_metadata(col_name, "sc")],
76+
"3ph": bool_to_checkmark[_get_metadata(col_name, "3ph")],
77+
"tdpf": bool_to_checkmark[_get_metadata(col_name, "tdpf")],
78+
"doc": _get_metadata(col_name, "doc", True),
79+
}
80+
)
81+
82+
# Create CSV with column metadata
83+
df = pd.DataFrame(columns_info)
84+
# Drop rows that should not appear in documentation and the doc column:
85+
df = df[df.doc == True]
86+
df = df.drop(columns=["doc"])
87+
# Drop empty columns
88+
df = df.dropna(how='all', axis=1)
89+
# fill NA fields with empty string
90+
df = df.fillna('')
91+
92+
# pd.set_option("display.max_columns", None)
93+
# print(df)
94+
if filename is None:
95+
if schema.name:
96+
filename = f"{schema.name}.csv"
97+
else:
98+
filename = "column_schema.csv"
99+
df.to_csv(os.path.join(path, filename), index=False)
100+
101+
102+
def gen_csv(_):
103+
import pandapower.network_schema as net_schema
104+
105+
path = os.path.join(file_path, '..', 'elements', 'table_structures')
106+
if os.path.isdir(path):
107+
shutil.rmtree(path)
108+
os.makedirs(path)
109+
print("Generating element csv files")
110+
schemas = [getattr(net_schema, s) for s in dir(net_schema) if isinstance(getattr(net_schema, s), DataFrameSchema)]
111+
for schema in schemas:
112+
create_docu_csv_from_schema(schema, path)
113+
114+
115+
def setup(app):
116+
app.connect('builder-inited', gen_csv)
117+
return {'version': '0.1'}
118+
119+
120+
if __name__ == '__main__':
121+
gen_csv(None)

doc/_static/theme.css

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/* Fraunhofer Corporate Colors */
2+
:root {
3+
/* blues */
4+
--fh-1: rgb(212, 230, 244);
5+
--fh-2: rgb(136, 188, 226);
6+
--fh-3: rgb(31, 130, 192);
7+
--fh-4: rgb(0, 90, 148);
8+
--fh-5: rgb(0, 52, 107);
9+
/* purples */
10+
--fh-6: rgb(199, 193, 222);
11+
--fh-7: rgb(144, 133, 186);
12+
--fh-8: rgb(57, 55, 139);
13+
--fh-9: rgb(41, 40, 106);
14+
/* reds */
15+
--custom-10: rgb(255, 185, 185);
16+
--fh-10: rgb(226, 0, 26);
17+
--fh-11: rgb(158, 28, 34);
18+
--fh-12: rgb(119, 28, 44);
19+
/* oranges */
20+
--fh-13: rgb(254, 234, 201);
21+
--fh-14: rgb(251, 203, 140);
22+
--fh-15: rgb(242, 148, 0);
23+
--fh-16: rgb(235, 106, 10);
24+
/* yellows */
25+
--fh-17: rgb(255, 250, 209);
26+
--fh-18: rgb(255, 243, 129);
27+
--fh-19: rgb(255, 220, 0);
28+
--fh-20: rgb(253, 195, 0);
29+
/* greens */
30+
--fh-21: rgb(238, 239, 177);
31+
--fh-22: rgb(209, 221,130);
32+
--fh-23: rgb(177, 200, 0);
33+
--fh-24: rgb(143, 164, 2);
34+
--fh-25: rgb(106, 115, 65);
35+
/* teals */
36+
--custom-26: rgb(220, 255, 240);
37+
--fh-26: rgb(180, 220, 211);
38+
--fh-27: rgb(109, 191, 169);
39+
--fh-28: rgb(23, 156, 125);
40+
/* brows? */
41+
--fh-29: rgb(215, 225, 201);
42+
--fh-30: rgb(203, 175, 115);
43+
--fh-31: rgb(70, 41, 21);
44+
--fh-32: rgb(76, 99, 111);
45+
/* blues again */
46+
--fh-33: rgb(51, 184, 202);
47+
--fh-34: rgb(37, 186, 226);
48+
--fh-35: rgb(0, 110, 146);
49+
/* silver */
50+
--fh-36: rgb(199, 202, 204);
51+
/* Font */
52+
--fh-font: FrutigerLTW02-45Light;
53+
}
54+
55+
.wy-nav-content {
56+
max-width: calc(100vw - 300px);
57+
}
58+
59+
.wy-side-nav-search {
60+
background-color: var(--fh-27) !important;
61+
}
62+
63+
.sig.py {
64+
background-color: var(--custom-26) !important;
65+
border-top-color: var(--fh-28) !important;
66+
}
67+
68+
.admonition {
69+
background: var(--custom-26) !important;
70+
}
71+
.admonition > .admonition-title {
72+
background: var(--fh-28) !important;
73+
}
74+
75+
.admonition.warning,
76+
.admonition.attention,
77+
.admonition.caution,
78+
.admonition.important {
79+
background: var(--fh-13) !important;
80+
}
81+
.admonition.warning > .admonition-title,
82+
.admonition.attention > .admonition-title,
83+
.admonition.caution > .admonition-title,
84+
.admonition.important > .admonition-title {
85+
background: var(--fh-15) !important;
86+
}
87+
88+
.admonition.danger,
89+
.admonition.error {
90+
background: var(--custom-10) !important;
91+
}
92+
.admonition.danger > .admonition-title,
93+
.admonition.error > .admonition-title {
94+
background: var(--fh-10) !important;
95+
}
96+
97+
.admonition.hint,
98+
.admonition.tip {
99+
background: var(--fh-21) !important;
100+
}
101+
.admonition.hint > .admonition-title,
102+
.admonition.tip > .admonition-title {
103+
background: var(--fh-24) !important;
104+
}
105+
106+
.highlight {
107+
background: var(--fh-17);
108+
}
109+
110+
.filled {
111+
fill: white !important;
112+
}

doc/about.rst

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ pandapower combines the data analysis library `pandas <https://pandas.pydata.org
66
`PYPOWER <https://pypi.org/project/PYPOWER/>`_ to create an easy to use network calculation program
77
aimed at automation of analysis and optimization in power systems.
88

9-
.. image:: /pics/pandapower_color.svg
10-
:width: 250em
9+
.. image:: /pics/pandapower_color.png
10+
:target: http://pandapower.org/
11+
:width: 30em
1112
:align: left
1213

13-
.. |br| raw:: html
14-
15-
<br />
16-
17-
|br|
18-
|br|
19-
|br|
14+
|
15+
|
16+
|
17+
|
18+
|
19+
|
2020
2121
More information about pandapower can be found on `www.pandapower.org <https://www.pandapower.org>`_.
2222

@@ -39,18 +39,20 @@ pandapower is a joint development of the research group of the Department for Su
3939
Operation at the Fraunhofer Institute for Energy Economics and Energy System Technology (IEE), Kassel.
4040

4141
.. image:: /pics/iee.png
42-
:width: 18em
43-
:align: left
42+
:target: https://iee.fraunhofer.de/
43+
:width: 18em
44+
:align: left
4445

4546
.. image:: /pics/e2n.png
46-
:width: 22em
47-
:align: right
47+
:target: https://uni-kassel.de/eecs/e2n/
48+
:width: 22em
49+
:align: left
4850

4951

50-
|br|
51-
|br|
52-
|br|
53-
|br|
52+
|
53+
|
54+
|
55+
|
5456
5557

5658
.. toctree::

0 commit comments

Comments
 (0)