From 7bdba8fc174bae751618a7253efdf69031d174fb Mon Sep 17 00:00:00 2001 From: Daniel Wolfensberger Date: Wed, 20 Dec 2023 14:21:51 +0100 Subject: [PATCH] fix pandas append deprecation error in calc_lookup.py + force sklearn to 1.2.2 --- .github/workflows/test_rainforest_dev.yml | 66 +++++++++++++++++++++++ rainforest/common/lookup.py | 2 +- requirements.txt | 2 +- 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test_rainforest_dev.yml diff --git a/.github/workflows/test_rainforest_dev.yml b/.github/workflows/test_rainforest_dev.yml new file mode 100644 index 0000000..539282b --- /dev/null +++ b/.github/workflows/test_rainforest_dev.yml @@ -0,0 +1,66 @@ +name: Test rainforest dev + +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + required: false + default: false +jobs: + unit_tests: + name: Unit Tests (${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ "ubuntu-latest" ] + python-version: ["3.8", "3.9","3.10","3.11"] + max-parallel: 6 + + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v2 + with: + ref: master + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install rainforest + if: matrix.os != 'macos-latest' + working-directory: ${{github.workspace}} + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -r test_requirements.txt + pip install . + - name: Create rainforest_data folder + run: | + mkdir -p ${{github.workspace}}/rainforest_data + - name: Check imports + env: + AWS_KEY: ${{ secrets.AWS_KEY }} + RAINFOREST_DATAPATH: ${{github.workspace}}/rainforest_data + working-directory: /tmp/ + run: | + python -c "import rainforest; print(rainforest.__file__)" + - name: Run tests + env: + AWS_KEY: ${{ secrets.AWS_KEY }} + RAINFOREST_DATAPATH: ${{github.workspace}}/rainforest_data + working-directory: ${{github.workspace}} + run: pytest tests_ci + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + diff --git a/rainforest/common/lookup.py b/rainforest/common/lookup.py index 57e650d..7ab7af6 100644 --- a/rainforest/common/lookup.py +++ b/rainforest/common/lookup.py @@ -442,7 +442,7 @@ def calc_lookup(lookup_type, radar = None): offset_x = int((neighb_x-1)/2) offset_y = int((neighb_y-1)/2) - df_stations = df_stations.append(constants.RADARS) + df_stations = df_stations._append(constants.RADARS, ignore_index=True) stations = df_stations['Abbrev'] lut = {} diff --git a/requirements.txt b/requirements.txt index 8bedc01..72a3c82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ Cython numpy netCDF4 prompt_toolkit -scikit-learn +scikit-learn==1.2.2 scipy dask pandas