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

EpwFile .getTimeSeries method fails if the weather file contains a leap year but only 28 days are given for that February #5214

Closed
ckirney opened this issue May 31, 2024 · 1 comment · Fixed by #5217

Comments

@ckirney
Copy link

ckirney commented May 31, 2024

Issue overview

Related to #3801

The EpwFile .getTimeSeries method fails when retrieving information from a weather file that contains a leap year but for which only 28 days of February data are provided. Examples of such files are the CWEC 2020 weather files for Toronto and Vancouver.

In both of the above files, the data for February is from a leap year (2004 for Toronto, 2000 for Vancouver). However, only 28 days of weather data for February are provided (no data for Feb. 29).

When using the EpwFile .getTimeSeries method to get dry bulb temperatures with such a file, the following error is produced:

[utilities.time.Date] <2> Bad Date: year = 2009, month = Feb(2), day = 29. C:/Users/Chris/projects/weather_test/weather_test.rb:6:in `getTimeSeries': D:\OSN\Openstudio\src\utilities\time\Date.cpp@382 : Bad Date: year = 2009, month = Feb(2), day = 29. (RuntimeError)

The problem does not occur if the year in the weather file for February is replaced with one that is not a leap year. This issue is especially problematic in TMY weather files since it is not obvious if the February in the file will be from a leap year but will only include 28 days of data.

Current Behavior

The following error:

[utilities.time.Date] <2> Bad Date: year = 2009, month = Feb(2), day = 29. C:/Users/Chris/projects/weather_test/weather_test.rb:6:in `getTimeSeries': D:\OSN\Openstudio\src\utilities\time\Date.cpp@382 : Bad Date: year = 2009, month = Feb(2), day = 29. (RuntimeError)

Expected Behavior

Time series weather data should be returned.

Steps to Reproduce

weather_file = 'path/to/CAN_ON_Toronto.Intl.AP.716240_CWEC2020.epw'
epw = OpenStudio::EpwFile.new(weather_file)
epw.getTimeSeries('Dry Bulb Temperature')

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): Windows 11, 22631.3672
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.8.0
  • Platform (Operating system, version): Ubuntu, 20.04
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.7.0

Context

Using the method to retrieve weather data to calculate PHIUS information. This issue causes unpredictable errors when conducting analyses using a variety of TMY weather files as it is not always clear which weather file will contain leap years with only 28 days of data in February. A replacement method is being implemented in openstudio-standards to replace this method until this issue is resolved.

@ckirney ckirney added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label May 31, 2024
@DavidGoldwasser DavidGoldwasser added this to the OpenStudio SDK 3.9.0 milestone Jun 3, 2024
@joseph-robertson joseph-robertson added severity - Normal Bug component - Utilities Other and removed Triage Issue needs to be assessed and labeled, further information on reported might be needed labels Jun 4, 2024
@joseph-robertson
Copy link
Collaborator

@ckirney Can you test the fix in #5217?

joseph-robertson added a commit that referenced this issue Oct 24, 2024
Addresses #5214, EpwFile getTimeSeries fails for leap year weather file w/no leap day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment