hongyuanjia / eplusr

A Toolkit for Using EnergyPlus in R.
https://hongyuanjia.github.io/eplusr
Other
69 stars 13 forks source link

epw file loading error #571

Closed evelynsoong closed 1 year ago

evelynsoong commented 1 year ago

Hello, I am currently facing an issue with loading epw files, the error message is copied below. It seems like there is a mismatch between what read_epw() expects and what the epw file contains.

I have used the built in download_weather() function to download the relevant epw files and also with several different London epw files but have not been successful.

Thank you!

# 
download_weather("london heathrow", filename = "heathrow", dir = tempdir())
path <- path_eplus_weather("9.4", "GBR_ENG_London-Heathrow.Intl.AP.037720_TMYx.epw")
epw <- read_epw(path)

This is the error message: Error: ✖ [4] Errors found during validation. ═══════════════════════════════════════════════════════════════════════════════════════════

── [2] Invalid Number ───────────────────────────────────────────────────────────────────── Fields below should be numbers but are not:

Header: <DESIGN CONDITIONS>
└─ Object [ID:2]
   ├─ 21: Cooling,       !- Condition 1 Hottest Month
   └─ 54: Extremes;      !- Condition 1 1.0% Extreme Wind Speed {m/s}

── [2] Invalid Choice ───────────────────────────────────────────────────────────────────── Fields below are not one of prescribed choices:

Header: <DESIGN CONDITIONS>
└─ Object [ID:2]
   ├─ 20: "0.556",       !- Condition 1 Cooling Design Condition Type
   └─ 53: "24.3";        !- Condition 1 Extreme Design Condition Type
hongyuanjia commented 1 year ago

Some EPW files from the internet do not strictly follow the definition of the EPW data dictionary. The file you downloaded contains an extra numeric value in the DESIGN CONDITIONS header.

Since it is possible that most files from climate.onebuild.org may have the same issue, I will push a patch to ignore that extra number when parsing.

If what you care is the actual weather data, you can skip the check by running:

without_checking(epw <- read_epw(path))
hongyuanjia commented 1 year ago

@evelynsoong It took much more time than I thought to fix this error. I have submitted the new version v0.16.2 to CRAN. Before it is accepted, you can use the current dev version: remotes::install_github("hongyuanjia/eplusr")

evelynsoong commented 1 year ago

Thank you!