{"id":13948922,"url":"https://github.com/ideas-lab-nus/epwshiftr","last_synced_at":"2026-02-21T01:31:39.062Z","repository":{"id":39059339,"uuid":"228311544","full_name":"ideas-lab-nus/epwshiftr","owner":"ideas-lab-nus","description":"Create future EnergyPlus Weather files using CMIP6 data","archived":false,"fork":false,"pushed_at":"2025-12-20T19:38:40.000Z","size":1323,"stargazers_count":40,"open_issues_count":12,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-02-17T22:10:54.143Z","etag":null,"topics":["climate-change","cmip6","energyplus","epw","esgf"],"latest_commit_sha":null,"homepage":"https://ideas-lab-nus.github.io/epwshiftr/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ideas-lab-nus.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-16T05:44:18.000Z","updated_at":"2026-02-12T11:44:44.000Z","dependencies_parsed_at":"2026-01-22T06:03:02.436Z","dependency_job_id":null,"html_url":"https://github.com/ideas-lab-nus/epwshiftr","commit_stats":{"total_commits":187,"total_committers":3,"mean_commits":"62.333333333333336","dds":"0.20855614973262027","last_synced_commit":"9151d3914d7b7978fbec3c59294333961a2b7e0e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ideas-lab-nus/epwshiftr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideas-lab-nus%2Fepwshiftr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideas-lab-nus%2Fepwshiftr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideas-lab-nus%2Fepwshiftr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideas-lab-nus%2Fepwshiftr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ideas-lab-nus","download_url":"https://codeload.github.com/ideas-lab-nus/epwshiftr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideas-lab-nus%2Fepwshiftr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29629623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["climate-change","cmip6","energyplus","epw","esgf"],"created_at":"2024-08-08T05:01:34.472Z","updated_at":"2026-02-21T01:31:39.040Z","avatar_url":"https://github.com/ideas-lab-nus.png","language":"R","funding_links":[],"categories":["Climate Change"],"sub_categories":["Climate Data Processing and Analysis"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n\nlibrary(epwshiftr)\n\n# copy files in advance\nf \u003c- c(\"tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20490101-20491231.nc\",\n       \"tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20500101-20501231.nc\",\n       \"tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20510101-20511231.nc\",\n       \"hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20490101-20491231.nc\",\n       \"hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20500101-20501231.nc\",\n       \"hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20510101-20511231.nc\",\n       \"tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20790101-20791231.nc\",\n       \"tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20800101-20801231.nc\",\n       \"tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20810101-20811231.nc\",\n       \"hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20790101-20791231.nc\",\n       \"hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20800101-20801231.nc\",\n       \"hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20810101-20811231.nc\"\n)\nfile.copy(file.path(\"/mnt/d/ScenarioMIP\", f), tempdir())\n```\n\n# epwshiftr \u003cimg src=\"man/figures/logo.svg\" align=\"right\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R build status](https://github.com/ideas-lab-nus/epwshiftr/workflows/R-CMD-check/badge.svg)](https://github.com/ideas-lab-nus/epwshiftr/actions)\n[![CRAN status](https://www.r-pkg.org/badges/version/epwshiftr)](https://CRAN.R-project.org/package=epwshiftr)\n[![Codecov test coverage](https://codecov.io/gh/ideas-lab-nus/epwshiftr/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ideas-lab-nus/epwshiftr?branch=master)\n[![CRAN Download Badge](https://cranlogs.r-pkg.org/badges/epwshiftr)](https://cran.r-project.org/package=epwshiftr)\n\u003c!-- badges: end --\u003e\n\n\u003e Create future EnergyPlus Weather files using CMIP6 data\n\n## How to cite\n\nTo cite epwshiftr in publications use:\n\n    Jia, Hongyuan, Chong, Adrian, Ning, Baisong, 2023.\n    Epwshiftr: incorporating open data of climate change prediction into building performance simulation for future adaptation and mitigation,\n    in: Proceedings of Building Simulation 2023: 18th Conference of IBPSA, Building Simulation.\n    Presented at the Building Simulation 2023, IBPSA, Shanghai, China, pp. 3201–3207.\n    https://doi.org/10.26868/25222708.2023.1612\n\nA BibTeX entry for LaTeX users is:\n\n```bibtex\n@inproceedings{jia2023epwshiftr,\n  title = {Epwshiftr: Incorporating Open Data of Climate Change Prediction into Building Performance Simulation for Future Adaptation and Mitigation},\n  shorttitle = {Epwshiftr},\n  booktitle = {Proceedings of {{Building Simulation}} 2023: 18th {{Conference}} of {{IBPSA}}},\n  author = {Jia, Hongyuan and Chong, Adrian and Ning, Baisong},\n  year = {2023},\n  series = {Building {{Simulation}}},\n  volume = {18},\n  pages = {3201--3207},\n  publisher = {{IBPSA}},\n  address = {{Shanghai, China}},\n  doi = {10.26868/25222708.2023.1612}\n}\n```\n\n\u003c!-- TOC GFM --\u003e\n\n* [Installation](#installation)\n* [Get started](#get-started)\n    * [Build CMIP6 output file index](#build-cmip6-output-file-index)\n    * [Manage CMIP6 output files](#download-cmip6-output-files)\n    * [Extract CMIP6 output data](#extract-cmip6-output-data)\n    * [Morphing EPW weather variables](#morphing-epw-weather-variables)\n    * [Create future EPW files](#create-future-epw-files)\n* [Author](#author)\n* [License](#license)\n* [Contribute](#contribute)\n\n\u003c!-- /TOC --\u003e\n\n## Installation\n\nYou can install the latest stable release of epwshiftr from\n[CRAN](https://CRAN.R-project.org).\n\n```{r cran-install, eval = FALSE}\ninstall.packages(\"epwshiftr\")\n```\n\nAlternatively, you can install the development version from GitHub.\n\n```{r gh-install, eval = FALSE}\ninstall.packages(\"epwshiftr\",\n    repos = c(\n        ideaslab = \"https://ideas-lab-nus.r-universe.dev\",\n        cran     = \"https://cran.r-project.org\"\n    )\n)\n```\n\n## Get started\n\n### Build CMIP6 output file index\n\n* The first step is to build CMIP6 experiment output file index based on queries\n  using ESGF search RESTful API\n\n```{r index}\n# set directory to store files\noptions(epwshiftr.dir = tempdir())\noptions(epwshiftr.verbose = TRUE)\n\n# get CMIP6 data nodes\n(nodes \u003c- get_data_node())\n\n# create a CMIP6 output file index\nidx \u003c- init_cmip6_index(\n    # only consider ScenarioMIP activity\n    activity = \"ScenarioMIP\",\n\n    # specify dry-bulb temperature and relative humidity\n    variable = c(\"tas\", \"hurs\"),\n\n    # specify report frequent\n    frequency = \"day\",\n\n    # specify experiment name\n    experiment = c(\"ssp585\"),\n\n    # specify GCM name\n    source = \"AWI-CM-1-1-MR\",\n\n    # specify variant,\n    variant = \"r1i1p1f1\",\n\n    # specify years of interest\n    years = c(2050, 2080),\n\n    # save to data dictionary\n    save = TRUE\n)\n\n# the index has been automatically saved into directory specified using\n# `epwshiftr.dir` option and can be reloaded\nidx \u003c- load_cmip6_index()\n\nstr(head(idx))\n```\n\n### Manage CMIP6 output files\n\n* You have to download CMIP6 output file by yourself using your preferable\n  methods or tools. The download url can be found in the `file_url` column in\n  the index.\n\n* After you have downloaded CMIP6 output files of interest, you can use\n  `suumary_database()` to get a summary on files downloaded against the CMIP6\n  output file index.\n\n* This step is necessary as it map the loaded files against index so that\n  epwshiftr knows which case is complete and can be used for the next step.\n\n```{r database}\n# Summary downloaded file by GCM and variable, use the latest downloaded file if\n# multiple matches are detected and save matched information into the index file\nsm \u003c- summary_database(tempdir(), by = c(\"source\", \"variable\"), mult = \"latest\", update = TRUE)\n\nknitr::kable(sm)\n```\n\n### Extract CMIP6 output data\n\n* With previous step, now we can match coordinates of an EPW in the CMIP6 output\n  file\n\n```{r coord}\nepw \u003c- file.path(eplusr::eplus_config(8.8)$dir, \"WeatherData/USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw\")\n# match any coordinates with absolute distance less than 1 degree\ncoord \u003c- match_coord(epw, threshold = list(lon = 1, lat = 1), max_num = 1)\n\nclass(coord)\n\nnames(coord)\n\ncoord$meta\n\ncoord$coord[, .(file_path, coord)]\n\nstr(coord$coord$coord[[1]])\n```\n\n* Once we get the matched coordinates, we can extract corresponding data related\n  to input EPW file using `extract_data()`\n\n```{r data}\ndata \u003c- extract_data(coord, years = c(2050, 2080))\n\nclass(data)\nnames(data)\nknitr::kable(head(data$data))\n```\n\n### Morphing EPW weather variables\n\n* With all necessary information extracted above, now we can perform morphing on\n  out EPW\n\n```{r morph}\nmorphed \u003c- morphing_epw(data)\n\nclass(morphed)\n\nnames(morphed)\n\nknitr::kable(head(morphed$tdb))\n\nknitr::kable(head(morphed$rh))\n```\n\n### Create future EPW files\n\n* Once we get the morphed data using `morphing_epw()`, we can now create future\n  EPW files using `future_epw()`\n\n```{r epw}\n# create future EPWs grouped by GCM, experiment ID, interval (year)\nepws \u003c- future_epw(morphed, by = c(\"source\", \"experiment\", \"interval\"),\n    dir = tempdir(), separate = TRUE, overwrite = TRUE\n)\n\nepws\n\nsapply(epws, function (epw) epw$path())\n```\n\n## Author\n\nHongyuan Jia and Adrian Chong\n\n## License\n\n* **epwshiftr**\n\n  epwshiftr is released under the terms of MIT License.\n\n  Copyright © 2019-2024 Hongyuan Jia and Adrian Chong\n\n* **CMIP6 data**\n\n  \u003e To enable modeling groups and others who support CMIP6 to demonstrate its\n  \u003e impact (and secure ongoing funding), you are required to cite and\n  \u003e acknowledge those who have made CMIP6 possible. You also must abide by any\n  \u003e licensing restrictions, which are recorded in each file as a global\n  \u003e attribute (named “license”).\n  \u003e\n  \u003e Please carefully read and adhere to the [CMIP6 Terms of Use](https://pcmdi.llnl.gov/CMIP6/TermsOfUse/).\n\n## Disclaimer\n\nCMIP6 model data is licensed under a [Creative Commons Attribution-ShareAlike\n4.0 International License](https://creativecommons.org/licenses/).\nConsult [Terms of Use](https://pcmdi.llnl.gov/CMIP6/TermsOfUse/) for terms of use\ngoverning CMIP6 output, including citation requirements and proper\nacknowledgment. Further information about each GCM output data, including some\nlimitations, can be found via the `further_info_url` (recorded as a **global\nattribute** in the NetCDF file) and at [EC-Earth](https://ec-earth.org/). The\ndata producers and data providers make no warranty, either express or implied,\nincluding, but not limited to, warranties of merchantability and fitness for a\nparticular purpose. All liabilities arising from the supply of the information\n(including any liability arising in negligence) are excluded to the fullest\nextent permitted by law.\n\n## Contribute\n\nIf you encounter a clear bug or have questions about the usage, please file an\nissue with a minimal reproducible example on\n[GitHub](https://github.com/ideas-lab-nus/epwshiftr/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)\nIf you have a solution for an existing bug or an implementation for a missing\nfeature, please send a pull request and let us review.\n\n------------------------------------------------------------------------\n\nPlease note that the 'epwshiftr' project is released with a\n[Contributor Code of Conduct](https://github.com/ideas-lab-nus/epwshiftr/blob/master/.github/CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fideas-lab-nus%2Fepwshiftr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fideas-lab-nus%2Fepwshiftr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fideas-lab-nus%2Fepwshiftr/lists"}