Skip to content

Commit

Permalink
Fix output download column filter (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang authored Dec 6, 2021
1 parent ad372cd commit d9fabe6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 3 additions & 9 deletions antarest/study/storage/study_download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class StudyDownloader:
@staticmethod
def read_columns(
matrix: MatrixAggregationResult,
prefix: str,
year: int,
area_name: str,
study: FileStudyTree,
Expand All @@ -52,11 +51,10 @@ def read_columns(

for index, column in enumerate(columns):
column_name = "|".join([c for c in column if c.strip()])
filter_column_name = prefix + "|" + column_name
if (
data.columns
and len(data.columns) > 0
and not (filter_column_name in data.columns)
and not (column_name in data.columns)
):
continue

Expand All @@ -80,7 +78,6 @@ def read_columns(
@staticmethod
def level_output_filter(
matrix: MatrixAggregationResult,
prefix: str,
year: int,
area_name: str,
study: FileStudyTree,
Expand All @@ -96,7 +93,7 @@ def level_output_filter(
for elm in files_matcher:
tmp_url = f"{url}/{elm}"
StudyDownloader.read_columns(
matrix, prefix, year, area_name, study, tmp_url, data
matrix, year, area_name, study, tmp_url, data
)

@staticmethod
Expand All @@ -120,21 +117,18 @@ def apply_type_filters(
if type_elm[elm].links:
for out_link in type_elm[elm].links.keys():
if second_element_type_condition(out_link):
tmp_prefix = f"{prefix}|{elm}^{out_link}"
link_url = f"{url}/{out_link}"
StudyDownloader.level_output_filter(
matrix,
tmp_prefix,
year,
f"{elm}^{out_link}",
study,
link_url,
data,
)
else:
tmp_prefix = f"{prefix}|{elm}"
StudyDownloader.level_output_filter(
matrix, tmp_prefix, year, elm, study, url, data
matrix, year, elm, study, url, data
)

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ mkdocs
mkdocs-material
sphinx
myst-parser

4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
-r antares-launcher/requirements.txt
# freezed
mistune==0.8.4
m2r==0.2.1

jsonref==0.2
PyYAML==5.3.1
filelock==3.0.12
Expand Down

0 comments on commit d9fabe6

Please sign in to comment.