Skip to content

Commit

Permalink
change renewable_id for cluster_id
Browse files Browse the repository at this point in the history
  • Loading branch information
killian-scalian committed Dec 3, 2024
1 parent a618d42 commit 3847aa1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/antares/service/api_services/renewable_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ def update_renewable_properties(

return new_properties

def get_renewable_matrix(self, renewable_id: str, area_id: str) -> pd.DataFrame:
def get_renewable_matrix(self, cluster_id: str, area_id: str) -> pd.DataFrame:
try:
path = (
PurePosixPath("input")
/ "renewables"
/ "series"
/ f"{area_id}"
/ f"{renewable_id}"
/ f"{cluster_id}"
/ "series"
)
return get_matrix(f"{self._base_url}/studies/{self.study_id}/raw?path={path}", self._wrapper)
except APIError as e:
raise RenewableMatrixDownloadError(area_id, renewable_id, e.message) from e
raise RenewableMatrixDownloadError(area_id, cluster_id, e.message) from e

def read_renewables(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/antares/service/base_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,12 @@ def update_renewable_properties(

@abstractmethod
def get_renewable_matrix(
self, renewable_id: str, area_id: str
self, cluster_id: str, area_id: str
) -> pd.DataFrame:
"""
Args:
renewable: renewable cluster to retrieve matrix
cluster_id: renewable cluster id to retrieve matrix
area_id: area id to retrieve matrix
Returns: matrix requested
"""
Expand Down
4 changes: 2 additions & 2 deletions src/antares/service/local_services/renewable_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def update_renewable_properties(

def get_renewable_matrix(
self,
renewable_id: str,
cluster_id: str,
area_id: str
) -> pd.DataFrame:
return read_timeseries(TimeSeriesFileType.RENEWABLE_DATA_SERIES, self.config.study_path, area_id=area_id, renewable_id=renewable_id)
return read_timeseries(TimeSeriesFileType.RENEWABLE_DATA_SERIES, self.config.study_path, area_id=area_id, cluster_id=cluster_id)


def read_renewables(self, area_id: str) -> List[RenewableCluster]:
Expand Down
6 changes: 3 additions & 3 deletions src/antares/tools/matrix_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def df_read(path: Path) -> pd.DataFrame:
return pd.read_csv(path, sep="\t", header=None)


def read_timeseries(ts_file_type: TimeSeriesFileType, study_path: Path, area_id: Optional[str] = None, constraint_id: Optional[str] = None, renewable_id: Optional[str] = None,) -> pd.DataFrame:
def read_timeseries(ts_file_type: TimeSeriesFileType, study_path: Path, area_id: Optional[str] = None, constraint_id: Optional[str] = None, cluster_id: Optional[str] = None,) -> pd.DataFrame:
file_path = study_path / (
ts_file_type.value
if not (area_id or constraint_id or renewable_id)
else ts_file_type.value.format(area_id=area_id, constraint_id=constraint_id, renewable_id=renewable_id)
if not (area_id or constraint_id or cluster_id)
else ts_file_type.value.format(area_id=area_id, constraint_id=constraint_id, cluster_id=cluster_id)
)
if os.path.getsize(file_path) != 0:
_time_series = df_read(file_path)
Expand Down
2 changes: 1 addition & 1 deletion src/antares/tools/time_series_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TimeSeriesFileType(Enum):
WIND_DATA = "input/wind/prepro/{area_id}/data.txt"
WIND_K = "input/wind/prepro/{area_id}/k.txt"
WIND_TRANSLATION = "input/wind/prepro/{area_id}/translation.txt"
RENEWABLE_DATA_SERIES = "input/renewables/series/{area_id}/{renewable_id}/series.txt"
RENEWABLE_DATA_SERIES = "input/renewables/series/{area_id}/{cluster_id}/series.txt"


class TimeSeries:
Expand Down

0 comments on commit 3847aa1

Please sign in to comment.