match_coord() takes an EPW and uses its longitude and latitude to match corresponding values that meet specified threshold in NetCDF files.

match_coord(epw, threshold = list(lon = 1, lat = 1), max_num = NULL)



Possible values:

  • A file path of EPW file

  • An eplusr::Epw object

  • A regular expression used to search locations in EnergyPlus Weather Database, e.g. "los angeles.*tmy3". You will be asked to select a matched EPW to download and read. It will be saved into tempdir(). Note that the search is case-insensitive


A list of 2 elements lon and lat specifying the absolute distance threshold used when matching longitude and latitude. Default: list(lon = 1.0, lat = 1.0)


The maximum number to be matched for both longitude and latitude when threshold is matched. Default is NULL, which means no limit


An epw_cmip6_coord object, which is basically a list of 3 elements:

  • epw: An eplusr::Epw object parsed from input epw argument

  • meta: A list containing basic meta data of input EPW, including city, state_province, country, latitute and longitude.

  • coord: A data.table::data.table() which is basically CMIP6 index database with an appending new list column coord that contains matched latitudes and longitudes in each NetCDF file. Each element in coord contains 2 elements lat and lon, in which contains the 4 components describing the matched coordinates.

    • index: the indices of matched coordinates

    • value: the actual longitude or latitude in the NetCDF coordinate grids

    • dis: the distance between the coordinate values in NetCDF and input EPW

    • which: The value indices of longitude or latitude in the NetCDF coordinate grids. These values are used to extract the corresponding variable values


match_coord() uses future.apply underneath. You can use your preferable future backend to speed up data extraction in parallel. By default, match_coord() uses future::sequential backend, which runs things in sequential.


if (FALSE) { # download an EPW from EnergyPlus website epw <- eplusr::download_weather("los angeles.*TMY3", dir = tempdir(), type = "EPW", ask = FALSE) match_coord(epw, threshold = list(lon = 1.0, lat = 1.0)) }