Skip to content

Commit

Permalink
Replace resolved numpy workaround with dask workaround (#245)
Browse files Browse the repository at this point in the history
* Add default of same type as choicelist for np.select()
* Install pinned dask version only for specific runs
  • Loading branch information
glatterf42 authored Nov 12, 2024
1 parent 0645fd5 commit 6032244
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,29 @@ jobs:
- version: v3.4.0
python-version: "3.11"
extra-deps: '"dask < 2024.3.0" "genno < 1.25" "pandas < 2.0" "pytest == 8.0.0"' #
dask-dataframe: false
- version: v3.5.0
python-version: "3.11"
extra-deps: '"dask < 2024.3.0" "genno < 1.25" "pandas < 2.0" "pytest == 8.0.0"' #
dask-dataframe: false
- version: v3.6.0
python-version: "3.11"
extra-deps: '"dask < 2024.3.0" "genno < 1.25" "pandas < 2.0" "pytest == 8.0.0"' #
dask-dataframe: false
- version: v3.7.0
python-version: "3.11"
extra-deps: 'dask[dataframe] "genno < 1.25" "pytest == 8.0.0"' #
extra-deps: ' "genno < 1.25" "pytest == 8.0.0"' #
dask-dataframe: true
# Latest released version
- version: v3.8.0
python-version: "3.12"
extra-deps: 'dask[dataframe] "pytest == 8.0.0"' #
extra-deps: ' "pytest == 8.0.0"' #
dask-dataframe: true
# Development version
- version: main
python-version: "3.12"
extra-deps: 'dask[dataframe]' #
extra-deps: '' #
dask-dataframe: true

fail-fast: false

Expand Down Expand Up @@ -109,9 +115,13 @@ jobs:
pip install .[docs,tests] ${{ matrix.upstream.extra-deps }}
# TEMPORARY Work around hgrecco/pint#2007, unionai-oss/pandera#1685;
# see https://github.com/khaeru/genno/issues/140
pip install "pint != 0.24.0" "numpy < 2"
- name: Install specific dask versions as workaround
if: ${{ matrix.upstream.dask-dataframe }}
run: |
# TEMPORARY Work around dask v2024.11.0;
# see https://github.com/khaeru/genno/issues/149
pip install "dask[dataframe] < 2024.11.0"
- name: Configure local data path
run: |
Expand Down
2 changes: 1 addition & 1 deletion message_ix_models/model/water/data/demands.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def add_sectoral_demands(context: "Context") -> dict[str, pd.DataFrame]:
]
# create a new column and use np.select to assign
# values to it using our lists as arguments
h_act["commodity"] = np.select(conditions, values)
h_act["commodity"] = np.select(conditions, values, "Unknown commodity")
h_act["value"] = h_act["value"].abs()

hist_act = make_df(
Expand Down

0 comments on commit 6032244

Please sign in to comment.