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

Revision history [back]

This works for me:

import openstudio
model = openstudio.model.Model()
epw_path = openstudio.path('//path//to//weather//USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.epw')
epw_file = openstudio.openstudioutilitiesfiletypes.EpwFile(epw_path)
openstudio.model.WeatherFile.setWeatherFile(model, epw_file)
print(model)

It produces an OSM with:

OS:Version,
  {93be9bc6-f569-4f5c-9804-7f01878e7175}, !- Handle
  3.2.1;                                  !- Version Identifier

OS:WeatherFile,
  {b21bb643-6d07-4e17-9e14-31c2171765da}, !- Handle
  Broomfield Jeffco  Boulder   S,         !- City
  CO,                                     !- State Province Region
  USA,                                    !- Country
  TMY3,                                   !- Data Source
  724699,                                 !- WMO Number
  40.13,                                  !- Latitude {deg}
  -105.24,                                !- Longitude {deg}
  -7,                                     !- Time Zone {hr}
  1689,                                   !- Elevation {m}
  //path//to//weather//USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.epw, !- Url
  AC900369;                               !- Checksum