How to modify EPW weather file and generate a new one?



Do anyone know how to modify a EPW file in Ladybug (not modify it in .CSV manually) and generate a new one epw file?

I have found this : , yet I still cannot make it.

Thank you if you could help me.




Hi @Anxiao,
Can you please elaborate you want to modify EPW file based on what parameters?


Hi, devang,

For example, I want to modify the air temperature of a particular day, using a list of Ta values to replace the original values.
I can understand using the ‘ladybug_import epw file’ to and ‘replace item’ component to generate a new temperature list, however it cannot be re-packed into a new epw file to be used in the EnergyPlus simulation. That is my problem. Thank you in advance.



To modify EPW for a day I believe you should go with the .CSV route. If this is a one time operation than updating manually seems a good idea.


Hi @Anxiao,
download this wonderful software, and you can change whatever you want in an epw file. it´s really easy to handle and don´t need to go via the bumpy Excel road.

Peter Z


OK. Thank you for your advice.
yet I think it is better to create a component to change the values of a EPW file, since it is really helpful for studies like global warming and regional atmosphere’s impact (such as adding 2 centigrade to all the values).

1 Like

Hi Peter,
I have just downloaded it and it’s interface is much comfortable than using the Excel-CSV, though it is still manual. Thank you.


you can also copy paste values there form excel


Right, thanks for reminding.


If you have Honeybee[+] installed then you can use ladybug.epw.EPW class to do that. Here is a sample to change the temperature values for day 1 to 25 and save the file as a new file.

epw_file = r'PATH_TO_YOUR_FILE.epw'
epwf = EPW(epw_file)
epwf.dry_bulb_temperature.update_data_for_hours_of_year(values=[25] * 24, hours_of_year=range(24))'c:\ladybug', 'modified.epw')

You can calculate hour of year for any specific date using DateTime class in ladybug.dt module. There is also a Grasshopper component that comes with Ladybug[+] that does this. Keep in mind that hours in EPW are 1-24 and hours in ladybug are 0-23. So hour 24 of a day in epw file will be translated to hour 0 of the next day.


Hi, Mostapha,

Thank you a lot for your guide. I will try the method.
Can I ask you one more question? Since Honeybee[+] is really new to me now, it takes some time to get what you said. Are there any tutorial for it? I’ve searched the site and found this:

Sorry but I found no examples in the installation folders:



Hi Anxiao,

There are not many samples for using the API yet. I Just suggested it as an option. If you want to use the code first install Honeybee[+] by using file.

Then copy the code that I shared in a Grasshopper GHPython component and it should run fine. For your current case that should be enough but in case you want to use other functionalities of [+] libraries the API documentation for Ladybug is here:

PS: Why didn’t you use Anxiao as user id instead of zax1111? The first one if more user friendly if you ask me. and @Anxiao looks better than @Anxiao. :slight_smile:


Thank you, Mostapha. It is very helpful to me.
By the way, I’ve changed the username to my name, Anxiao. :wink:


Hello @PeterZatko!
I little tale in the discussion, but I have a question. I already downloaded the software elements and changed the specific day I want to simulate on Design Builder. I saved it as a new EPW file and loaded it in Design Builder program. I dont know what I am doing wrong but it marks me an error, as if something was missing (.stat file)
Any idea that would help me out?

Thank you


@NRuiz ,

The .stat file can usually be found right next to the .epw file when you download it from the Dept of Energy or OneBuilding we site. There’s also an .exe that ships with EnergyPlus that can generate the .stat file from an EPW if you do not have it.

I also wanted to post an update that much of the code that Mostapha had cited above has been wrapped into a component that let’s you edit and modify EPWs. An example showing how to do it is here but you will need the absolute latest version of the Ladybug[+] libraries for it to work. This means that you will have to run the Honeybee[+] updater component and restart Rhino twice in order to get it to work.