Skip to content

Commit

Permalink
finalize work only need to add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Nov 27, 2024
1 parent f589790 commit 2a2ebdf
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/antares/service/api_services/area_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,18 @@ def get_matrix(self, area_id: str, series_path: str, matrix_type: str) -> pd.Dat
def get_load_matrix(self, area: Area) -> pd.DataFrame:
return self.get_matrix(area.id, f"input/load/series/load_{area.id}", "load")

def get_solar_matrix(self, area: Area) -> pd.DataFrame:
return self.get_matrix(area.id, f"input/solar/series/solar_{area.id}", "solar")

def get_wind_matrix(self, area: Area) -> pd.DataFrame:
return self.get_matrix(area.id, f"input/wind/series/wind_{area.id}", "wind")

def get_reserves_matrix(self, area: Area) -> pd.DataFrame:
return self.get_matrix(area.id, f"input/reserves/{area.id}", "reserves")

def get_misc_gen_matrix(self, area: Area) -> pd.DataFrame:
return self.get_matrix(area.id, f"input/misc-gen/miscgen-{area.id}", "misc-gen")

def craft_ui(self, url_str: str, area_id: str) -> AreaUi:
response = self._wrapper.get(url_str)
json_ui = response.json()[area_id]
Expand Down
33 changes: 33 additions & 0 deletions src/antares/service/base_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,39 @@ def get_load_matrix(self, area: Area) -> pd.DataFrame:
"""
# Currently we do not return index and column names.
# Once AntaresWeb will introduce specific endpoint for each matrix it will perhaps change.
# Same goes for other endpoints getting input matrices.
pass

@abstractmethod
def get_reserves_matrix(self, area: Area) -> pd.DataFrame:
"""
Args:
area: concerned area.
"""
pass

@abstractmethod
def get_misc_gen_matrix(self, area: Area) -> pd.DataFrame:
"""
Args:
area: concerned area.
"""
pass

@abstractmethod
def get_solar_matrix(self, area: Area) -> pd.DataFrame:
"""
Args:
area: concerned area.
"""
pass

@abstractmethod
def get_wind_matrix(self, area: Area) -> pd.DataFrame:
"""
Args:
area: concerned area.
"""
pass


Expand Down
12 changes: 12 additions & 0 deletions src/antares/service/local_services/area_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,18 @@ def delete_st_storages(self, area: Area, storages: List[STStorage]) -> None:
def get_load_matrix(self, area: Area) -> pd.DataFrame:
raise NotImplementedError

def get_solar_matrix(self, area: Area) -> pd.DataFrame:
raise NotImplementedError

def get_wind_matrix(self, area: Area) -> pd.DataFrame:
raise NotImplementedError

def get_reserves_matrix(self, area: Area) -> pd.DataFrame:
raise NotImplementedError

def get_misc_gen_matrix(self, area: Area) -> pd.DataFrame:
raise NotImplementedError

def read_areas(self) -> List[Area]:
local_path = self.config.local_path
areas_path = local_path / self.study_name / "input" / "areas"
Expand Down

0 comments on commit 2a2ebdf

Please sign in to comment.