Skip to content

Commit

Permalink
Remove duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
olejandro committed Mar 13, 2024
1 parent 6344590 commit ffa2a29
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions xl2times/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,32 +403,6 @@ def merge_tables(
return result


def apply_composite_tag(table: datatypes.EmbeddedXlTable) -> datatypes.EmbeddedXlTable:
"""
Handles table level declarations. Declarations can be included in the table
tag and will apply to all data that doesn't have a different value for that
index specified. For example, ~FI_T: DEMAND would assign DEMAND as the
attribute for all values in the table that don't have an attribute specification
at the column or row level. After applying the declaration this function will
return the modified table with the simplified table tag (e.g. ~FI_T).
See page 15 of https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-IV.pdf
for more context.
:param table: Table in EmbeddedXlTable format.
:return: Table in EmbeddedXlTable format with declarations applied
and table tag simplified.
"""
if ":" in table.tag:
(newtag, varname) = table.tag.split(":")
varname = varname.strip()
df = table.dataframe.copy()
df["attribute"] = df["attribute"].fillna(varname)
return replace(table, tag=newtag, dataframe=df)
else:
return table


def apply_tag_specified_defaults(
config: datatypes.Config,
tables: List[datatypes.EmbeddedXlTable],
Expand Down

0 comments on commit ffa2a29

Please sign in to comment.