Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Error: Unexpected End-of-File on EPW Weather file

asked 2020-12-07 23:48:11 -0500

cpathir's avatar

updated 2021-03-29 08:54:51 -0500


I want to create a weather file with 5 minute data for 2019 weather data. I have processed all the 35 columns of .epw file. I still get the following error when I try to run.

EP: Program terminated: EnergyPlus Terminated--Error(s) Detected.
EP: ExpandObjects Started.
EP: No expanded file generated.
EP: ExpandObjects Finished. Time:     0.281
EP: EnergyPlus Starting
EP: EnergyPlus, Version 9.1.0-08d2e308bb, YMD=2020.12.08 00:07
EP: **FATAL:OpenWeatherFile: Unexpected End-of-File on EPW Weather file, while reading header information, looking for header=LOCATION
EP: EnergyPlus Run Time=00hr 00min  2.15sec
EP: EnergyPlus process stopped.

What am I missing here?

PS: I have added the epw file to google drive:

edit retag flag offensive close merge delete


You should share your EPW. But apparently you are missing the header "LOCATION" ? That should be the first line of your EPW, something in the form LOCATION,CHICAGO,IL,USA,TMY2-94846,725300,41.78,-87.75,-6,190,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Julien Marrec's avatar Julien Marrec  ( 2020-12-09 02:39:55 -0500 )edit

I kept the Anderson, SC weather file header and replaced data with 5min data. First two lines of the header are as follows:

LOCATION,Anderson County Ap,SC,USA,TMY3,723125,34.50,-82.72,-5.0,232.0 DESIGN CONDITIONS,1,Climate Design Data 2009 ASHRAE

cpathir's avatar cpathir  ( 2020-12-10 17:14:51 -0500 )edit

1 Answer

Sort by ┬╗ oldest newest most voted

answered 2020-12-11 10:35:52 -0500

updated 2020-12-12 09:39:17 -0500

TL;DR: you have a hidden character at the start of your file. I removed the hidden UTF-8 BOM at the start of your file:

(You still have problems with the weather file, but that's something else).

Stupid encoding problems. You could look at them all day and you won't find the problem.

Well so, I built E+ in Debug mode, and used a debugger to step through the code at the guilty part, and here

(lldb) p Header(HdLine)
(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) $22 = "LOCATION"
(lldb) p
(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) $23 = "´╗┐LOCATION,Anderson County Ap,SC,USA,TMY3,723125,34.50,-82.72,-5.0,232.0"

yet HdPos ends up being 3? WHAAT? It finds "LOCATION" but only at the 3rd char?

Annnnnnnnnnnd here we are, here's what we get when we use python to read your site_4_.epw file in binary mode:

In [1]: with open('site_4_.epw', 'rb') as f:
   ...:     content =
   ...: print(content.splitlines()[0])
b'\xef\xbb\xbfLOCATION,Anderson County Ap,SC,USA,TMY3,723125,34.50,-82.72,-5.0,232.0'

See that annoying \xef\xbb\xbf? That's called an UTF-8 BOM and apparently you have one at the beginning of your file.

(The only reason I know where to look for that stuff is because I've been bit by it waaaaay too many times, looking at you you awful "non-breaking space").

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops


Question Tools

1 follower


Asked: 2020-12-07 23:16:30 -0500

Seen: 344 times

Last updated: Dec 12 '20