Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions message_ix/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ def add_par(
| dict
| pd.DataFrame
| None = None,
value: float | Iterable[float] | None = None,
unit: str | Iterable[str] | None = None,
comment: str | Iterable[str] | None = None,
value: float | Sequence[float] | None = None,
unit: str | Sequence[str] | None = None,
comment: str | Sequence[str] | None = None,
) -> None:
# ixmp.Scenario.add_par() is typed as accepting only str, but this method also
# accepts int for "year"-like dimensions. Proxy the call to avoid type check
Expand Down
8 changes: 4 additions & 4 deletions message_ix/tools/add_year/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def idx_check(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame:
d_n = slice_df(df_yrs, idx, year_ref, [yr_nn], yr)
d_n = d_n.loc[d_n.index.isin(d.index), :]
d = d.loc[d.index.isin(d_n.index), :]
d[d.isnull() & d_n.notnull()] = d_n
d[d.isnull() & d_n.notnull()] = d_n # type: ignore [call-overload]
df2.loc[df2.index.isin(d.index), :] = d

cond1 = df_dur.index <= yr_diff_new[0]
Expand Down Expand Up @@ -910,15 +910,15 @@ def idx_check(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame:
) # type: ignore
df_yr[np.isinf(df_pre)] = df_pre

# For those technolofies with one value for each year
# For those technologies with one value for each year
df_to_fill_nans: pd.DataFrame = intpol(
df_pre, df_pp.shift(+1, axis=1), year_pre, year_pp, yr
) # type: ignore
df_yr.loc[pd.isna(df_yr[yr])] = df_to_fill_nans.shift(+1, axis=1)
df_yr[pd.isna(df_yr)] = df_pre
df_yr[pd.isna(df_yr)] = df_pre # type: ignore [call-overload]

if extrapol_neg:
df_yr[(df_yr < 0) & (df_pre >= 0)] = df_pre * extrapol_neg
df_yr[(df_yr < 0) & (df_pre >= 0)] = df_pre * extrapol_neg # type: ignore [call-overload]
df_yr.loc[:, df_yr.columns < str(yr)] = np.nan

# c) Otherwise, do intrapolation
Expand Down
Loading