Reading an EPW file starts with function read_epw(), which parses an EPW file and returns an Epw object. The parsing process is basically as [EnergyPlus/WeatherManager.cc] in EnergyPlus, with some simplifications.

Details

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. Epw class provides methods to directly extract those data. 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 13 columns are used:

  1. dry bulb temperature

  2. dew point temperature

  3. relative humidity

  4. atmospheric pressure

  5. horizontal infrared radiation intensity from sky

  6. direct normal radiation

  7. diffuse horizontal radiation

  8. wind direction

  9. wind speed

  10. present weather observation

  11. present weather codes

  12. snow depth

  13. liquid precipitation depth

Note the hour column in the core weather data corresponds to the period from (Hour-1)th to (Hour)th. For instance, if the number of interval per hour is 1, hour of 1 on a certain day corresponds to the period between 00:00:01 to 01:00:00, Hour of 2 corresponds to the period between 01:00:01 to 02:00:00, and etc. Currently, in EnergyPlus the minute column is not used to determine currently sub-hour time. For instance, if the number of interval per hour is 2, there is no difference between two rows with following time columns (a) Hour 1, Minute 0; Hour 1, Minute 30 and (b) Hour 1, Minute 30; Hour 1, Minute 60. Only the number of rows count. When EnergyPlus reads the EPW file, both (a) and (b) represent the same time period: 00:00:00 - 00:30:00 and 00:30:00 - 01:00:00. Missing data on the weather file used can be summarized in the eplusout.err file, if DisplayWeatherMissingDataWarnings is turned on in Output:Diagnostics object. In EnergyPlus, missing data is shown only for fields that EnergyPlus will use. EnergyPlus will fill some missing data automatically during simulation. Likewise out of range values are counted for each occurrence and summarized. However, note that the out of range values will not be changed by EnergyPlus and could affect your simulation.

Epw class provides methods to easily extract and inspect those abnormal (missing and out of range) weather data and also to know what kind of actions that EnergyPlus will perform on those data.

EnergyPlus energy model calibration often uses actual measured weather data. In order to streamline the error-prone process of creating custom EPW file, Epw provides methods to direction add, replace the core weather data.

Methods

Public methods


Method new()

Create an Epw object

Usage

Epw$new(path, warning = FALSE)

Arguments

path

Either a path, a connection, or literal data (either a single string or a raw vector) to an EnergyPlus Weather File (EPW). If a file path, that file usually has a extension .epw.

warning

If TRUE, warnings are given if any missing data, out-of-range data are found. Default: TRUE.

Details

It takes an EnergyPlus Weather File (EPW) as input and returns an EPW object.

Returns

An Epw object.

Examples

\dontrun{
# read an EPW file from EnergyPlus website
path_base <- "https://energyplus.net/weather-download"
path_region <- "north_and_central_america_wmo_region_4/USA/CA"
path_file <- "USA_CA_San.Francisco.Intl.AP.724940_TMY3/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw"
path_epw <- file.path(path_base, path_region, path_file)
epw <- read_epw(path_epw)

# read an EPW file distributed with EnergyPlus
if (is_avail_eplus(8.8)) {
    path_epw <- file.path(
        eplus_config(8.8)$dir,
        "WeatherData",
        "USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw"
    )
    epw <- read_epw(path_epw)
}
}


Method path()

Get the file path of current Epw

Usage

Epw$path()

Details

$path() returns the full path of current Epw or NULL if the Epw object is created using a character vector and not saved locally.

Returns

NULL or a single string.

Examples

\dontrun{
# get path
epw$path()
}


Method location()

Get and modify LOCATION header

Usage

Epw$location(
  city,
  state_province,
  country,
  data_source,
  wmo_number,
  latitude,
  longitude,
  time_zone,
  elevation
)

Arguments

city

A string of city name recorded in the LOCATION header.

state_province

A string of state or province name recorded in the LOCATION header.

country

A string of country name recorded in the LOCATION header.

data_source

A string of data source recorded in the LOCATION header.

wmo_number

A string of WMO (World Meteorological Organization) number recorded in the LOCATION header.

latitude

A number of latitude recorded in the LOCATION header. North latitude is positive and south latitude is negative. Should in range [-90, +90].

longitude

A number of longitude recorded in the LOCATION header. East longitude is positive and west longitude is negative. Should in range [-180, +180].

time_zone

A number of time zone recorded in the LOCATION header. Usually presented as the offset hours from UTC time. Should in range [-12, +14].

elevation

A number of elevation recorded in the LOCATION header. Should in range [-1000, 9999.9).

Details

$location() takes new values for LOCATION header fields and returns the parsed values of LOCATION header in a list format. If no input is given, current LOCATION header value is returned.

Returns

A named list of 9 elements.

Examples

\dontrun{
epw$location()

# modify location data
epw$location(city = "MyCity")
}


Method design_condition()

Get DESIGN CONDITION header

Usage

Epw$design_condition()

Details

$design_condition() returns the parsed values of DESIGN CONDITION header in a list format with 4 elements:

  • source: A string of source field

  • heating: A list, usually of length 16, of the heading design conditions

  • cooling: A list, usually of length 32, of the cooling design conditions

  • extreme: A list, usually of length 16, of the extreme design conditions

For the meaning of each element, please see ASHRAE Handbook of Fundamentals.

Returns

A named list of 4 elements.

Examples

\dontrun{
epw$design_condition()
}


Method typical_extreme_period()

Get TYPICAL/EXTREME header

Usage

Epw$typical_extreme_period()

Details

$typical_extreme_period() returns the parsed values of TYPICAL/EXTREME PERIOD header in a data.table format with 6 columns:

  • index: Integer type. The index of typical or extreme period record

  • name: Character type. The name of typical or extreme period record

  • type: Character type. The type of period. Possible value: typical and extreme

  • start_day: Date type with customized formatting. The start day of the period

  • start_day: Date type with customized formatting. The end day of the period

Returns

A data.table::data.table() with 6 columns.

Examples

\dontrun{
epw$typical_extreme_period()
}


Method ground_temperature()

Get GROUND TEMPERATURE header

Usage

Epw$ground_temperature()

Details

$ground_temperature() returns the parsed values of GROUND TEMPERATURE header in a data.table format with 7 columns:

  • index: Integer type. The index of ground temperature record

  • depth: Numeric type. The depth of the ground temperature is measured

  • month: Integer type. The month when the ground temperature is measured

  • soil_conductivity: Numeric type. The soil conductivity at measured depth

  • soil_density: Numeric type. The soil density at measured depth

  • soil_specific heat: Numeric type. The soil specific heat at measured depth

  • temperature: Numeric type. The measured group temperature

Returns

A data.table::data.table() with 7 columns.

Examples

\dontrun{
epw$ground_temperature()
}


Method holiday()

Get and modify HOLIDAYS/DAYLIGHT SAVINGS header

Usage

Epw$holiday(leapyear, dst, holiday)

Arguments

leapyear

Either TRUE or FALSE.

dst

A length 2 EPW date specifications identifying the start and end of daylight saving time. For example, c(3.10, 10.3).

holiday

a list or a data.frame containing two elements (columns) name and day where name are the holiday names and day are valid EPW date specifications. For example:

list(name = c("New Year's Day", "Christmas Day"), day = c("1.1", "25 Dec"))

Details

$holiday() takes new value for leap year indicator, daylight saving time and holiday specifications, set these new values and returns the parsed values of HOLIDAYS/DAYLIGHT SAVINGS header. If no input is given, current values of HOLIDAYS/DAYLIGHT SAVINGS header is returned. It returns a list of 3 elements:

  • leapyear: A single logical vector. TRUE means that the weather data contains leap year data

  • dst: A Date vector contains the start and end day of daylight saving time

  • holiday: A data.table contains 2 columns. If no holiday specified, an empty data.table

    • name: Name of the holiday

    • day: Date of the holiday

Validation process below is performed when changing the leapyear indicator:

  • If current record of leapyear is TRUE, but new input is FALSE, the modification is only conducted when all data periods do not cover Feb 29.

  • If current record of leapyear is FALSE, but new input is TRUE, the modification is only conducted when TMY data periods do not across Feb, e.g. [01/02, 02/28], [03/01, 12/31]; for AMY data, it is always OK.

The date specifications in dst and holiday should follow the rules of "Table 2.14: Weather File Date File Interpretation" in "AuxiliaryPrograms" documentation. eplusr is able to handle all those kinds of formats automatically. Basically, 5 formats are allowed:

  1. A single integer is interpreted as the Julian day of year. For example, 1, 2, 3 and 4 will be parsed and presented as 1st day, 2nd day, 3rd day and 4th day.

  2. A single number is interpreted as Month.Day. For example, 1.2 and 5.6 will be parsed and presented as Jan 02 and May 06.

  3. A string giving MonthName / DayNumber, DayNumber / MonthName, and MonthNumber / DayNumber. A year number can be also included. For example, "Jan/1", "05/Dec", "7/8", "02/10/2019", and "2019/04/05" will be parsed and presented as Jan 02, Dec 06, Jul 8, 2019-02-10 and 2019-04-15.

  4. A string giving number Weekday in Month. For example, "2 Sunday in Jan" will be parsed and presented as 2th Sunday in January.

  5. A string giving Last Weekday in Month. For example, "last Sunday in Dec" will be parsed and presented as Last Sunday in December.

For convenience, besides all the formats described above, dst and days in holiday also accept standard Dates input. They will be treated as the same way as No.3 format described above.

Returns

A named list of 3 elements.

Examples

\dontrun{
epw$holiday()

# add daylight saving time
epw$holiday(dst = c(3.10, 11.3))
}


Method comment1()

Get and modify COMMENT1 header

Usage

Epw$comment1(comment)

Arguments

comment

A string of new comments.

Details

$comment1() takes a single string of new comments and replaces the old comment with input one. If no input is given, current comment is returned.

Returns

A single string.

Examples

\dontrun{
epw$comment1()

epw$comment1("Comment1")
}


Method comment2()

Get and modify COMMENT2 header

Usage

Epw$comment2(comment)

Arguments

comment

A string of new comments.

Details

$comment2() takes a single string of new comments and replaces the old comment with input one. If no input is given, current comment is returned.

Returns

A single string.

Examples

\dontrun{
epw$comment2()

epw$comment2("Comment2")
}


Method num_period()

Get number of data periods in DATA PERIODS header

Usage

Epw$num_period()

Details

$num_period() returns a single positive integer of how many data periods current Epw contains.

Returns

A single integer.

Examples

\dontrun{
epw$num_period()
}


Method interval()

Get the time interval in DATA PERIODS header

Usage

Epw$interval()

Details

$interval() returns a single positive integer of how many records of weather data exist in one hour.

Returns

A single integer.

Examples

\dontrun{
epw$interval()
}


Method period()

Get and modify data period meta data in DATA PERIODS header

Usage

Epw$period(period, name, start_day_of_week)

Arguments

period

A positive integer vector identifying the data period indexes.

name

A character vector used as new names for specified data periods. Should have the same length as index.

start_day_of_week

A character vector or an integer vector used as the new start days of week of specified data periods. Should have the same length as index.

Details

$period() takes a data period index, a new period name and start day of week specification, and uses that input to replace the data period's name and start day of week. If no input is given, data periods in current Epw is returned.

Returns

A data.table with 5 columns:

  • index: Integer type. The index of data period.

  • name: Character type. The name of data period.

  • start_day_of_week: Integer type. The start day of week of data period.

  • start_day: Date (EpwDate) type. The start day of data period.

  • end_day: Date (EpwDate) type. The end day of data period.

Examples

\dontrun{
# modify data period name
epw$period(1, name = "test")

# change start day of week
epw$period(1, start_day_of_week = 3)
}


Method missing_code()

Get missing code for weather data variables

Usage

Epw$missing_code()

Details

$missing_code() returns a list of 29 elements containing the value used as missing value identifier for all weather data.

Returns

A named list of 29 elements.

Examples

\dontrun{
epw$missing_code()
}


Method initial_missing_value()

Get initial value for missing data of weather data variables

Usage

Epw$initial_missing_value()

Details

$initial_missing_value() returns a list of 16 elements containing the initial value used to replace missing values for corresponding weather data.

Returns

A named list of 16 elements.

Examples

\dontrun{
epw$initial_missing_value()
}


Method range_exist()

Get value ranges for existing values of weather data variables

Usage

Epw$range_exist()

Details

$range_exist() returns a list of 28 elements containing the range each numeric weather data should fall in. Any values out of this range are treated as missing.

Returns

A named list of 28 elements.

Examples

\dontrun{
epw$range_exist()
}


Method range_valid()

Get value ranges for valid values of weather data variables

Usage

Epw$range_valid()

Details

$range_valid() returns a list of 28 elements containing the range each numeric weather data should fall in. Any values out of this range are treated as invalid.

Returns

A named list of 28 elements.

Examples

\dontrun{
epw$range_valid()
}


Method fill_action()

Get fill actions for abnormal values of weather data variables

Usage

Epw$fill_action(type = c("missing", "out_of_range"))

Arguments

type

What abnormal type of actions to return. Should be one of "missing" and "out_of_range". Default: "missing".

Details

$fill_action() returns a list containing actions that EnergyPlus will perform when certain abnormal data found for corresponding weather data. There are 3 types of actions in total:

  • do_nothing: All abnormal values are left as they are.

  • use_zero: All abnormal values are reset to zeros.

  • use_previous: The first abnormal values of variables will be set to the initial missing values. All after are set to previous valid one.

Returns

A named list.

Examples

\dontrun{
epw$fill_action("missing")

epw$fill_action("out_of_range")
}


Method data()

Get weather data

Usage

Epw$data(
  period = 1L,
  start_year = NULL,
  align_wday = TRUE,
  tz = "UTC",
  update = FALSE
)

Arguments

period

A single positive integer identifying the data period index. Data periods information can be obtained using $period() described above.

start_year

A positive integer identifying the year of first date time in specified data period. If NULL, the values in the year column are used as years of datetime column. Default: NULL.

align_wday

Only applicable when start_year is NULL. If TRUE, a year value is automatically calculated for specified data period that compliance with the start day of week value specified in DATA PERIODS header.

tz

A valid time zone to be assigned to the datetime column. All valid time zone names can be obtained using OlsonNames(). Default:"UTC".

update

If TRUE, the year column are updated according to the newly created datetime column using start_year. If FALSE, original year data in the Epw object is kept. Default: FALSE.

Details

$data() returns weather data of specific data period.

Usually, EPW file downloaded from EnergyPlus website contains TMY weather data. As years of weather data is not consecutive, it may be more convenient to align the year values to be consecutive, which will makes it possible to direct analyze and plot weather data. The start_year argument in $data() method can help to achieve this. However, randomly setting the year may result in a date time series that does not have the same start day of week as specified in the DATA PERIODS header. eplusr provides a simple solution for this. By setting year to NULL and align_wday to TRUE, eplusr will calculate a year value (from current year backwards) for each data period that compliance with the start day of week restriction.

Note that if current data period contains AMY data and start_year is given, a warning is given because the actual year values will be overwritten by input start_year. An error is given if:

  • Using input start_year introduces invalid date time. This may happen when weather data contains leap year but input start_year is not a leap year.

  • Applying specified time zone specified using tz introduces invalid date time.

Returns

A data.table::data.table() of 36 columns.

Examples

\dontrun{
# get weather data
str(epw$data())

# get weather data but change the year to 2018
# the year column is not changed by default, only the returned datetime column
head(epw$data(start_year = 2018)$datetime)
str(epw$data(start_year = 2018)$year)
# you can update the year column too
head(epw$data(start_year = 2018, update = TRUE)$year)

# change the time zone of datetime column in the returned weather data
attributes(epw$data()$datetime)
attributes(epw$data(tz = "Etc/GMT+8")$datetime)
}


Method abnormal_data()

Get abnormal weather data

Usage

Epw$abnormal_data(
  period = 1L,
  cols = NULL,
  keep_all = TRUE,
  type = c("both", "missing", "out_of_range")
)

Arguments

period

A single positive integer identifying the data period index. Data periods information can be obtained using $period() described above.

cols

A character vector identifying what data columns, i.e. all columns except datetime, year, month, day, hour and minute, to search abnormal values. If NULL, all data columns are used. Default: NULL.

keep_all

If TRUE, all columns are returned. If FALSE, only line, datetime, year, month, day, hour and minute, together with columns specified in cols are returned. Default: TRUE

type

What abnormal type of data to return. Should be one of "all", "missing" and "out_of_range". Default: "all".

Details

$abnormal_data() returns abnormal data of specific data period. Basically, there are 2 types of abnormal data in Epw, i.e. missing values and out-of-range values. Sometimes, it may be useful to extract and inspect those data especially when inserting measured weather data. $abnormal_data() does this.

In the returned data.table::data.table(), a column named line is created indicating the line numbers where abnormal data occur in the actual EPW file.

Returns

A data.table::data.table().

Examples

\dontrun{
epw$abnormal_data()

# only check if there are any abnormal values in air temperature and
# liquid precipitation rate
epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"))

# save as above, but only return date time columns plus those 2 columns
epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"),
    keep_all = FALSE
)

# same as above, but only check for missing values
epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"),
    type = "missing"
)

# same as above, but only check for out-of-range values
epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"),
    type = "out_of_range"
)
}


Method redundant_data()

Get redundant weather data

Usage

Epw$redundant_data()

Details

$redundant_data() returns weather data in Epw object that do not belong to any data period. This data can be further removed using $purge()` method described below.

In the returned data.table::data.table(), a column named line is created indicating the line numbers where redundant data occur in the actual EPW file.

Returns

A data.table::data.table() of 37 columns.

Examples

\dontrun{
epw$redundant_data()
}


Method make_na()

Convert abnormal data into NAs

Usage

Epw$make_na(period = NULL, missing = FALSE, out_of_range = FALSE)

Arguments

period

A positive integer vector identifying the data period indexes. Data periods information can be obtained using $period() described above. If NULL, all data periods are included. Default: NULL.

missing

If TRUE, missing values are included. Default: FALSE.

out_of_range

If TRUE, out-of-range values are included. Default: FALSE.

Details

$make_na() converts specified abnormal data into NAs in specified data period. This makes it easier to find abnormal data directly using is.na() instead of using $missing_code()

$make_na() and $fill_abnormal() are reversible, i.e. $make_na() can be used to counteract the effects introduced by $make_na(), and vise a versa.

Note that $make_na modify the weather data in-place, meaning that the returned data from $data() and $abnormal_data() may be different after calling $make_na().

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
# turn all missing values into NAs
summary(epw$data()$liquid_precip_rate)
epw$make_na(missing = TRUE)
summary(epw$data()$liquid_precip_rate)
}


Method fill_abnormal()

Fill abnormal data using prescribed pattern

Usage

Epw$fill_abnormal(
  period = NULL,
  missing = FALSE,
  out_of_range = FALSE,
  special = FALSE
)

Arguments

period

A positive integer vector identifying the data period indexes. Data periods information can be obtained using $period() described above. If NULL, all data periods are included. Default: NULL.

missing

If TRUE, missing values are included. Default: FALSE.

out_of_range

If TRUE, out-of-range values are included. Default: FALSE.

special

If TRUE, abnormal data are filled using corresponding actions listed $fill_action(). If FALSE, all abnormal data are fill with missing code described in $missing_code().

Details

$fill_abnormal() fills specified abnormal data using corresponding actions listed in $fill_action(). For what kinds of actions to be performed, please see $fill_action(). method described above. Note that only if special is TRUE, special actions listed in $fill_action() is performed. If special is FALSE, all abnormal data, including both missing values and out-of-range values, are filled with corresponding missing codes.

$make_na() and $fill_abnormal() are reversible, i.e. $make_na() can be used to counteract the effects introduced by $fill_abnormal(), and vise a versa.

Note that $fill_abnormal modify the weather data in-place, meaning that the returned data from $data() and $abnormal_data() may be different after calling $fill_abnormal().

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
# turn all missing values into NAs
summary(epw$data()$liquid_precip_rate)
epw$fill_abnormal(missing = TRUE)
summary(epw$data()$liquid_precip_rate)
}


Method add_unit()

Add units to weather data variables

Usage

Epw$add_unit()

Details

$add_unit() assigns units to numeric weather data using units::set_units() if applicable.

$add_unit() and $drop_unit() are reversible, i.e. $add_unit() can be used to counteract the effects introduced by $drop_unit(), and vise a versa.

Note that $add_unit modify the weather data in-place, meaning that the returned data from $data() and $abnormal_data() may be different after calling $add_unit().

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
# get weather data with units
epw$add_unit()
head(epw$data())

# with units specified, you can easily perform unit conversion using units
# package
t_dry_bulb <- epw$data()$dry_bulb_temperature
units(t_dry_bulb) <- with(units::ud_units, "kelvin")

head(t_dry_bulb)
}


Method drop_unit()

Remove units in weather data variables

Usage

Epw$drop_unit()

Details

$drop_unit() removes all units of numeric weather data.

$add_unit() and $drop_unit() are reversible, i.e. $add_unit() can be used to counteract the effects introduced by $drop_unit(), and vise a versa.

Note that $add_unit modify the weather data in-place, meaning that the returned data from $data() and $abnormal_data() may be different after calling $add_unit().

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
epw$drop_unit()
epw$data()
}


Method purge()

Delete redundant weather data observations

Usage

Epw$purge()

Details

$purge() deletes weather data in Epw object that do not belong to any data period.

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
epw$purge()
}


Method add()

Add a data period

Usage

Epw$add(
  data,
  realyear = FALSE,
  name = NULL,
  start_day_of_week = NULL,
  after = 0L,
  warning = TRUE
)

Arguments

data

A data.table::data.table() of new weather data to add or set. Validation is performed according to rules described above.

realyear

Whether input data is AMY data. Default: FALSE.

name

A new string used as name of added or set data period. Should not be the same as existing data period names. If NULL, it is generated automatically in format Data, Data_1 and etc., based on existing data period names. Default: NULL

start_day_of_week

A single integer or character specifying start day of week of input data period. If NULL, Sunday is used for TMY data and the actual start day of week is used for AMY data. Default: NULL.

after

A single integer identifying the index of data period where input new data period to be inserted after. IF 0, input new data period will be the first data period. Default: 0.

warning

If TRUE, warnings are given if any missing data, out-of-range data are found. Default: TRUE.

Details

$add() adds a new data period into current Epw object at specified position.

The validity of input data is checked before adding according to rules following:

  • Column datetime exists and has type of POSIXct. Note that time zone of input date time will be reset to UTC.

  • It assumes that input data is already sorted, i.e. no further sorting is made during validation. This is because when input data is TMY data, there is no way to properly sort input data rows only using datetime column.

  • Number of data records per hour should be consistent across input data.

  • Input number of data records per hour should be the same as existing data periods.

  • The date time of input data should not overlap with existing data periods.

  • Input data should have all 29 weather data columns with right types. The year, month, day, and minute column are not compulsory. They will be created according to values in the datetime column. Existing values will be overwritten.

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
# will fail since date time in input data has already been covered by
# existing data period
epw$add(epw$data())
}


Method set()

Replace a data period

Usage

Epw$set(
  data,
  realyear = FALSE,
  name = NULL,
  start_day_of_week = NULL,
  period = 1L,
  warning = TRUE
)

Arguments

data

A data.table::data.table() of new weather data to add or set. Validation is performed according to rules described above.

realyear

Whether input data is AMY data. Default: FALSE.

name

A new string used as name of added or set data period. Should not be the same as existing data period names. If NULL, it is generated automatically in format Data, Data_1 and etc., based on existing data period names. Default: NULL

start_day_of_week

A single integer or character specifying start day of week of input data period. If NULL, Sunday is used for TMY data and the actual start day of week is used for AMY data. Default: NULL.

period

A single integer identifying the index of data period to set.

warning

If TRUE, warnings are given if any missing data, out-of-range data are found. Default: TRUE.

Details

$set() replaces existing data period using input new weather data.

The validity of input data is checked before replacing according to rules following:

  • Column datetime exists and has type of POSIXct. Note that time zone of input date time will be reset to UTC.

  • It assumes that input data is already sorted, i.e. no further sorting is made during validation. This is because when input data is TMY data, there is no way to properly sort input data rows only using datetime column.

  • Number of data records per hour should be consistent across input data.

  • Input number of data records per hour should be the same as existing data periods.

  • The date time of input data should not overlap with existing data periods.

  • Input data should have all 29 weather data columns with right types. The year, month, day, and minute column are not compulsory. They will be created according to values in the datetime column. Existing values will be overwritten.

Returns

The modified Epw object itself, invisibly.

Examples

\dontrun{
# change the weather data
epw$set(epw$data(), warning = FALSE)
}


Method del()

Delete a data period

Usage

Epw$del(period)

Arguments

period

A single integer identifying the index of data period to set.

Details

$del() removes a specified data period. Note that an error will be given if current Epw only contains one data period.

Returns

The modified Epw object itself, invisibly.


Method is_unsaved()

Check if there are unsaved changes in current Epw

Usage

Epw$is_unsaved()

Details

$is_unsaved() returns TRUE if there are modifications on the Epw object since it was read or since last time it was saved, and returns FALSE otherwise.

Returns

A single logical value of TRUE or FALSE.

Examples

\dontrun{
epw$is_unsaved()
}


Method save()

Save Epw object as an EPW file

Usage

Epw$save(path = NULL, overwrite = FALSE, purge = FALSE)

Arguments

path

A path where to save the weather file. If NULL, the path of the weather file itself is used. Default: NULL.

overwrite

Whether to overwrite the file if it already exists. Default is FALSE.

purge

Whether to remove redundant data when saving. Default: FALSE.

Details

$save() saves current Epw to an EPW file. Note that if missing values and out-of-range values are converted to NAs using $make_na(), they will be filled with corresponding missing codes during saving.

Returns

A length-one character vector, invisibly.

Examples

\dontrun{
# save the weather file
epw$save(file.path(tempdir(), "weather.epw"), overwrite = TRUE)
}


Method print()

Print Idf object

Usage

Epw$print()

Details

$print() prints the Epw object, including location, elevation, data source, WMO station, leap year indicator, interval and data periods.

Returns

The Epw object itself, invisibly.

Examples

\dontrun{
epw$print()
}


Method clone()

The objects of this class are cloneable with this method.

Usage

Epw$clone(deep = TRUE)

Arguments

deep

Whether to make a deep clone.

Examples

## ------------------------------------------------ ## Method `Epw$new` ## ------------------------------------------------ # \dontrun{ # read an EPW file from EnergyPlus website path_base <- "https://energyplus.net/weather-download" path_region <- "north_and_central_america_wmo_region_4/USA/CA" path_file <- "USA_CA_San.Francisco.Intl.AP.724940_TMY3/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw" path_epw <- file.path(path_base, path_region, path_file) epw <- read_epw(path_epw) # read an EPW file distributed with EnergyPlus if (is_avail_eplus(8.8)) { path_epw <- file.path( eplus_config(8.8)$dir, "WeatherData", "USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw" ) epw <- read_epw(path_epw) } # } ## ------------------------------------------------ ## Method `Epw$path` ## ------------------------------------------------ # \dontrun{ # get path epw$path()
#> [1] "/home/travis/.local/EnergyPlus-8-8-0/WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw"
# } ## ------------------------------------------------ ## Method `Epw$location` ## ------------------------------------------------ # \dontrun{ epw$location()
#> $city #> [1] "San Francisco Intl Ap" #> #> $state_province #> [1] "CA" #> #> $country #> [1] "USA" #> #> $data_source #> [1] "TMY3" #> #> $wmo_number #> [1] "724940" #> #> $latitude #> [1] 37.62 #> #> $longitude #> [1] -122.4 #> #> $time_zone #> [1] -8 #> #> $elevation #> [1] 2 #>
# modify location data epw$location(city = "MyCity")
#> $city #> [1] "MyCity" #> #> $state_province #> [1] "CA" #> #> $country #> [1] "USA" #> #> $data_source #> [1] "TMY3" #> #> $wmo_number #> [1] "724940" #> #> $latitude #> [1] 37.62 #> #> $longitude #> [1] -122.4 #> #> $time_zone #> [1] -8 #> #> $elevation #> [1] 2 #>
# } ## ------------------------------------------------ ## Method `Epw$design_condition` ## ------------------------------------------------ # \dontrun{ epw$design_condition()
#> $source #> [1] "Climate Design Data 2009 ASHRAE Handbook" #> #> $heating #> $heating$coldest_month #> [1] 1 #> #> $heating$heating_db_99.6 #> [1] 3.8 #> #> $heating$heating_db_99.0 #> [1] 4.9 #> #> $heating$humidification_dp_99.6 #> [1] -3.7 #> #> $heating$humidification_hr_99.6 #> [1] 2.8 #> #> $heating$humidification_mcdb_99.6 #> [1] 10.7 #> #> $heating$humidification_dp_99.0 #> [1] -1.2 #> #> $heating$humidification_hr_99.0 #> [1] 3.4 #> #> $heating$humidification_mcdb_99.0 #> [1] 11.2 #> #> $heating$coldest_month_ws_0.4 #> [1] 12.9 #> #> $heating$coldest_month_mcdb_0.4 #> [1] 12.1 #> #> $heating$coldest_month_ws_1.0 #> [1] 11.6 #> #> $heating$coldest_month_mcdb_1.0 #> [1] 12.2 #> #> $heating$mcws_99.6_db #> [1] 2.2 #> #> $heating$pcwd_99.6_db #> [1] 150 #> #> #> $cooling #> $cooling$hotest_month #> [1] 8 #> #> $cooling$hotest_month_db_range #> [1] 8.5 #> #> $cooling$cooling_db_0.4 #> [1] 28.3 #> #> $cooling$cooling_mcwb_0.4 #> [1] 17.2 #> #> $cooling$cooling_db_1.0 #> [1] 25.7 #> #> $cooling$cooling_mcwb_1.0 #> [1] 16.7 #> #> $cooling$cooling_db_2.0 #> [1] 23.6 #> #> $cooling$cooling_mcwb_2.0 #> [1] 16.2 #> #> $cooling$evaporation_wb_0.4 #> [1] 18.6 #> #> $cooling$evaporation_mcdb_0.4 #> [1] 25.7 #> #> $cooling$evaporation_wb_1.0 #> [1] 17.8 #> #> $cooling$evaporation_mcdb_1.0 #> [1] 23.9 #> #> $cooling$evaporation_wb_2.0 #> [1] 17 #> #> $cooling$evaporation_mcdb_2.0 #> [1] 22.4 #> #> $cooling$mcws_0.4_db #> [1] 5.9 #> #> $cooling$pcwd_0.4_db #> [1] 310 #> #> $cooling$dehumification_dp_0.4 #> [1] 16.1 #> #> $cooling$dehumification_hr_0.4 #> [1] 11.5 #> #> $cooling$dehumification_mcdb_0.4 #> [1] 19.9 #> #> $cooling$dehumification_dp_1.0 #> [1] 15.3 #> #> $cooling$dehumification_hr_1.0 #> [1] 10.9 #> #> $cooling$dehumification_mcdb_1.0 #> [1] 19.2 #> #> $cooling$dehumification_dp_2.0 #> [1] 14.7 #> #> $cooling$dehumification_hr_2.0 #> [1] 10.4 #> #> $cooling$dehumification_mcdb_2.0 #> [1] 18.7 #> #> $cooling$enthalpy_0.4 #> [1] 52.4 #> #> $cooling$mcdb_0.4 #> [1] 25.8 #> #> $cooling$enthalpy_1.0 #> [1] 49.8 #> #> $cooling$mcdb_1.0 #> [1] 23.8 #> #> $cooling$enthalpy_2.0 #> [1] 47.6 #> #> $cooling$mcdb_2.0 #> [1] 22.4 #> #> $cooling$hours_8_to_4_12.8_20.6 #> [1] 2038 #> #> #> $extremes #> $extremes$extreme_annual_ws_1.0 #> [1] 12.8 #> #> $extremes$extreme_annual_ws_2.5 #> [1] 11.5 #> #> $extremes$extreme_annual_ws_5.0 #> [1] 10.6 #> #> $extremes$extreme_max_wb #> [1] 22.3 #> #> $extremes$extreme_annual_db_mean_min #> [1] 1.8 #> #> $extremes$extreme_annual_db_mean_max #> [1] 34.6 #> #> $extremes$extreme_annual_db_sd_min #> [1] 1.5 #> #> $extremes$extreme_annual_db_sd_max #> [1] 2.3 #> #> $extremes$`5_year_return_period_values_of_extreme_db_min` #> [1] 0.8 #> #> $extremes$`5_year_return_period_values_of_extreme_db_max` #> [1] 36.2 #> #> $extremes$`10_year_return_period_values_of_extreme_db_min` #> [1] -0.1 #> #> $extremes$`10_year_return_period_values_of_extreme_db_max` #> [1] 37.5 #> #> $extremes$`20_year_return_period_values_of_extreme_db_min` #> [1] -0.9 #> #> $extremes$`20_year_return_period_values_of_extreme_db_max` #> [1] 38.8 #> #> $extremes$`50_year_return_period_values_of_extreme_db_min` #> [1] -1.9 #> #> $extremes$`50_year_return_period_values_of_extreme_db_max` #> [1] 40.5 #> #>
# } ## ------------------------------------------------ ## Method `Epw$typical_extreme_period` ## ------------------------------------------------ # \dontrun{ epw$typical_extreme_period()
#> index name type start_day #> 1: 1 Summer - Week Nearest Max Temperature For Period extreme 8/ 1 #> 2: 2 Summer - Week Nearest Average Temperature For Period typical 9/ 5 #> 3: 3 Winter - Week Nearest Min Temperature For Period extreme 2/ 1 #> 4: 4 Winter - Week Nearest Average Temperature For Period typical 2/15 #> 5: 5 Autumn - Week Nearest Average Temperature For Period typical 12/ 6 #> 6: 6 Spring - Week Nearest Average Temperature For Period typical 5/29 #> end_day #> 1: 8/ 7 #> 2: 9/11 #> 3: 2/ 7 #> 4: 2/21 #> 5: 12/12 #> 6: 6/ 4
# } ## ------------------------------------------------ ## Method `Epw$ground_temperature` ## ------------------------------------------------ # \dontrun{ epw$ground_temperature()
#> index depth month soil_conductivity soil_density soil_specific_heat #> 1: 1 0.5 1 NA NA NA #> 2: 1 0.5 2 NA NA NA #> 3: 1 0.5 3 NA NA NA #> 4: 1 0.5 4 NA NA NA #> 5: 1 0.5 5 NA NA NA #> 6: 1 0.5 6 NA NA NA #> 7: 1 0.5 7 NA NA NA #> 8: 1 0.5 8 NA NA NA #> 9: 1 0.5 9 NA NA NA #> 10: 1 0.5 10 NA NA NA #> 11: 1 0.5 11 NA NA NA #> 12: 1 0.5 12 NA NA NA #> 13: 2 2.0 1 NA NA NA #> 14: 2 2.0 2 NA NA NA #> 15: 2 2.0 3 NA NA NA #> 16: 2 2.0 4 NA NA NA #> 17: 2 2.0 5 NA NA NA #> 18: 2 2.0 6 NA NA NA #> 19: 2 2.0 7 NA NA NA #> 20: 2 2.0 8 NA NA NA #> 21: 2 2.0 9 NA NA NA #> 22: 2 2.0 10 NA NA NA #> 23: 2 2.0 11 NA NA NA #> 24: 2 2.0 12 NA NA NA #> 25: 3 4.0 1 NA NA NA #> 26: 3 4.0 2 NA NA NA #> 27: 3 4.0 3 NA NA NA #> 28: 3 4.0 4 NA NA NA #> 29: 3 4.0 5 NA NA NA #> 30: 3 4.0 6 NA NA NA #> 31: 3 4.0 7 NA NA NA #> 32: 3 4.0 8 NA NA NA #> 33: 3 4.0 9 NA NA NA #> 34: 3 4.0 10 NA NA NA #> 35: 3 4.0 11 NA NA NA #> 36: 3 4.0 12 NA NA NA #> index depth month soil_conductivity soil_density soil_specific_heat #> temperature #> 1: 10.86 #> 2: 10.57 #> 3: 11.08 #> 4: 11.88 #> 5: 13.97 #> 6: 15.58 #> 7: 16.67 #> 8: 17.00 #> 9: 16.44 #> 10: 15.19 #> 11: 13.51 #> 12: 11.96 #> 13: 11.92 #> 14: 11.41 #> 15: 11.51 #> 16: 11.93 #> 17: 13.33 #> 18: 14.60 #> 19: 15.61 #> 20: 16.15 #> 21: 16.03 #> 22: 15.32 #> 23: 14.17 #> 24: 12.95 #> 25: 12.79 #> 26: 12.27 #> 27: 12.15 #> 28: 12.31 #> 29: 13.10 #> 30: 13.96 #> 31: 14.74 #> 32: 15.28 #> 33: 15.41 #> 34: 15.10 #> 35: 14.42 #> 36: 13.60 #> temperature
# } ## ------------------------------------------------ ## Method `Epw$holiday` ## ------------------------------------------------ # \dontrun{ epw$holiday()
#> $leapyear #> [1] FALSE #> #> $dst #> [1] "0 <empty>" "0 <empty>" #> #> $holiday #> Null data.table (0 rows and 0 cols) #>
# add daylight saving time epw$holiday(dst = c(3.10, 11.3))
#> $leapyear #> [1] FALSE #> #> $dst #> [1] "Mar 01" "Nov 03" #> #> $holiday #> Null data.table (0 rows and 0 cols) #>
# } ## ------------------------------------------------ ## Method `Epw$comment1` ## ------------------------------------------------ # \dontrun{ epw$comment1()
#> [1] "Custom/User Format -- WMO#724940; NREL TMY Data Set (2008); Period of Record 1973-2005 (Generally)"
epw$comment1("Comment1")
#> [1] "Comment1"
# } ## ------------------------------------------------ ## Method `Epw$comment2` ## ------------------------------------------------ # \dontrun{ epw$comment2()
#> [1] " -- Ground temps produced with a standard soil diffusivity of 2.3225760E-03 {m**2/day}"
epw$comment2("Comment2")
#> [1] "Comment2"
# } ## ------------------------------------------------ ## Method `Epw$num_period` ## ------------------------------------------------ # \dontrun{ epw$num_period()
#> [1] 1
# } ## ------------------------------------------------ ## Method `Epw$interval` ## ------------------------------------------------ # \dontrun{ epw$interval()
#> [1] 1
# } ## ------------------------------------------------ ## Method `Epw$period` ## ------------------------------------------------ # \dontrun{ # modify data period name epw$period(1, name = "test")
#> index name start_day_of_week start_day end_day from to missing #> 1: 1 test 7 1/ 1 12/31 1 8760 <list> #> out_of_range #> 1: <list>
# change start day of week epw$period(1, start_day_of_week = 3)
#> index name start_day_of_week start_day end_day from to missing #> 1: 1 test 3 1/ 1 12/31 1 8760 <list> #> out_of_range #> 1: <list>
# } ## ------------------------------------------------ ## Method `Epw$missing_code` ## ------------------------------------------------ # \dontrun{ epw$missing_code()
#> $dry_bulb_temperature #> [1] 99.9 #> #> $dew_point_temperature #> [1] 99.9 #> #> $relative_humidity #> [1] 999 #> #> $atmospheric_pressure #> [1] 999999 #> #> $extraterrestrial_horizontal_radiation #> [1] 9999 #> #> $extraterrestrial_direct_normal_radiation #> [1] 9999 #> #> $horizontal_infrared_radiation_intensity_from_sky #> [1] 9999 #> #> $global_horizontal_radiation #> [1] 9999 #> #> $direct_normal_radiation #> [1] 999999 #> #> $diffuse_horizontal_radiation #> [1] 9999 #> #> $global_horizontal_illuminance #> [1] 999999 #> #> $direct_normal_illuminance #> [1] 999999 #> #> $diffuse_horizontal_illuminance #> [1] 999999 #> #> $zenith_luminance #> [1] 99990 #> #> $wind_direction #> [1] 999 #> #> $wind_speed #> [1] 999 #> #> $total_sky_cover #> [1] 99 #> #> $opaque_sky_cover #> [1] 99 #> #> $visibility #> [1] 9999 #> #> $ceiling_height #> [1] 99999 #> #> $present_weather_observation #> [1] 9 #> #> $present_weather_codes #> [1] "999999999" #> #> $precipitable_water #> [1] 999 #> #> $aerosol_optical_depth #> [1] 0.999 #> #> $snow_depth #> [1] 999 #> #> $days_since_last_snow #> [1] 99 #> #> $albedo #> [1] 999 #> #> $liquid_precip_depth #> [1] 999 #> #> $liquid_precip_rate #> [1] 99 #>
# } ## ------------------------------------------------ ## Method `Epw$initial_missing_value` ## ------------------------------------------------ # \dontrun{ epw$initial_missing_value()
#> $dry_bulb_temperature #> [1] 6 #> #> $dew_point_temperature #> [1] 3 #> #> $relative_humidity #> [1] 50 #> #> $wind_speed #> [1] 2.5 #> #> $wind_direction #> [1] 180 #> #> $total_sky_cover #> [1] 5 #> #> $opaque_sky_cover #> [1] 5 #> #> $visibility #> [1] 777.7 #> #> $ceiling #> [1] 77777 #> #> $precipitable_water #> [1] 0 #> #> $aerosol_optical_depth #> [1] 0 #> #> $snow_depth #> [1] 0 #> #> $days_since_last_snow #> [1] 88 #> #> $albedo #> [1] 0 #> #> $liquid_precip_depth #> [1] 0 #> #> $atmospheric_pressure #> [1] 101301 #>
# } ## ------------------------------------------------ ## Method `Epw$range_exist` ## ------------------------------------------------ # \dontrun{ epw$range_exist()
#> $wind_direction #> [0, 360] #> #> $present_weather_observation #> [0, 9] #> #> $dry_bulb_temperature #> (-Inf, 99.9) #> #> $dew_point_temperature #> (-Inf, 99.9) #> #> $relative_humidity #> [0, 999) #> #> $atmospheric_pressure #> [0, 999999) #> #> $global_horizontal_illuminance #> [0, 999999) #> #> $direct_normal_illuminance #> [0, 999999) #> #> $diffuse_horizontal_illuminance #> [0, 999999) #> #> $wind_speed #> [0, 999) #> #> $total_sky_cover #> [0, 99] #> #> $opaque_sky_cover #> [0, 99] #> #> $extraterrestrial_horizontal_radiation #> [0, 9999) #> #> $extraterrestrial_direct_normal_radiation #> [0, 9999) #> #> $horizontal_infrared_radiation_intensity_from_sky #> [0, 9999) #> #> $global_horizontal_radiation #> [0, 9999) #> #> $direct_normal_radiation #> [0, 999999) #> #> $diffuse_horizontal_radiation #> [0, 9999) #> #> $zenith_luminance #> [0, 99990) #> #> $visibility #> [0, 9999) #> #> $ceiling_height #> [0, 99999) #> #> $precipitable_water #> [0, 999) #> #> $aerosol_optical_depth #> [0, 0.999) #> #> $snow_depth #> [0, 999) #> #> $days_since_last_snow #> [0, 99) #> #> $albedo #> [0, 999) #> #> $liquid_precip_depth #> [0, 999) #> #> $liquid_precip_rate #> [0, 99) #>
# } ## ------------------------------------------------ ## Method `Epw$range_valid` ## ------------------------------------------------ # \dontrun{ epw$range_valid()
#> $dry_bulb_temperature #> [-90, 70] #> #> $dew_point_temperature #> [-90, 70] #> #> $relative_humidity #> [0, 110] #> #> $atmospheric_pressure #> (31000, 120000] #> #> $global_horizontal_illuminance #> [0, 999900) #> #> $direct_normal_illuminance #> [0, 999900) #> #> $diffuse_horizontal_illuminance #> [0, 999900) #> #> $wind_direction #> [0, 360] #> #> $wind_speed #> [0, 40] #> #> $total_sky_cover #> [0, 10] #> #> $opaque_sky_cover #> [0, 10] #> #> $present_weather_observation #> [0, 9] #> #> $extraterrestrial_horizontal_radiation #> [0, 9999) #> #> $extraterrestrial_direct_normal_radiation #> [0, 9999) #> #> $horizontal_infrared_radiation_intensity_from_sky #> [0, 9999) #> #> $global_horizontal_radiation #> [0, 9999) #> #> $direct_normal_radiation #> [0, 999999) #> #> $diffuse_horizontal_radiation #> [0, 9999) #> #> $zenith_luminance #> [0, 99990) #> #> $visibility #> [0, 9999) #> #> $ceiling_height #> [0, 99999) #> #> $precipitable_water #> [0, 999) #> #> $aerosol_optical_depth #> [0, 0.999) #> #> $snow_depth #> [0, 999) #> #> $days_since_last_snow #> [0, 99) #> #> $albedo #> [0, 999) #> #> $liquid_precip_depth #> [0, 999) #> #> $liquid_precip_rate #> [0, 99) #>
# } ## ------------------------------------------------ ## Method `Epw$fill_action` ## ------------------------------------------------ # \dontrun{ epw$fill_action("missing")
#> $use_previous #> [1] "dry_bulb_temperature" "atmospheric_pressure" "relative_humidity" #> [4] "dew_point_temperature" "wind_speed" "wind_direction" #> [7] "total_sky_cover" "opaque_sky_cover" "snow_depth" #> [10] "liquid_precip_depth" #> #> $use_zero #> [1] "direct_normal_radiation" "diffuse_horizontal_radiation" #>
epw$fill_action("out_of_range")
#> $do_nothing #> [1] "dry_bulb_temperature" "relative_humidity" "dew_point_temperature" #> [4] "wind_direction" "wind_speed" #> #> $use_zero #> [1] "direct_normal_radiation" "diffuse_horizontal_radiation" #> #> $use_previous #> [1] "atmospheric_pressure" #>
# } ## ------------------------------------------------ ## Method `Epw$data` ## ------------------------------------------------ # \dontrun{ # get weather data str(epw$data())
#> Classes ‘data.table’ and 'data.frame': 8760 obs. of 36 variables: #> $ datetime : POSIXct, format: "2020-01-01 01:00:00" "2020-01-01 02:00:00" ... #> $ year : int 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 ... #> $ month : int 1 1 1 1 1 1 1 1 1 1 ... #> $ day : int 1 1 1 1 1 1 1 1 1 1 ... #> $ hour : int 1 2 3 4 5 6 7 8 9 10 ... #> $ minute : int 0 0 0 0 0 0 0 0 0 0 ... #> $ datasource : chr "?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9" "?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9" "?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9" "?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9" ... #> $ dry_bulb_temperature : num 7.2 7.2 6.7 6.1 4.4 4.4 6.1 5 7.8 8.9 ... #> $ dew_point_temperature : num 5.6 5.6 5 5 3.9 3.9 4.4 2.8 5 6.7 ... #> $ relative_humidity : num 90 90 89 93 97 97 89 86 82 86 ... #> $ atmospheric_pressure : num 102200 102100 102200 102200 102200 ... #> $ extraterrestrial_horizontal_radiation : num 0 0 0 0 0 0 0 36 243 443 ... #> $ extraterrestrial_direct_normal_radiation : num 0 0 0 0 0 ... #> $ horizontal_infrared_radiation_intensity_from_sky: num 290 296 291 276 280 280 287 281 295 299 ... #> $ global_horizontal_radiation : num 0 0 0 0 0 0 0 2 121 276 ... #> $ direct_normal_radiation : num 0 0 0 0 0 0 0 69 477 651 ... #> $ diffuse_horizontal_radiation : num 0 0 0 0 0 0 0 1 39 71 ... #> $ global_horizontal_illuminance : num 0 0 0 0 0 ... #> $ direct_normal_illuminance : num 0 0 0 0 0 ... #> $ diffuse_horizontal_illuminance : num 0 0 0 0 0 ... #> $ zenith_luminance : num 0 0 0 0 0 ... #> $ wind_direction : num 0 170 210 200 260 180 0 0 0 0 ... #> $ wind_speed : num 0 2.1 2.1 1.5 3.1 2.1 0 0 0 0 ... #> $ total_sky_cover : int 2 4 3 0 3 3 3 3 3 2 ... #> $ opaque_sky_cover : int 2 4 3 0 3 3 3 3 3 2 ... #> $ visibility : num 16 16 16 16 16 16 16 16 16 16 ... #> $ ceiling_height : num 77777 77777 77777 77777 77777 ... #> $ present_weather_observation : int 9 9 9 9 9 9 9 9 9 9 ... #> $ present_weather_codes : chr "999999999" "999999999" "999999999" "999999999" ... #> $ precipitable_water : num 129 120 120 120 120 120 120 110 110 110 ... #> $ aerosol_optical_depth : num 0.108 0.108 0.108 0.108 0.108 0.108 0.108 0.108 0.108 0.108 ... #> $ snow_depth : num 0 0 0 0 0 0 0 0 0 0 ... #> $ days_since_last_snow : int 88 88 88 88 88 88 88 88 88 88 ... #> $ albedo : num 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 ... #> $ liquid_precip_depth : num 0 0 0 0 0 0 0 0 0 0 ... #> $ liquid_precip_rate : num 1 1 1 1 1 1 1 1 1 1 ... #> - attr(*, ".internal.selfref")=<externalptr> #> - attr(*, "index")= int #> ..- attr(*, "__minute__hour__day__month")= int 1 745 1417 2161 2881 3625 4345 5089 5833 6553 ...
# get weather data but change the year to 2018 # the year column is not changed by default, only the returned datetime column head(epw$data(start_year = 2018)$datetime)
#> [1] "2018-01-01 01:00:00 UTC" "2018-01-01 02:00:00 UTC" #> [3] "2018-01-01 03:00:00 UTC" "2018-01-01 04:00:00 UTC" #> [5] "2018-01-01 05:00:00 UTC" "2018-01-01 06:00:00 UTC"
str(epw$data(start_year = 2018)$year)
#> int [1:8760] 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 ...
# you can update the year column too head(epw$data(start_year = 2018, update = TRUE)$year)
#> [1] 2018 2018 2018 2018 2018 2018
# change the time zone of datetime column in the returned weather data attributes(epw$data()$datetime)
#> $class #> [1] "POSIXct" "POSIXt" #> #> $tzone #> [1] "UTC" #>
attributes(epw$data(tz = "Etc/GMT+8")$datetime)
#> $class #> [1] "POSIXct" "POSIXt" #> #> $tzone #> [1] "Etc/GMT+8" #>
# } ## ------------------------------------------------ ## Method `Epw$abnormal_data` ## ------------------------------------------------ # \dontrun{ epw$abnormal_data()
#> line datetime year month day hour minute #> 1: 216 1999-01-09 16:00:00 1999 1 9 16 0 #> 2: 233 1999-01-10 09:00:00 1999 1 10 9 0 #> 3: 234 1999-01-10 10:00:00 1999 1 10 10 0 #> 4: 235 1999-01-10 11:00:00 1999 1 10 11 0 #> 5: 236 1999-01-10 12:00:00 1999 1 10 12 0 #> --- #> 2166: 5837 1985-08-31 21:00:00 1985 8 31 21 0 #> 2167: 5838 1985-08-31 22:00:00 1985 8 31 22 0 #> 2168: 5839 1985-08-31 23:00:00 1985 8 31 23 0 #> 2169: 5840 1985-09-01 00:00:00 1985 8 31 24 0 #> 2170: 7129 1998-10-24 17:00:00 1998 10 24 17 0 #> datasource dry_bulb_temperature #> 1: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 10.7 #> 2: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 6.8 #> 3: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 6.8 #> 4: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 7.1 #> 5: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 7.5 #> --- #> 2166: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 16.7 #> 2167: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 16.3 #> 2168: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 15.9 #> 2169: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 15.5 #> 2170: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 16.3 #> dew_point_temperature relative_humidity atmospheric_pressure #> 1: 5.0 68 102300 #> 2: 3.4 79 102300 #> 3: 3.2 78 102200 #> 4: 3.3 77 102200 #> 5: 4.3 80 102100 #> --- #> 2166: 8.9 60 101400 #> 2167: 9.3 65 101400 #> 2168: 9.7 67 101400 #> 2169: 10.1 67 101400 #> 2170: 12.4 78 101700 #> extraterrestrial_horizontal_radiation #> 1: 366 #> 2: 247 #> 3: 451 #> 4: 603 #> 5: 693 #> --- #> 2166: 0 #> 2167: 0 #> 2168: 0 #> 2169: 0 #> 2170: 210 #> extraterrestrial_direct_normal_radiation #> 1: 1415 #> 2: 1415 #> 3: 1415 #> 4: 1415 #> 5: 1415 #> --- #> 2166: 0 #> 2167: 0 #> 2168: 0 #> 2169: 0 #> 2170: 1382 #> horizontal_infrared_radiation_intensity_from_sky #> 1: 300 #> 2: 294 #> 3: 294 #> 4: 293 #> 5: 298 #> --- #> 2166: 344 #> 2167: 355 #> 2168: 354 #> 2169: 360 #> 2170: 344 #> global_horizontal_radiation direct_normal_radiation #> 1: 141 79 #> 2: 118 418 #> 3: 251 466 #> 4: 349 444 #> 5: 411 470 #> --- #> 2166: 0 0 #> 2167: 0 0 #> 2168: 0 0 #> 2169: 0 0 #> 2170: 121 91 #> diffuse_horizontal_radiation global_horizontal_illuminance #> 1: 120 15400 #> 2: 44 12100 #> 3: 102 26400 #> 4: 159 36300 #> 5: 180 43000 #> --- #> 2166: 0 0 #> 2167: 0 0 #> 2168: 0 0 #> 2169: 0 0 #> 2170: 107 13100 #> direct_normal_illuminance diffuse_horizontal_illuminance zenith_luminance #> 1: 7000 13500 2940 #> 2: 30300 6700 790 #> 3: 42100 12900 1910 #> 4: 43100 17900 3210 #> 5: 46900 20000 3800 #> --- #> 2166: 0 0 0 #> 2167: 0 0 0 #> 2168: 0 0 0 #> 2169: 0 0 0 #> 2170: 7100 12100 2050 #> wind_direction wind_speed total_sky_cover opaque_sky_cover visibility #> 1: 40 2.6 2 1 8.0 #> 2: 230 3.9 5 5 8.0 #> 3: 260 2.4 6 5 8.0 #> 4: 0 0.0 5 4 8.0 #> 5: 160 1.3 5 5 8.0 #> --- #> 2166: 300 6.7 6 5 24.1 #> 2167: 300 6.6 8 8 24.1 #> 2168: 320 6.4 8 8 24.1 #> 2169: 310 6.3 9 9 24.1 #> 2170: 280 5.7 4 4 16.0 #> ceiling_height present_weather_observation present_weather_codes #> 1: 7560 9 999999999 #> 2: 7466 9 999999999 #> 3: 6609 9 999999999 #> 4: 753 9 999999999 #> 5: 0 9 999999999 #> --- #> 2166: 3050 9 999999999 #> 2167: 3050 9 999999999 #> 2168: 3050 9 999999999 #> 2169: 3050 9 999999999 #> 2170: 77777 9 999999999 #> precipitable_water aerosol_optical_depth snow_depth days_since_last_snow #> 1: 80 0.109 0 88 #> 2: 100 0.109 0 88 #> 3: 110 0.109 0 88 #> 4: 110 0.109 0 88 #> 5: 110 0.109 0 88 #> --- #> 2166: 250 0.140 0 88 #> 2167: 250 0.140 0 88 #> 2168: 250 0.140 0 88 #> 2169: 259 0.140 0 88 #> 2170: 179 0.126 0 88 #> albedo liquid_precip_depth liquid_precip_rate #> 1: 0.16 999 99 #> 2: 0.16 999 99 #> 3: 0.16 999 99 #> 4: 0.16 999 99 #> 5: 0.16 999 99 #> --- #> 2166: 999.00 999 99 #> 2167: 999.00 999 99 #> 2168: 999.00 999 99 #> 2169: 999.00 999 99 #> 2170: 0.18 999 99
# only check if there are any abnormal values in air temperature and # liquid precipitation rate epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"))
#> line datetime year month day hour minute #> 1: 216 1999-01-09 16:00:00 1999 1 9 16 0 #> 2: 233 1999-01-10 09:00:00 1999 1 10 9 0 #> 3: 234 1999-01-10 10:00:00 1999 1 10 10 0 #> 4: 235 1999-01-10 11:00:00 1999 1 10 11 0 #> 5: 236 1999-01-10 12:00:00 1999 1 10 12 0 #> --- #> 2166: 5837 1985-08-31 21:00:00 1985 8 31 21 0 #> 2167: 5838 1985-08-31 22:00:00 1985 8 31 22 0 #> 2168: 5839 1985-08-31 23:00:00 1985 8 31 23 0 #> 2169: 5840 1985-09-01 00:00:00 1985 8 31 24 0 #> 2170: 7129 1998-10-24 17:00:00 1998 10 24 17 0 #> datasource dry_bulb_temperature #> 1: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 10.7 #> 2: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 6.8 #> 3: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 6.8 #> 4: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 7.1 #> 5: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 7.5 #> --- #> 2166: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 16.7 #> 2167: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 16.3 #> 2168: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 15.9 #> 2169: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 15.5 #> 2170: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 16.3 #> dew_point_temperature relative_humidity atmospheric_pressure #> 1: 5.0 68 102300 #> 2: 3.4 79 102300 #> 3: 3.2 78 102200 #> 4: 3.3 77 102200 #> 5: 4.3 80 102100 #> --- #> 2166: 8.9 60 101400 #> 2167: 9.3 65 101400 #> 2168: 9.7 67 101400 #> 2169: 10.1 67 101400 #> 2170: 12.4 78 101700 #> extraterrestrial_horizontal_radiation #> 1: 366 #> 2: 247 #> 3: 451 #> 4: 603 #> 5: 693 #> --- #> 2166: 0 #> 2167: 0 #> 2168: 0 #> 2169: 0 #> 2170: 210 #> extraterrestrial_direct_normal_radiation #> 1: 1415 #> 2: 1415 #> 3: 1415 #> 4: 1415 #> 5: 1415 #> --- #> 2166: 0 #> 2167: 0 #> 2168: 0 #> 2169: 0 #> 2170: 1382 #> horizontal_infrared_radiation_intensity_from_sky #> 1: 300 #> 2: 294 #> 3: 294 #> 4: 293 #> 5: 298 #> --- #> 2166: 344 #> 2167: 355 #> 2168: 354 #> 2169: 360 #> 2170: 344 #> global_horizontal_radiation direct_normal_radiation #> 1: 141 79 #> 2: 118 418 #> 3: 251 466 #> 4: 349 444 #> 5: 411 470 #> --- #> 2166: 0 0 #> 2167: 0 0 #> 2168: 0 0 #> 2169: 0 0 #> 2170: 121 91 #> diffuse_horizontal_radiation global_horizontal_illuminance #> 1: 120 15400 #> 2: 44 12100 #> 3: 102 26400 #> 4: 159 36300 #> 5: 180 43000 #> --- #> 2166: 0 0 #> 2167: 0 0 #> 2168: 0 0 #> 2169: 0 0 #> 2170: 107 13100 #> direct_normal_illuminance diffuse_horizontal_illuminance zenith_luminance #> 1: 7000 13500 2940 #> 2: 30300 6700 790 #> 3: 42100 12900 1910 #> 4: 43100 17900 3210 #> 5: 46900 20000 3800 #> --- #> 2166: 0 0 0 #> 2167: 0 0 0 #> 2168: 0 0 0 #> 2169: 0 0 0 #> 2170: 7100 12100 2050 #> wind_direction wind_speed total_sky_cover opaque_sky_cover visibility #> 1: 40 2.6 2 1 8.0 #> 2: 230 3.9 5 5 8.0 #> 3: 260 2.4 6 5 8.0 #> 4: 0 0.0 5 4 8.0 #> 5: 160 1.3 5 5 8.0 #> --- #> 2166: 300 6.7 6 5 24.1 #> 2167: 300 6.6 8 8 24.1 #> 2168: 320 6.4 8 8 24.1 #> 2169: 310 6.3 9 9 24.1 #> 2170: 280 5.7 4 4 16.0 #> ceiling_height present_weather_observation present_weather_codes #> 1: 7560 9 999999999 #> 2: 7466 9 999999999 #> 3: 6609 9 999999999 #> 4: 753 9 999999999 #> 5: 0 9 999999999 #> --- #> 2166: 3050 9 999999999 #> 2167: 3050 9 999999999 #> 2168: 3050 9 999999999 #> 2169: 3050 9 999999999 #> 2170: 77777 9 999999999 #> precipitable_water aerosol_optical_depth snow_depth days_since_last_snow #> 1: 80 0.109 0 88 #> 2: 100 0.109 0 88 #> 3: 110 0.109 0 88 #> 4: 110 0.109 0 88 #> 5: 110 0.109 0 88 #> --- #> 2166: 250 0.140 0 88 #> 2167: 250 0.140 0 88 #> 2168: 250 0.140 0 88 #> 2169: 259 0.140 0 88 #> 2170: 179 0.126 0 88 #> albedo liquid_precip_depth liquid_precip_rate #> 1: 0.16 999 99 #> 2: 0.16 999 99 #> 3: 0.16 999 99 #> 4: 0.16 999 99 #> 5: 0.16 999 99 #> --- #> 2166: 999.00 999 99 #> 2167: 999.00 999 99 #> 2168: 999.00 999 99 #> 2169: 999.00 999 99 #> 2170: 0.18 999 99
# save as above, but only return date time columns plus those 2 columns epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"), keep_all = FALSE )
#> line datetime year month day hour minute dry_bulb_temperature #> 1: 216 1999-01-09 16:00:00 1999 1 9 16 0 10.7 #> 2: 233 1999-01-10 09:00:00 1999 1 10 9 0 6.8 #> 3: 234 1999-01-10 10:00:00 1999 1 10 10 0 6.8 #> 4: 235 1999-01-10 11:00:00 1999 1 10 11 0 7.1 #> 5: 236 1999-01-10 12:00:00 1999 1 10 12 0 7.5 #> --- #> 2166: 5837 1985-08-31 21:00:00 1985 8 31 21 0 16.7 #> 2167: 5838 1985-08-31 22:00:00 1985 8 31 22 0 16.3 #> 2168: 5839 1985-08-31 23:00:00 1985 8 31 23 0 15.9 #> 2169: 5840 1985-09-01 00:00:00 1985 8 31 24 0 15.5 #> 2170: 7129 1998-10-24 17:00:00 1998 10 24 17 0 16.3 #> liquid_precip_rate #> 1: 99 #> 2: 99 #> 3: 99 #> 4: 99 #> 5: 99 #> --- #> 2166: 99 #> 2167: 99 #> 2168: 99 #> 2169: 99 #> 2170: 99
# same as above, but only check for missing values epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"), type = "missing" )
#> line datetime year month day hour minute #> 1: 216 1999-01-09 16:00:00 1999 1 9 16 0 #> 2: 233 1999-01-10 09:00:00 1999 1 10 9 0 #> 3: 234 1999-01-10 10:00:00 1999 1 10 10 0 #> 4: 235 1999-01-10 11:00:00 1999 1 10 11 0 #> 5: 236 1999-01-10 12:00:00 1999 1 10 12 0 #> --- #> 2166: 5837 1985-08-31 21:00:00 1985 8 31 21 0 #> 2167: 5838 1985-08-31 22:00:00 1985 8 31 22 0 #> 2168: 5839 1985-08-31 23:00:00 1985 8 31 23 0 #> 2169: 5840 1985-09-01 00:00:00 1985 8 31 24 0 #> 2170: 7129 1998-10-24 17:00:00 1998 10 24 17 0 #> datasource dry_bulb_temperature #> 1: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 10.7 #> 2: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 6.8 #> 3: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 6.8 #> 4: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 7.1 #> 5: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 7.5 #> --- #> 2166: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 16.7 #> 2167: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 16.3 #> 2168: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 15.9 #> 2169: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9*_*9*9*9*9*9 15.5 #> 2170: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9*9?9?9?9*9*9?9*9*9 16.3 #> dew_point_temperature relative_humidity atmospheric_pressure #> 1: 5.0 68 102300 #> 2: 3.4 79 102300 #> 3: 3.2 78 102200 #> 4: 3.3 77 102200 #> 5: 4.3 80 102100 #> --- #> 2166: 8.9 60 101400 #> 2167: 9.3 65 101400 #> 2168: 9.7 67 101400 #> 2169: 10.1 67 101400 #> 2170: 12.4 78 101700 #> extraterrestrial_horizontal_radiation #> 1: 366 #> 2: 247 #> 3: 451 #> 4: 603 #> 5: 693 #> --- #> 2166: 0 #> 2167: 0 #> 2168: 0 #> 2169: 0 #> 2170: 210 #> extraterrestrial_direct_normal_radiation #> 1: 1415 #> 2: 1415 #> 3: 1415 #> 4: 1415 #> 5: 1415 #> --- #> 2166: 0 #> 2167: 0 #> 2168: 0 #> 2169: 0 #> 2170: 1382 #> horizontal_infrared_radiation_intensity_from_sky #> 1: 300 #> 2: 294 #> 3: 294 #> 4: 293 #> 5: 298 #> --- #> 2166: 344 #> 2167: 355 #> 2168: 354 #> 2169: 360 #> 2170: 344 #> global_horizontal_radiation direct_normal_radiation #> 1: 141 79 #> 2: 118 418 #> 3: 251 466 #> 4: 349 444 #> 5: 411 470 #> --- #> 2166: 0 0 #> 2167: 0 0 #> 2168: 0 0 #> 2169: 0 0 #> 2170: 121 91 #> diffuse_horizontal_radiation global_horizontal_illuminance #> 1: 120 15400 #> 2: 44 12100 #> 3: 102 26400 #> 4: 159 36300 #> 5: 180 43000 #> --- #> 2166: 0 0 #> 2167: 0 0 #> 2168: 0 0 #> 2169: 0 0 #> 2170: 107 13100 #> direct_normal_illuminance diffuse_horizontal_illuminance zenith_luminance #> 1: 7000 13500 2940 #> 2: 30300 6700 790 #> 3: 42100 12900 1910 #> 4: 43100 17900 3210 #> 5: 46900 20000 3800 #> --- #> 2166: 0 0 0 #> 2167: 0 0 0 #> 2168: 0 0 0 #> 2169: 0 0 0 #> 2170: 7100 12100 2050 #> wind_direction wind_speed total_sky_cover opaque_sky_cover visibility #> 1: 40 2.6 2 1 8.0 #> 2: 230 3.9 5 5 8.0 #> 3: 260 2.4 6 5 8.0 #> 4: 0 0.0 5 4 8.0 #> 5: 160 1.3 5 5 8.0 #> --- #> 2166: 300 6.7 6 5 24.1 #> 2167: 300 6.6 8 8 24.1 #> 2168: 320 6.4 8 8 24.1 #> 2169: 310 6.3 9 9 24.1 #> 2170: 280 5.7 4 4 16.0 #> ceiling_height present_weather_observation present_weather_codes #> 1: 7560 9 999999999 #> 2: 7466 9 999999999 #> 3: 6609 9 999999999 #> 4: 753 9 999999999 #> 5: 0 9 999999999 #> --- #> 2166: 3050 9 999999999 #> 2167: 3050 9 999999999 #> 2168: 3050 9 999999999 #> 2169: 3050 9 999999999 #> 2170: 77777 9 999999999 #> precipitable_water aerosol_optical_depth snow_depth days_since_last_snow #> 1: 80 0.109 0 88 #> 2: 100 0.109 0 88 #> 3: 110 0.109 0 88 #> 4: 110 0.109 0 88 #> 5: 110 0.109 0 88 #> --- #> 2166: 250 0.140 0 88 #> 2167: 250 0.140 0 88 #> 2168: 250 0.140 0 88 #> 2169: 259 0.140 0 88 #> 2170: 179 0.126 0 88 #> albedo liquid_precip_depth liquid_precip_rate #> 1: 0.16 999 99 #> 2: 0.16 999 99 #> 3: 0.16 999 99 #> 4: 0.16 999 99 #> 5: 0.16 999 99 #> --- #> 2166: 999.00 999 99 #> 2167: 999.00 999 99 #> 2168: 999.00 999 99 #> 2169: 999.00 999 99 #> 2170: 0.18 999 99
# same as above, but only check for out-of-range values epw$abnormal_data(cols = c("dry_bulb_temperature", "liquid_precip_rate"), type = "out_of_range" )
#> No abnormal data found.
#> Empty data.table (0 rows and 37 cols): line,datetime,year,month,day,hour...
# } ## ------------------------------------------------ ## Method `Epw$redundant_data` ## ------------------------------------------------ # \dontrun{ epw$redundant_data()
#> No redundant data found.
#> Empty data.table (0 rows and 37 cols): line,datetime,year,month,day,hour...
# } ## ------------------------------------------------ ## Method `Epw$make_na` ## ------------------------------------------------ # \dontrun{ # turn all missing values into NAs summary(epw$data()$liquid_precip_rate)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 1.00 1.00 1.00 25.28 1.00 99.00
epw$make_na(missing = TRUE) summary(epw$data()$liquid_precip_rate)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's #> 1 1 1 1 1 1 2170
# } ## ------------------------------------------------ ## Method `Epw$fill_abnormal` ## ------------------------------------------------ # \dontrun{ # turn all missing values into NAs summary(epw$data()$liquid_precip_rate)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's #> 1 1 1 1 1 1 2170
epw$fill_abnormal(missing = TRUE) summary(epw$data()$liquid_precip_rate)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 1.00 1.00 1.00 25.28 1.00 99.00
# } ## ------------------------------------------------ ## Method `Epw$add_unit` ## ------------------------------------------------ # \dontrun{ # get weather data with units epw$add_unit() head(epw$data())
#> datetime year month day hour minute #> 1: 2020-01-01 01:00:00 1999 1 1 1 0 #> 2: 2020-01-01 02:00:00 1999 1 1 2 0 #> 3: 2020-01-01 03:00:00 1999 1 1 3 0 #> 4: 2020-01-01 04:00:00 1999 1 1 4 0 #> 5: 2020-01-01 05:00:00 1999 1 1 5 0 #> 6: 2020-01-01 06:00:00 1999 1 1 6 0 #> datasource dry_bulb_temperature #> 1: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 7.2 [°C] #> 2: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 7.2 [°C] #> 3: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 6.7 [°C] #> 4: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 6.1 [°C] #> 5: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 4.4 [°C] #> 6: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 4.4 [°C] #> dew_point_temperature relative_humidity atmospheric_pressure #> 1: 5.6 [°C] 90 [%] 102200 [Pa] #> 2: 5.6 [°C] 90 [%] 102100 [Pa] #> 3: 5.0 [°C] 89 [%] 102200 [Pa] #> 4: 5.0 [°C] 93 [%] 102200 [Pa] #> 5: 3.9 [°C] 97 [%] 102200 [Pa] #> 6: 3.9 [°C] 97 [%] 102200 [Pa] #> extraterrestrial_horizontal_radiation #> 1: 0 [h*W/m^2] #> 2: 0 [h*W/m^2] #> 3: 0 [h*W/m^2] #> 4: 0 [h*W/m^2] #> 5: 0 [h*W/m^2] #> 6: 0 [h*W/m^2] #> extraterrestrial_direct_normal_radiation #> 1: 0 [h*W/m^2] #> 2: 0 [h*W/m^2] #> 3: 0 [h*W/m^2] #> 4: 0 [h*W/m^2] #> 5: 0 [h*W/m^2] #> 6: 0 [h*W/m^2] #> horizontal_infrared_radiation_intensity_from_sky global_horizontal_radiation #> 1: 290 [h*W/m^2] 0 [h*W/m^2] #> 2: 296 [h*W/m^2] 0 [h*W/m^2] #> 3: 291 [h*W/m^2] 0 [h*W/m^2] #> 4: 276 [h*W/m^2] 0 [h*W/m^2] #> 5: 280 [h*W/m^2] 0 [h*W/m^2] #> 6: 280 [h*W/m^2] 0 [h*W/m^2] #> direct_normal_radiation diffuse_horizontal_radiation #> 1: 0 [h*W/m^2] 0 [h*W/m^2] #> 2: 0 [h*W/m^2] 0 [h*W/m^2] #> 3: 0 [h*W/m^2] 0 [h*W/m^2] #> 4: 0 [h*W/m^2] 0 [h*W/m^2] #> 5: 0 [h*W/m^2] 0 [h*W/m^2] #> 6: 0 [h*W/m^2] 0 [h*W/m^2] #> global_horizontal_illuminance direct_normal_illuminance #> 1: 0 [lx] 0 [lx] #> 2: 0 [lx] 0 [lx] #> 3: 0 [lx] 0 [lx] #> 4: 0 [lx] 0 [lx] #> 5: 0 [lx] 0 [lx] #> 6: 0 [lx] 0 [lx] #> diffuse_horizontal_illuminance zenith_luminance wind_direction wind_speed #> 1: 0 [lx] 0 [lx] 0 [°] 0.0 [m/s] #> 2: 0 [lx] 0 [lx] 170 [°] 2.1 [m/s] #> 3: 0 [lx] 0 [lx] 210 [°] 2.1 [m/s] #> 4: 0 [lx] 0 [lx] 200 [°] 1.5 [m/s] #> 5: 0 [lx] 0 [lx] 260 [°] 3.1 [m/s] #> 6: 0 [lx] 0 [lx] 180 [°] 2.1 [m/s] #> total_sky_cover opaque_sky_cover visibility ceiling_height #> 1: 2 2 16 [km] 77777 [m] #> 2: 4 4 16 [km] 77777 [m] #> 3: 3 3 16 [km] 77777 [m] #> 4: 0 0 16 [km] 77777 [m] #> 5: 3 3 16 [km] 77777 [m] #> 6: 3 3 16 [km] 77777 [m] #> present_weather_observation present_weather_codes precipitable_water #> 1: 9 999999999 129 [mm] #> 2: 9 999999999 120 [mm] #> 3: 9 999999999 120 [mm] #> 4: 9 999999999 120 [mm] #> 5: 9 999999999 120 [mm] #> 6: 9 999999999 120 [mm] #> aerosol_optical_depth snow_depth days_since_last_snow albedo #> 1: 0.108 0 [cm] 88 [d] 0.16 #> 2: 0.108 0 [cm] 88 [d] 0.16 #> 3: 0.108 0 [cm] 88 [d] 0.16 #> 4: 0.108 0 [cm] 88 [d] 0.16 #> 5: 0.108 0 [cm] 88 [d] 0.16 #> 6: 0.108 0 [cm] 88 [d] 0.16 #> liquid_precip_depth liquid_precip_rate #> 1: 0 [mm] 1 [h] #> 2: 0 [mm] 1 [h] #> 3: 0 [mm] 1 [h] #> 4: 0 [mm] 1 [h] #> 5: 0 [mm] 1 [h] #> 6: 0 [mm] 1 [h]
# with units specified, you can easily perform unit conversion using units # package t_dry_bulb <- epw$data()$dry_bulb_temperature units(t_dry_bulb) <- with(units::ud_units, "kelvin") head(t_dry_bulb)
#> Units: [K] #> [1] 280.35 280.35 279.85 279.25 277.55 277.55
# } ## ------------------------------------------------ ## Method `Epw$drop_unit` ## ------------------------------------------------ # \dontrun{ epw$drop_unit() epw$data()
#> datetime year month day hour minute #> 1: 2020-01-01 01:00:00 1999 1 1 1 0 #> 2: 2020-01-01 02:00:00 1999 1 1 2 0 #> 3: 2020-01-01 03:00:00 1999 1 1 3 0 #> 4: 2020-01-01 04:00:00 1999 1 1 4 0 #> 5: 2020-01-01 05:00:00 1999 1 1 5 0 #> --- #> 8756: 2020-12-31 20:00:00 1997 12 31 20 0 #> 8757: 2020-12-31 21:00:00 1997 12 31 21 0 #> 8758: 2020-12-31 22:00:00 1997 12 31 22 0 #> 8759: 2020-12-31 23:00:00 1997 12 31 23 0 #> 8760: 2021-01-01 00:00:00 1997 12 31 24 0 #> datasource dry_bulb_temperature #> 1: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 7.2 #> 2: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 7.2 #> 3: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 6.7 #> 4: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 6.1 #> 5: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 4.4 #> --- #> 8756: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 13.3 #> 8757: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 12.2 #> 8758: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 10.6 #> 8759: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 10.6 #> 8760: ?9?9?9?9E0?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9*9*9?9?9?9 11.1 #> dew_point_temperature relative_humidity atmospheric_pressure #> 1: 5.6 90 102200 #> 2: 5.6 90 102100 #> 3: 5.0 89 102200 #> 4: 5.0 93 102200 #> 5: 3.9 97 102200 #> --- #> 8756: 11.7 90 101800 #> 8757: 11.1 93 101700 #> 8758: 10.0 96 101800 #> 8759: 10.6 100 101800 #> 8760: 10.6 97 101700 #> extraterrestrial_horizontal_radiation #> 1: 0 #> 2: 0 #> 3: 0 #> 4: 0 #> 5: 0 #> --- #> 8756: 0 #> 8757: 0 #> 8758: 0 #> 8759: 0 #> 8760: 0 #> extraterrestrial_direct_normal_radiation #> 1: 0 #> 2: 0 #> 3: 0 #> 4: 0 #> 5: 0 #> --- #> 8756: 0 #> 8757: 0 #> 8758: 0 #> 8759: 0 #> 8760: 0 #> horizontal_infrared_radiation_intensity_from_sky #> 1: 290 #> 2: 296 #> 3: 291 #> 4: 276 #> 5: 280 #> --- #> 8756: 338 #> 8757: 326 #> 8758: 317 #> 8759: 337 #> 8760: 349 #> global_horizontal_radiation direct_normal_radiation #> 1: 0 0 #> 2: 0 0 #> 3: 0 0 #> 4: 0 0 #> 5: 0 0 #> --- #> 8756: 0 0 #> 8757: 0 0 #> 8758: 0 0 #> 8759: 0 0 #> 8760: 0 0 #> diffuse_horizontal_radiation global_horizontal_illuminance #> 1: 0 0 #> 2: 0 0 #> 3: 0 0 #> 4: 0 0 #> 5: 0 0 #> --- #> 8756: 0 0 #> 8757: 0 0 #> 8758: 0 0 #> 8759: 0 0 #> 8760: 0 0 #> direct_normal_illuminance diffuse_horizontal_illuminance zenith_luminance #> 1: 0 0 0 #> 2: 0 0 0 #> 3: 0 0 0 #> 4: 0 0 0 #> 5: 0 0 0 #> --- #> 8756: 0 0 0 #> 8757: 0 0 0 #> 8758: 0 0 0 #> 8759: 0 0 0 #> 8760: 0 0 0 #> wind_direction wind_speed total_sky_cover opaque_sky_cover visibility #> 1: 0 0.0 2 2 16.0 #> 2: 170 2.1 4 4 16.0 #> 3: 210 2.1 3 3 16.0 #> 4: 200 1.5 0 0 16.0 #> 5: 260 3.1 3 3 16.0 #> --- #> 8756: 280 3.1 7 7 14.4 #> 8757: 350 1.5 5 5 16.0 #> 8758: 180 2.1 5 5 11.2 #> 8759: 170 2.1 9 9 6.4 #> 8760: 140 1.5 10 10 9.6 #> ceiling_height present_weather_observation present_weather_codes #> 1: 77777 9 999999999 #> 2: 77777 9 999999999 #> 3: 77777 9 999999999 #> 4: 77777 9 999999999 #> 5: 77777 9 999999999 #> --- #> 8756: 579 9 999999999 #> 8757: 77777 9 999999999 #> 8758: 77777 9 999999999 #> 8759: 640 9 999999999 #> 8760: 640 9 999999999 #> precipitable_water aerosol_optical_depth snow_depth days_since_last_snow #> 1: 129 0.108 0 88 #> 2: 120 0.108 0 88 #> 3: 120 0.108 0 88 #> 4: 120 0.108 0 88 #> 5: 120 0.108 0 88 #> --- #> 8756: 150 0.108 0 88 #> 8757: 150 0.108 0 88 #> 8758: 150 0.108 0 88 #> 8759: 150 0.108 0 88 #> 8760: 150 0.108 0 88 #> albedo liquid_precip_depth liquid_precip_rate #> 1: 0.16 0 1 #> 2: 0.16 0 1 #> 3: 0.16 0 1 #> 4: 0.16 0 1 #> 5: 0.16 0 1 #> --- #> 8756: 0.21 0 1 #> 8757: 0.21 0 1 #> 8758: 0.21 0 1 #> 8759: 0.21 0 1 #> 8760: 0.21 0 1
# } ## ------------------------------------------------ ## Method `Epw$purge` ## ------------------------------------------------ # \dontrun{ epw$purge()
#> No redundant data found. Nothing to purge.
# } ## ------------------------------------------------ ## Method `Epw$add` ## ------------------------------------------------ # \dontrun{ # will fail since date time in input data has already been covered by # existing data period epw$add(epw$data())
#> Error: Failed to set target data period because date time in input data has overlapped with data period #1 'test' [1/ 1, 12/31].
# } ## ------------------------------------------------ ## Method `Epw$set` ## ------------------------------------------------ # \dontrun{ # change the weather data epw$set(epw$data(), warning = FALSE)
#> ── Info ──────────────────────────────────────────────────────────────────────── #> Data period #1 has been replaced with input data. #> Name StartDayOfWeek StartDay EndDay #> 1: test Sunday 1/ 1 12/31
# } ## ------------------------------------------------ ## Method `Epw$is_unsaved` ## ------------------------------------------------ # \dontrun{ epw$is_unsaved()
#> [1] TRUE
# } ## ------------------------------------------------ ## Method `Epw$save` ## ------------------------------------------------ # \dontrun{ # save the weather file epw$save(file.path(tempdir(), "weather.epw"), overwrite = TRUE) # } ## ------------------------------------------------ ## Method `Epw$print` ## ------------------------------------------------ # \dontrun{ epw$print()
#> ══ EnergyPlus Weather File ═════════════════════════════════════════════════════ #> [Location ]: MyCity, CA, USA #> {N 37°37'}, {W 122°24'}, {UTC-08:00} #> [Elevation]: 2m above see level #> [Data Src ]: TMY3 #> [WMO Stat ]: 724940 #> [Leap Year]: FALSE #> [Interval ]: 60 mins #> #> ── Data Periods ──────────────────────────────────────────────────────────────── #> Name StartDayOfWeek StartDay EndDay #> 1: test Sunday 1/ 1 12/31 #> #> ────────────────────────────────────────────────────────────────────────────────
# }