Reading an EPW file starts with function read_epw()
, which parses an EPW
file and returns an Epw
object. The parsing process is extremely inspired
by OpenStudio utilities library
with some simplifications.
epw <- read_epw(path) epw$city epw$city <- "city" epw$state_province epw$state_province <- "state_province" epw$country epw$country <- "country" epw$data_source epw$data_source <- "data_source" epw$wmo_number epw$wmo_number <- "wmo_number" epw$latitude epw$latitude <- "latitude" epw$longitute epw$longitute <- "longitute" epw$time_zone epw$time_zone <- "time_zone" epw$elevation epw$elevation <- "elevation" epw$time_step epw$time_step <- "time_step" epw$start_day_of_week epw$start_day_of_week <- "start_day_of_week" epw$path() epw$get_data(year = NULL, unit = FALSE, tz = Sys.timezone(), update = FALSE) epw$set_data(data) epw$save(path, overwrite = FALSE) epw$print() print(epw)
epw <- read_epw(path)
Arguments
path
: Path of an EnergyPlus EPW
file.
epw$save(path, overwrite = FALSE)
Arguments
path
: A path where to save the weather file. If NULL
, the path of the
weather file itself will be used. Default: NULL
.
overwrite
: Whether to overwrite the file if it already exists. Default is
FALSE
.
epw$city epw$city <- "city" epw$state_province epw$state_province <- "state_province" epw$country epw$country <- "country" epw$data_source epw$data_source <- "data_source" epw$wmo_number epw$wmo_number <- "wmo_number" epw$latitude epw$latitude <- "latitude" epw$longitute epw$longitute <- "longitute" epw$time_zone epw$time_zone <- "time_zone" epw$elevation epw$elevation <- "elevation" epw$time_step epw$time_step <- "time_step" epw$start_day_of_week epw$start_day_of_week <- "start_day_of_week"
$city
, $state_province
, $country
, $data_source
, $wmo_number
,
$latitude
, $longitute
, $time_zone
, $elevation
, $time_step
and
$start_day_of_week
are all active bindings, which means that you can get
the value and also set new value to it.
epw$path() epw$get_data(year = NULL, unit = FALSE, tz = Sys.timezone(), update = FALSE) epw$set_data(data)
$path()
returns the path of EPW file.
$get_data()
returns the core weather data.
$set_data()
replaces core weather data with input data. NOTE: This feature is
experimental. There is no validation when replacing.
NOTE: Even though Epw
class provides methods to replace core weather data,
it is still not recommended.
Arguments
year
: A integer to indicate the year value in the return datetime
column.
If NULL
, the year will be left as it is in EPW file.
tz
: The time zone of Date and Time in datetime
column.
unit
: If TRUE
, units will be set to all numeric columns using
units::set_units()
.
update
: If TRUE
, not only datetime
column, but also year
, month
,
day
, hour
and minute
will also be updated according to the input
year
value.
data
: A data.frame which has all required columns.
An EPW file can be divided into two parts, headers and weather data. The first eight lines of a standard EPW file are normally headers which contains data of location, design conditions, typical/extreme periods, ground temperatures, holidays/daylight savings, data periods and other comments. For now, eplusr only parses headers of location, holidays/daylight savings and data periods. All other headers will be left as they were when parsing and saving. For details on the data structure of EPW file, please see "Chapter 2 - Weather Converter Program" in EnergyPlus "Auxiliary Programs" documentation. An online version can be found here.
There are about 35 variables in the core weather data. However, not all of them are used by EnergyPlus. Actually, despite of date and time columns, only 14 columns are used:
dry bulb temperature
dew point temperature
relative humidity
atmospheric pressure
horizontal infrared radiation intensity from sky
direct normal radiation
diffuse horizontal radiation
wind direction
wind speed
present weather observation
present weather codes
snow depth
liquid precipitation depth
liquid precipitation rate