From d9b1d49b23e59747e6c2711a9ab8d087848f8e1a Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 22 May 2024 15:54:06 -0600 Subject: [PATCH 1/5] change how timestamps are created in _saveTempTMY. Fixes #515. --- bifacial_radiance/main.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/bifacial_radiance/main.py b/bifacial_radiance/main.py index 3eb45820..19749a28 100644 --- a/bifacial_radiance/main.py +++ b/bifacial_radiance/main.py @@ -1141,12 +1141,22 @@ def _saveTempTMY(self, tmydata, filename=None, starttime=None, endtime=None, elif coerce_year is None: coerce_year = 2021 print(f"Coercing year to {coerce_year}") - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - tmydata.index.values[:] = tmydata.index[:] + pd.DateOffset(year=(coerce_year)) - # Correcting last index to next year. - tmydata.index.values[-1] = tmydata.index[-1] + pd.DateOffset(year=(coerce_year+1)) - + #with warnings.catch_warnings(): + # warnings.simplefilter("ignore") # can't get rid of vectorized + #tmydata.index.values[:] = tmydata.index[:] + pd.DateOffset(year=(coerce_year)) + #tmydata.index.values[-1] = tmydata.index[-1] + pd.DateOffset(year=(coerce_year+1)) + tz = tmydata.index.tz + year_vector = np.full(shape=tmydata.__len__(), fill_value=coerce_year) + year_vector[-1] = coerce_year+1 + tmydata.index = pd.to_datetime({ + 'year': year_vector, + 'month': tmydata.index.month, + 'day': tmydata.index.day, + 'hour': tmydata.index.hour}) + tmydata = tmydata.tz_localize(tz) + + + # FilterDates filterdates = None if starttime is not None and endtime is not None: From 5e6d910733c23b6f3d2607c6530968e2875ca5c1 Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 22 May 2024 16:24:11 -0600 Subject: [PATCH 2/5] update github actions to avoid node.js node12 and node16 warnings --- .github/workflows/pytest.yaml | 4 ++-- docs/sphinx/source/whatsnew/pending.rst | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 5697016f..26a6d851 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -20,10 +20,10 @@ jobs: ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/docs/sphinx/source/whatsnew/pending.rst b/docs/sphinx/source/whatsnew/pending.rst index 31f0e4a9..abe736bf 100644 --- a/docs/sphinx/source/whatsnew/pending.rst +++ b/docs/sphinx/source/whatsnew/pending.rst @@ -42,6 +42,8 @@ Bug fixes ~~~~~~~~~ * Fixed Pandas 2.0 errors by re-factoring ``mismatch.mad_fn`` (:issue:`449`) * Fixed typo on Opacity calculation factor (:issue:`426`) +* Updated Github Actions to checkout@v4 and setup-python@v5 (:pull:`517`) +* Fix PerformanceWarning and SettingWithCopyWarning (:issue:`515`) Documentation ~~~~~~~~~~~~~~ From 5cb88a8cf4055eb5c7baaff0197cce79fe3a3465 Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 22 May 2024 16:32:00 -0600 Subject: [PATCH 3/5] switch to github actions coactions/setup-xvfb for node20 support --- .github/workflows/pytest.yaml | 2 +- docs/sphinx/source/whatsnew/pending.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 26a6d851..81275235 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -60,7 +60,7 @@ jobs: echo "/home/runner/work/bifacial_radiance/bifacial_radiance/SMARTS_295_Linux" >> $GITHUB_PATH - name: Test with pytest ${{ matrix.env }} - uses: GabrielBB/xvfb-action@v1 # GUI testing requires xvfb + uses: coactions/setup-xvfb@v1 # GUI testing requires xvfb with: run: | pytest --cov=bifacial_radiance diff --git a/docs/sphinx/source/whatsnew/pending.rst b/docs/sphinx/source/whatsnew/pending.rst index abe736bf..8a794113 100644 --- a/docs/sphinx/source/whatsnew/pending.rst +++ b/docs/sphinx/source/whatsnew/pending.rst @@ -42,7 +42,7 @@ Bug fixes ~~~~~~~~~ * Fixed Pandas 2.0 errors by re-factoring ``mismatch.mad_fn`` (:issue:`449`) * Fixed typo on Opacity calculation factor (:issue:`426`) -* Updated Github Actions to checkout@v4 and setup-python@v5 (:pull:`517`) +* Updated Github Actions to use Node20: checkout@v4, setup-python@v5, coactions/setup-xvfb (:pull:`517`) * Fix PerformanceWarning and SettingWithCopyWarning (:issue:`515`) Documentation From c7e78261c59a11d9802afa47001beb951aa999c6 Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 22 May 2024 16:45:56 -0600 Subject: [PATCH 4/5] update docker.yml for node20 --- .github/workflows/docker.yml | 10 +++++----- docs/sphinx/source/whatsnew/pending.rst | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1a2334db..902da4d2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,30 +25,30 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Print triggering event info run: | echo "${{ github.actor }} triggered run #${{ github.run_number }} with event type ${{ github.event_name }}" - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_NREL_USER }} password: ${{ secrets.DOCKERHUB_NREL_TOKEN }} - name: Login to GitHub Package Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . file: ./docker/Dockerfile diff --git a/docs/sphinx/source/whatsnew/pending.rst b/docs/sphinx/source/whatsnew/pending.rst index 8a794113..e30d0548 100644 --- a/docs/sphinx/source/whatsnew/pending.rst +++ b/docs/sphinx/source/whatsnew/pending.rst @@ -42,7 +42,7 @@ Bug fixes ~~~~~~~~~ * Fixed Pandas 2.0 errors by re-factoring ``mismatch.mad_fn`` (:issue:`449`) * Fixed typo on Opacity calculation factor (:issue:`426`) -* Updated Github Actions to use Node20: checkout@v4, setup-python@v5, coactions/setup-xvfb (:pull:`517`) +* Updated Github Actions to use Node20: checkout@v4, setup-python@v5, coactions/setup-xvfb, setup-buildx-action@v3 (:pull:`517`) * Fix PerformanceWarning and SettingWithCopyWarning (:issue:`515`) Documentation From 62aa3774588a969b2160022980224ba209e557c9 Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 22 May 2024 16:57:47 -0600 Subject: [PATCH 5/5] pin coactions to commit hash that uses node20 until the developers cut a new tagged release. https://github.com/coactions/setup-xvfb/issues/29 --- .github/workflows/pytest.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 81275235..9c903f82 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -1,4 +1,4 @@ -name: test +name: test on: [pull_request, push] @@ -60,7 +60,7 @@ jobs: echo "/home/runner/work/bifacial_radiance/bifacial_radiance/SMARTS_295_Linux" >> $GITHUB_PATH - name: Test with pytest ${{ matrix.env }} - uses: coactions/setup-xvfb@v1 # GUI testing requires xvfb + uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a # GUI testing requires xvfb with: run: | pytest --cov=bifacial_radiance