Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change how timestamps are created in _saveTempTMY. Fixes #515. #517

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: test

on: [pull_request, push]

Expand All @@ -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 }}

Expand Down Expand Up @@ -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@6b00cf1889f4e1d5a48635647013c0508128ee1a # GUI testing requires xvfb
with:
run: |
pytest --cov=bifacial_radiance
Expand Down
22 changes: 16 additions & 6 deletions bifacial_radiance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/pending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 use Node20: checkout@v4, setup-python@v5, coactions/setup-xvfb, setup-buildx-action@v3 (:pull:`517`)
* Fix PerformanceWarning and SettingWithCopyWarning (:issue:`515`)

Documentation
~~~~~~~~~~~~~~
Expand Down
Loading