Skip to content

Commit

Permalink
Working on correcting minor problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiwahada committed Oct 31, 2024
1 parent 863e95a commit a8e799d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

black~=23.7.0
isort~=5.12.0
matplotlib>=3.5.1
mypy~=1.7.1
pandas-stubs
pytest-cov
Expand Down
15 changes: 6 additions & 9 deletions src/antares/tsgen/ts_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ def _check_cluster(cluster: ThermalCluster) -> None:

_check_array(cluster.modulation < 0, "Hourly modulation is negative on following hours")

lengths = _check_lengths(cluster.outage_gen_params)
if len(lengths) != 1:
raise ValueError(f"Not all daily arrays have same size, got {lengths}")
_check_lengths(cluster.outage_gen_params)


def _check_link_capacity(link_capacity: LinkCapacity) -> None:
Expand All @@ -148,13 +146,10 @@ def _check_link_capacity(link_capacity: LinkCapacity) -> None:
_check_array(link_capacity.modulation_direct < 0, "Hourly direct modulation is negative on following hours")
_check_array(link_capacity.modulation_indirect < 0, "Hourly indirect modulation is negative on following hours")

lengths = _check_lengths(link_capacity.outage_gen_params)

if len(lengths) != 1:
raise ValueError(f"Not all daily arrays have same size, got {lengths}")
_check_lengths(link_capacity.outage_gen_params)


def _check_lengths(outage_gen_params: OutageGenerationParameters) -> set[int]:
def _check_lengths(outage_gen_params: OutageGenerationParameters) -> None:
lengths = {
len(a)
for a in [
Expand All @@ -166,7 +161,9 @@ def _check_lengths(outage_gen_params: OutageGenerationParameters) -> set[int]:
outage_gen_params.npo_max,
]
}
return lengths

if len(lengths) != 1:
raise ValueError(f"Not all daily arrays have same size, got {lengths}")


class OutageOutput:
Expand Down
1 change: 0 additions & 1 deletion tests/test_duration_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#
# This file is part of the Antares project.

import matplotlib.pyplot as plt
import pytest

from antares.tsgen.duration_generator import (
Expand Down

0 comments on commit a8e799d

Please sign in to comment.