Skip to content

Commit

Permalink
resolve other comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Jan 31, 2024
1 parent 5a36118 commit a3086d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions antarest/study/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def __init__(
self.xpansion_manager = XpansionManager(self.storage_service)
self.matrix_manager = MatrixManager(self.storage_service)
self.binding_constraint_manager = BindingConstraintManager(self.storage_service)
self.correlation_manager = CorrelationManager(self.storage_service)
self.cache_service = cache_service
self.config = config
self.on_deletion_callbacks: t.List[t.Callable[[str], None]] = []
Expand Down Expand Up @@ -2446,7 +2447,7 @@ def get_matrix_with_index_and_header(
if aggregate == "allocation":
hydro_matrix = self.allocation_manager.get_allocation_matrix(study, all_areas)
else:
hydro_matrix = CorrelationManager(self.storage_service).get_correlation_matrix(all_areas, study, []) # type: ignore
hydro_matrix = self.correlation_manager.get_correlation_matrix(all_areas, study, []) # type: ignore
return pd.DataFrame(data=hydro_matrix.data, columns=hydro_matrix.columns, index=hydro_matrix.index)

json_matrix = self.get(study_id, path, depth=3, formatted=True, params=parameters)
Expand All @@ -2465,7 +2466,7 @@ def get_matrix_with_index_and_header(
df_matrix.index = time_column

for specific_matrix in SPECIFIC_MATRICES:
if re.compile(specific_matrix).match(path):
if re.match(specific_matrix, path):
return _handle_specific_matrices(
int(study.version),
df_matrix,
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/raw_studies_blueprint/test_download_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ def test_download_matrices(self, client: TestClient, admin_access_token: str, st
"('HURDLE COST', 'Euro', '')",
]

# test energy matrix to test the regex
res = client.get(
f"/v1/studies/{study_id}/raw/download?path=input/hydro/prepro/de/energy&format=csv",
headers=admin_headers,
)
assert res.status_code == 200
content = io.BytesIO(res.content)
dataframe = pd.read_csv(content, index_col=0, sep="\t")
assert dataframe.empty

# =============================
# ERRORS
# =============================
Expand Down

0 comments on commit a3086d9

Please sign in to comment.