From fdc979d5ce246ef936ec318a868cdcbe564775ef Mon Sep 17 00:00:00 2001 From: Hongyuan Jia Date: Mon, 10 Aug 2020 09:34:38 +0800 Subject: [PATCH] [fix] Auto-detect order of NetCDF dimensions (#6) * [fix] Automatically detect dimensions of NetCDF files * [fix] Make sure 'summary_database()' works when no matched found * [docs] Update NEWS --- NEWS.md | 4 + R/netcdf.R | 60 +++++---- README.Rmd | 39 +++--- README.md | 347 +++++++++++++++++++++++++---------------------------- 4 files changed, 226 insertions(+), 224 deletions(-) diff --git a/NEWS.md b/NEWS.md index 72b122b..ba6b3f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,11 @@ # epwshiftr 0.1.1 +## Bug fixes + * `esgf_query()` will give an informative message when LLNL ESGF node is not available (#3). +* `extract_data()` will automatically detect input NetCDF dimensions (#6). +* `summary_database()` now will proceed when no matched found (#6). # epwshiftr 0.1.0 diff --git a/R/netcdf.R b/R/netcdf.R index 0ca168b..6248c20 100644 --- a/R/netcdf.R +++ b/R/netcdf.R @@ -188,12 +188,16 @@ summary_database <- function ( # c) calculate the overlapped percentages coverred datetime of input # file to index data set(idx_m, NULL, "index_match", seq_len(nrow(idx_m))) - idx_m[, by = c("index_match"), - overlap := { - diff <- as.numeric(difftime(i.datetime_end, i.datetime_start, units = "days")) - sq <- seq(datetime_start, datetime_end, by = "1 day") - sum(sq >= i.datetime_start & sq <= i.datetime_end) / diff - }] + if (!nrow(idx_m)) { + set(idx_m, NULL, "overlap", double()) + } else { + idx_m[, by = c("index_match"), + overlap := { + diff <- as.numeric(difftime(i.datetime_end, i.datetime_start, units = "days")) + sq <- seq(datetime_start, datetime_end, by = "1 day") + sum(sq >= i.datetime_start & sq <= i.datetime_end) / diff + }] + } # d) only keep items that have overlapped percentages larger than 60% idx_m <- idx_m[overlap >= 0.6] @@ -342,6 +346,29 @@ get_nc_data <- function (x, lats, lons, years, unit = TRUE) { dims[J("lon"), on = "name", `:=`(value = list(which_lon))] dims[J("lat"), on = "name", `:=`(value = list(which_lat))] + # find correct dimentions + ord <- list( + c("lon", "lat", "time"), + c("lat", "lon", "time"), + c("time", "lon", "lat"), + c("lat", "time", "lon"), + c("lon", "time", "lat"), + c("time", "lat", "lon") + ) + ord <- ord[vapply(ord, function (i) { + d <- dims[J(i), on = "name"]$length + !is.null(tryCatch(RNetCDF::var.get.nc(nc, var, d, rep(1L, 3), collapse = FALSE), + error = function (e) { + if (grepl("exceeds dimension bound", conditionMessage(e), fixed = TRUE)) { + NULL + } else { + signalCondition(e) + } + } + )) + }, logical(1))][[1L]] + dims <- dims[J(ord), on = "name"] + dt <- rbindlist(use.names = TRUE, lapply(seq_along(which_time), function (i) { if (!length(which_time[[i]])) { return(data.table( @@ -357,29 +384,12 @@ get_nc_data <- function (x, lats, lons, years, unit = TRUE) { # Thus, the order of the dimensions according to the CDL conventions # (e.g., time, latitude, longitude) is reversed in the R array (e.g., # longitude, latitude, time). - dt <- tryCatch(as.data.table(RNetCDF::var.get.nc(nc, var, + dt <- as.data.table(RNetCDF::var.get.nc(nc, var, c(min(dims$value[[1L]]), min(dims$value[[2L]]), min(dims$value[[3L]])), c(length(dims$value[[1L]]), length(dims$value[[2L]]), length(dims$value[[3L]])), - collapse = FALSE)), - error = function (e) { - if (grepl("exceeds dimension bound", conditionMessage(e), fixed = TRUE)) { - NULL - } else { - signalCondition(e) - } - } + collapse = FALSE) ) - # in case permutation did not work - if (is.null(dt)) { - dims <- dims[c(3L, 2L, 1L)][, id := .I] - dt <- as.data.table(RNetCDF::var.get.nc(nc, var, - c(min(dims$value[[1L]]), min(dims$value[[2L]]), min(dims$value[[3L]])), - c(length(dims$value[[1L]]), length(dims$value[[2L]]), length(dims$value[[3L]])), - collapse = FALSE - )) - } - setnames(dt, c(dims$name, "value")) setnames(dt, "time", "datetime") diff --git a/README.Rmd b/README.Rmd index 5fa7ebd..614f8d0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -15,18 +15,18 @@ knitr::opts_chunk$set( library(epwshiftr) # copy files in advance -f <- c("tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490101-20491231.nc", - "tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500101-20501231.nc", - "tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510101-20511231.nc", - "hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490101-20491231.nc", - "hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500101-20501231.nc", - "hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510101-20511231.nc", - "tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790101-20791231.nc", - "tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800101-20801231.nc", - "tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810101-20811231.nc", - "hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790101-20791231.nc", - "hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800101-20801231.nc", - "hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810101-20811231.nc" +f <- c("tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20490101-20491231.nc", + "tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20500101-20501231.nc", + "tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20510101-20511231.nc", + "hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20490101-20491231.nc", + "hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20500101-20501231.nc", + "hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20510101-20511231.nc", + "tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20790101-20791231.nc", + "tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20800101-20801231.nc", + "tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20810101-20811231.nc", + "hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20790101-20791231.nc", + "hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20800101-20801231.nc", + "hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20810101-20811231.nc" ) file.copy(file.path("/mnt/d/ScenarioMIP", f), tempdir()) ``` @@ -103,13 +103,16 @@ idx <- init_cmip6_index( experiment = c("ssp585"), # specify GCM name - source = "EC-Earth3", + source = "AWI-CM-1-1-MR", - # only consider data nodes that are current working - data_node = nodes[status == "UP", data_node], + # specify variant, + variant = "r1i1p1f1", # specify years of interest - years = c(2050, 2080) + years = c(2050, 2080), + + # save to data dictionary + save = TRUE ) # the index has been automatically saved into directory specified using @@ -196,8 +199,8 @@ knitr::kable(head(morphed$rh)) ```{r epw} # create future EPWs grouped by GCM, experiment ID, interval (year) -epws <- future_epw(morphed, by = c("source_id", "experiment_id", "interval"), - dir = tempdir(), separate = TRUE +epws <- future_epw(morphed, by = c("source", "experiment", "interval"), + dir = tempdir(), separate = TRUE, overwrite = TRUE ) epws diff --git a/README.md b/README.md index e120fe9..9715af5 100644 --- a/README.md +++ b/README.md @@ -65,54 +65,58 @@ options(epwshiftr.verbose = TRUE) # get CMIP6 data nodes (nodes <- get_data_node()) -#> data_node status -#> 1: aims3.llnl.gov UP -#> 2: cmip.bcc.cma.cn UP -#> 3: cmip.dess.tsinghua.edu.cn UP -#> 4: cmip.fio.org.cn UP -#> 5: cordexesg.dmi.dk UP -#> 6: crd-esgf-drc.ec.gc.ca UP -#> 7: data.meteo.unican.es UP -#> 8: dataserver.nccs.nasa.gov UP -#> 9: dist.nmlab.snu.ac.kr UP -#> 10: esg-cccr.tropmet.res.in UP -#> 11: esg-dn1.nsc.liu.se UP -#> 12: esg-dn1.ru.ac.th UP -#> 13: esg-dn2.nsc.liu.se UP -#> 14: esg.camscma.cn UP -#> 15: esg.lasg.ac.cn UP -#> 16: esg.pik-potsdam.de UP -#> 17: esg1.umr-cnrm.fr UP -#> 18: esgf-cnr.hpc.cineca.it UP -#> 19: esgf-data.ucar.edu UP -#> 20: esgf-data1.ceda.ac.uk UP -#> 21: esgf-data1.llnl.gov UP -#> 22: esgf-data2.ceda.ac.uk UP -#> 23: esgf-data2.diasjp.net UP -#> 24: esgf-data3.ceda.ac.uk UP -#> 25: esgf-dev.bsc.es UP -#> 26: esgf-ictp.hpc.cineca.it UP -#> 27: esgf-node.cmcc.it UP -#> 28: esgf-node2.cmcc.it UP -#> 29: esgf.anl.gov UP -#> 30: esgf.apcc21.org UP -#> 31: esgf.bsc.es UP -#> 32: esgf.dwd.de UP -#> 33: esgf.ichec.ie UP -#> 34: esgf.nccs.nasa.gov UP -#> 35: esgf.nci.org.au UP -#> 36: esgf.rcec.sinica.edu.tw UP -#> 37: noresg.nird.sigma2.no UP -#> 38: vesg.ipsl.upmc.fr UP -#> 39: 145.100.59.180.surf-hosted.nl DOWN -#> 40: esgdata.gfdl.noaa.gov DOWN -#> 41: esgf-data1.diasjp.net DOWN -#> 42: esgf-nimscmip6.apcc21.org DOWN -#> 43: esgf1.dkrz.de DOWN -#> 44: esgf2.dkrz.de DOWN -#> 45: esgf3.dkrz.de DOWN -#> 46: gpm1.gesdisc.eosdis.nasa.gov DOWN -#> data_node status +#> data_node status +#> +#> 1: aims3.llnl.gov UP +#> 2: cmip.bcc.cma.cn UP +#> 3: cmip.dess.tsinghua.edu.cn UP +#> 4: cmip.fio.org.cn UP +#> 5: crd-esgf-drc.ec.gc.ca UP +#> 6: data.meteo.unican.es UP +#> 7: dataserver.nccs.nasa.gov UP +#> 8: dist.nmlab.snu.ac.kr UP +#> 9: dpesgf03.nccs.nasa.gov UP +#> 10: esg-cccr.tropmet.res.in UP +#> 11: esg-dn1.ru.ac.th UP +#> 12: esg-dn2.nsc.liu.se UP +#> 13: esg.camscma.cn UP +#> 14: esg.lasg.ac.cn UP +#> 15: esg.pik-potsdam.de UP +#> 16: esgf-data.ucar.edu UP +#> 17: esgf-data1.ceda.ac.uk UP +#> 18: esgf-data1.diasjp.net UP +#> 19: esgf-data1.llnl.gov UP +#> 20: esgf-data2.ceda.ac.uk UP +#> 21: esgf-data2.diasjp.net UP +#> 22: esgf-data2.llnl.gov UP +#> 23: esgf-data3.ceda.ac.uk UP +#> 24: esgf-data3.diasjp.net UP +#> 25: esgf-dev.bsc.es UP +#> 26: esgf-nimscmip6.apcc21.org UP +#> 27: esgf-node.cmcc.it UP +#> 28: esgf-node2.cmcc.it UP +#> 29: esgf.anl.gov UP +#> 30: esgf.apcc21.org UP +#> 31: esgf.dwd.de UP +#> 32: esgf.nci.org.au UP +#> 33: esgf.rcec.sinica.edu.tw UP +#> 34: esgf2.dkrz.de UP +#> 35: noresg.nird.sigma2.no UP +#> 36: vesg.ipsl.upmc.fr UP +#> 37: 145.100.59.180.surf-hosted.nl DOWN +#> 38: acdisc.gesdisc.eosdis.nasa.gov DOWN +#> 39: cordexesg.dmi.dk DOWN +#> 40: esg-dn1.nsc.liu.se DOWN +#> 41: esg1.umr-cnrm.fr DOWN +#> 42: esgdata.gfdl.noaa.gov DOWN +#> 43: esgf-cnr.hpc.cineca.it DOWN +#> 44: esgf-ictp.hpc.cineca.it DOWN +#> 45: esgf.bsc.es DOWN +#> 46: esgf.ichec.ie DOWN +#> 47: esgf1.dkrz.de DOWN +#> 48: esgf3.dkrz.de DOWN +#> 49: gpm1.gesdisc.eosdis.nasa.gov DOWN +#> data_node status # create a CMIP6 output file index idx <- init_cmip6_index( @@ -129,47 +133,51 @@ idx <- init_cmip6_index( experiment = c("ssp585"), # specify GCM name - source = "EC-Earth3", + source = "AWI-CM-1-1-MR", - # only consider data nodes that are current working - data_node = nodes[status == "UP", data_node], + # specify variant, + variant = "r1i1p1f1", # specify years of interest - years = c(2050, 2080) + years = c(2050, 2080), + + # save to data dictionary + save = TRUE ) #> Querying CMIP6 Dataset Information #> Querying CMIP6 File Information [Attempt 1] #> Checking if data is complete -#> Data file index saved to '/tmp/Rtmp7yrkZW/cmip6_index.csv' +#> Data file index saved to '/tmp/RtmpDtbJVc/cmip6_index.csv' # the index has been automatically saved into directory specified using # `epwshiftr.dir` option and can be reloaded idx <- load_cmip6_index() str(head(idx)) -#> Classes 'data.table' and 'data.frame': 6 obs. of 22 variables: -#> $ file_id : chr "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.tas.gr.v20200203.tas_day_EC-Earth3_ssp585_r"| __truncated__ "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.tas.gr.v20200203.tas_day_EC-Earth3_ssp585_r"| __truncated__ "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.tas.gr.v20200203.tas_day_EC-Earth3_ssp585_r"| __truncated__ "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.hurs.gr.v20200203.hurs_day_EC-Earth3_ssp585"| __truncated__ ... -#> $ dataset_id : chr "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.tas.gr.v20200203|esg-dn2.nsc.liu.se" "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.tas.gr.v20200203|esg-dn2.nsc.liu.se" "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.tas.gr.v20200203|esg-dn2.nsc.liu.se" "CMIP6.ScenarioMIP.EC-Earth-Consortium.EC-Earth3.ssp585.r1i1p1f1.day.hurs.gr.v20200203|esg-dn2.nsc.liu.se" ... +#> Classes 'data.table' and 'data.frame': 6 obs. of 23 variables: +#> $ file_id : chr "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.hurs.gn.v20190529.hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f"| __truncated__ "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.hurs.gn.v20190529.hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f"| __truncated__ "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.hurs.gn.v20190529.hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f"| __truncated__ "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.tas.gn.v20190529.tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_"| __truncated__ ... +#> $ dataset_id : chr "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.hurs.gn.v20190529|esgf3.dkrz.de" "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.hurs.gn.v20190529|esgf3.dkrz.de" "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.hurs.gn.v20190529|esgf3.dkrz.de" "CMIP6.ScenarioMIP.AWI.AWI-CM-1-1-MR.ssp585.r1i1p1f1.day.tas.gn.v20190529|esgf3.dkrz.de" ... #> $ mip_era : chr "CMIP6" "CMIP6" "CMIP6" "CMIP6" ... #> $ activity_drs : chr "ScenarioMIP" "ScenarioMIP" "ScenarioMIP" "ScenarioMIP" ... -#> $ institution_id : chr "EC-Earth-Consortium" "EC-Earth-Consortium" "EC-Earth-Consortium" "EC-Earth-Consortium" ... -#> $ source_id : chr "EC-Earth3" "EC-Earth3" "EC-Earth3" "EC-Earth3" ... +#> $ institution_id : chr "AWI" "AWI" "AWI" "AWI" ... +#> $ source_id : chr "AWI-CM-1-1-MR" "AWI-CM-1-1-MR" "AWI-CM-1-1-MR" "AWI-CM-1-1-MR" ... #> $ experiment_id : chr "ssp585" "ssp585" "ssp585" "ssp585" ... #> $ member_id : chr "r1i1p1f1" "r1i1p1f1" "r1i1p1f1" "r1i1p1f1" ... #> $ table_id : chr "day" "day" "day" "day" ... -#> $ grid_label : chr "gr" "gr" "gr" "gr" ... -#> $ version : chr "20200203" "20200203" "20200203" "20200203" ... +#> $ frequency : chr "day" "day" "day" "day" ... +#> $ grid_label : chr "gn" "gn" "gn" "gn" ... +#> $ version : chr "20190529" "20190529" "20190529" "20190529" ... #> $ nominal_resolution: chr "100 km" "100 km" "100 km" "100 km" ... -#> $ variable_id : chr "tas" "tas" "tas" "hurs" ... -#> $ variable_long_name: chr "Near-Surface Air Temperature" "Near-Surface Air Temperature" "Near-Surface Air Temperature" "Near-Surface Relative Humidity" ... -#> $ variable_units : chr "K" "K" "K" "%" ... +#> $ variable_id : chr "hurs" "hurs" "hurs" "tas" ... +#> $ variable_long_name: chr "Near-Surface Relative Humidity" "Near-Surface Relative Humidity" "Near-Surface Relative Humidity" "Near-Surface Air Temperature" ... +#> $ variable_units : chr "%" "%" "%" "K" ... #> $ datetime_start : POSIXct, format: "2049-01-01" "2050-01-01" ... #> $ datetime_end : POSIXct, format: "2049-12-31" "2050-12-31" ... -#> $ file_size : int 140957772 141308277 141157930 161752607 161748507 161673372 -#> $ data_node : chr "esg-dn2.nsc.liu.se" "esg-dn2.nsc.liu.se" "esg-dn2.nsc.liu.se" "esg-dn2.nsc.liu.se" ... -#> $ file_url : chr "http://esg-dn2.nsc.liu.se/thredds/fileServer/esg_dataroot1/cmip6data/CMIP6/ScenarioMIP/EC-Earth-Consortium/EC-E"| __truncated__ "http://esg-dn2.nsc.liu.se/thredds/fileServer/esg_dataroot1/cmip6data/CMIP6/ScenarioMIP/EC-Earth-Consortium/EC-E"| __truncated__ "http://esg-dn2.nsc.liu.se/thredds/fileServer/esg_dataroot1/cmip6data/CMIP6/ScenarioMIP/EC-Earth-Consortium/EC-E"| __truncated__ "http://esg-dn2.nsc.liu.se/thredds/fileServer/esg_dataroot1/cmip6data/CMIP6/ScenarioMIP/EC-Earth-Consortium/EC-E"| __truncated__ ... -#> $ dataset_pid : chr "hdl:21.14100/d7ffe204-df79-308c-86e6-2b7466a11f9b" "hdl:21.14100/d7ffe204-df79-308c-86e6-2b7466a11f9b" "hdl:21.14100/d7ffe204-df79-308c-86e6-2b7466a11f9b" "hdl:21.14100/7cdf1215-c964-3a06-8ad7-913101e3278b" ... -#> $ tracking_id : chr "hdl:21.14100/b7bbbb87-e3d6-4b0a-90e9-4a747a85df61" "hdl:21.14100/1e8651dc-f3d4-4761-94e0-4fb4227dcf09" "hdl:21.14100/47d24c86-b410-40d0-9d2d-42d7da09434d" "hdl:21.14100/e25ab7e8-5608-4823-ab41-a556f646d7f5" ... +#> $ file_size : int 91761231 91729347 91727399 82292505 82268546 82149654 +#> $ data_node : chr "esgf3.dkrz.de" "esgf3.dkrz.de" "esgf3.dkrz.de" "esgf3.dkrz.de" ... +#> $ file_url : chr "http://esgf3.dkrz.de/thredds/fileServer/cmip6/ScenarioMIP/AWI/AWI-CM-1-1-MR/ssp585/r1i1p1f1/day/hurs/gn/v201905"| __truncated__ "http://esgf3.dkrz.de/thredds/fileServer/cmip6/ScenarioMIP/AWI/AWI-CM-1-1-MR/ssp585/r1i1p1f1/day/hurs/gn/v201905"| __truncated__ "http://esgf3.dkrz.de/thredds/fileServer/cmip6/ScenarioMIP/AWI/AWI-CM-1-1-MR/ssp585/r1i1p1f1/day/hurs/gn/v201905"| __truncated__ "http://esgf3.dkrz.de/thredds/fileServer/cmip6/ScenarioMIP/AWI/AWI-CM-1-1-MR/ssp585/r1i1p1f1/day/tas/gn/v2019052"| __truncated__ ... +#> $ dataset_pid : chr "hdl:21.14100/89501ae0-2fec-307b-bf68-552ea4d504a0" "hdl:21.14100/89501ae0-2fec-307b-bf68-552ea4d504a0" "hdl:21.14100/89501ae0-2fec-307b-bf68-552ea4d504a0" "hdl:21.14100/a336f13f-a4d3-3b57-a45a-8f27f0ba01b8" ... +#> $ tracking_id : chr "hdl:21.14100/f46077ee-ae81-4932-81af-d61394446ea3" "hdl:21.14100/a476933a-0f14-4d4c-b62d-0bf08e3471fd" "hdl:21.14100/3c3c98f8-d56e-4d8d-8ba7-1a9e541e6018" "hdl:21.14100/8503efb4-6509-4728-b95c-7203bd214a77" ... #> - attr(*, ".internal.selfref")= ``` @@ -193,40 +201,16 @@ str(head(idx)) # Summary downloaded file by GCM and variable, use the latest downloaded file if # multiple matches are detected and save matched information into the index file sm <- summary_database(tempdir(), by = c("source", "variable"), mult = "latest", update = TRUE) -#> 12 NetCDF files found. -#> Processing file /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490101-20491231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500101-20501231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510101-20511231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790101-20791231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800101-20801231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810101-20811231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_204901... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490101-20491231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_205001... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500101-20501231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_205101... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510101-20511231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_207901... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790101-20791231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_208001... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800101-20801231.nc'... -#> Processing file /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_208101... -#> Parsing meta data of NetCDF file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810101-20811231.nc'... -#> Data file index updated and saved to '/tmp/Rtmp7yrkZW/cmip6_index.csv' +#> 24 NetCDF files found. +#> Data file index updated and saved to '/tmp/RtmpDtbJVc/cmip6_index.csv' knitr::kable(sm) ``` -| variable\_id | source\_id | datetime\_start | datetime\_end | file\_num | file\_size | dl\_num | dl\_percent | dl\_size | -| :----------- | :--------- | :------------------ | :------------------ | --------: | -------------: | ------: | ----------: | -------------: | -| tas | EC-Earth3 | 2049-01-01 12:00:00 | 2081-12-31 12:00:00 | 6 | 846 \[Mbytes\] | 6 | 100 \[%\] | 846 \[Mbytes\] | -| hurs | EC-Earth3 | 2049-01-01 12:00:00 | 2081-12-31 12:00:00 | 6 | 971 \[Mbytes\] | 6 | 100 \[%\] | 971 \[Mbytes\] | +| variable\_id | source\_id | datetime\_start | datetime\_end | file\_num | file\_size | dl\_num | dl\_percent | dl\_size | +| :----------- | :------------ | :------------------ | :------------------ | --------: | -------------: | ------: | ----------: | -------------: | +| hurs | AWI-CM-1-1-MR | 2049-01-01 12:00:00 | 2081-12-31 12:00:00 | 6 | 551 \[Mbytes\] | 6 | 100 \[%\] | 548 \[Mbytes\] | +| tas | AWI-CM-1-1-MR | 2049-01-01 12:00:00 | 2081-12-31 12:00:00 | 6 | 493 \[Mbytes\] | 6 | 100 \[%\] | 484 \[Mbytes\] | ### Extract CMIP6 output data @@ -240,18 +224,6 @@ epw <- file.path(eplusr::eplus_config(8.8)$dir, "WeatherData/USA_CA_San.Francisc # match any coordinates with absolute distance less than 1 degree coord <- match_coord(epw, threshold = list(lon = 1, lat = 1), max_num = 1) #> Start to match coordinates... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2049... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2050... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2051... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2079... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2080... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2081... class(coord) #> [1] "epw_cmip6_coord" @@ -276,20 +248,22 @@ coord$meta #> [1] -122.4 coord$coord[, .(file_path, coord)] -#> file_path -#> 1: /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490101-20491231.nc -#> 2: /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500101-20501231.nc -#> 3: /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510101-20511231.nc -#> 4: /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490101-20491231.nc -#> 5: /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500101-20501231.nc -#> 6: /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510101-20511231.nc -#> 7: /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790101-20791231.nc -#> 8: /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800101-20801231.nc -#> 9: /tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810101-20811231.nc -#> 10: /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790101-20791231.nc -#> 11: /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800101-20801231.nc -#> 12: /tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810101-20811231.nc +#> file_path +#> +#> 1: /tmp/RtmpDtbJVc/hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20490101-20491231.nc +#> 2: /tmp/RtmpDtbJVc/hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20500101-20501231.nc +#> 3: /tmp/RtmpDtbJVc/hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20510101-20511231.nc +#> 4: /tmp/RtmpDtbJVc/tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20490101-20491231.nc +#> 5: /tmp/RtmpDtbJVc/tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20500101-20501231.nc +#> 6: /tmp/RtmpDtbJVc/tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20510101-20511231.nc +#> 7: /tmp/RtmpDtbJVc/hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20790101-20791231.nc +#> 8: /tmp/RtmpDtbJVc/hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20800101-20801231.nc +#> 9: /tmp/RtmpDtbJVc/hurs_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20810101-20811231.nc +#> 10: /tmp/RtmpDtbJVc/tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20790101-20791231.nc +#> 11: /tmp/RtmpDtbJVc/tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20800101-20801231.nc +#> 12: /tmp/RtmpDtbJVc/tas_day_AWI-CM-1-1-MR_ssp585_r1i1p1f1_gn_20810101-20811231.nc #> coord +#> #> 1: #> 2: #> 3: @@ -307,14 +281,14 @@ str(coord$coord$coord[[1]]) #> List of 2 #> $ lat:List of 4 #> ..$ index: int 1 -#> ..$ value: num 36.8 -#> ..$ dis : num -0.778 -#> ..$ which: int 181 +#> ..$ value: num 36.9 +#> ..$ dis : num -0.685 +#> ..$ which: int 136 #> $ lon:List of 4 #> ..$ index: int 1 #> ..$ value: num 302 -#> ..$ dis : num -0.759 -#> ..$ which: int 430 +#> ..$ dis : num -0.525 +#> ..$ which: int 323 ``` - Once we get the matched coordinates, we can extract corresponding @@ -325,18 +299,6 @@ str(coord$coord$coord[[1]]) ``` r data <- extract_data(coord, years = c(2050, 2080)) #> Start to extract CMIP6 data according to matched coordinates... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20490... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20500... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20510... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2049... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2050... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2051... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20790... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20800... -#> Processing file '/tmp/Rtmp7yrkZW/tas_day_EC-Earth3_ssp585_r1i1p1f1_gr_20810... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2079... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2080... -#> Processing file '/tmp/Rtmp7yrkZW/hurs_day_EC-Earth3_ssp585_r1i1p1f1_gr_2081... class(data) #> [1] "epw_cmip6_data" @@ -345,14 +307,14 @@ names(data) knitr::kable(head(data$data)) ``` -| activity\_drs | institution\_id | source\_id | experiment\_id | member\_id | table\_id | datetime | lat | lon | variable | description | units | value | -| :------------ | :------------------ | :--------- | :------------- | :--------- | :-------: | :------------------ | -------: | -------: | :------- | :--------------------------- | :---- | -------: | -| ScenarioMIP | EC-Earth-Consortium | EC-Earth3 | ssp585 | r1i1p1f1 | day | 2050-01-01 20:00:00 | 36.84202 | 301.6406 | tas | Near-Surface Air Temperature | K | 292.4459 | -| ScenarioMIP | EC-Earth-Consortium | EC-Earth3 | ssp585 | r1i1p1f1 | day | 2050-01-02 20:00:00 | 36.84202 | 301.6406 | tas | Near-Surface Air Temperature | K | 289.5120 | -| ScenarioMIP | EC-Earth-Consortium | EC-Earth3 | ssp585 | r1i1p1f1 | day | 2050-01-03 20:00:00 | 36.84202 | 301.6406 | tas | Near-Surface Air Temperature | K | 286.8790 | -| ScenarioMIP | EC-Earth-Consortium | EC-Earth3 | ssp585 | r1i1p1f1 | day | 2050-01-04 20:00:00 | 36.84202 | 301.6406 | tas | Near-Surface Air Temperature | K | 290.4449 | -| ScenarioMIP | EC-Earth-Consortium | EC-Earth3 | ssp585 | r1i1p1f1 | day | 2050-01-05 20:00:00 | 36.84202 | 301.6406 | tas | Near-Surface Air Temperature | K | 288.8000 | -| ScenarioMIP | EC-Earth-Consortium | EC-Earth3 | ssp585 | r1i1p1f1 | day | 2050-01-06 20:00:00 | 36.84202 | 301.6406 | tas | Near-Surface Air Temperature | K | 288.6677 | +| activity\_drs | institution\_id | source\_id | experiment\_id | member\_id | table\_id | datetime | lat | lon | variable | description | units | value | +| :------------ | :-------------- | :------------ | :------------- | :--------- | :-------- | :------------------ | -------: | ------: | :------- | :----------------------------- | :---- | -------: | +| ScenarioMIP | AWI | AWI-CM-1-1-MR | ssp585 | r1i1p1f1 | day | 2050-01-01 20:00:00 | 36.93492 | 301.875 | hurs | Near-Surface Relative Humidity | % | 57.04578 | +| ScenarioMIP | AWI | AWI-CM-1-1-MR | ssp585 | r1i1p1f1 | day | 2050-01-02 20:00:00 | 36.93492 | 301.875 | hurs | Near-Surface Relative Humidity | % | 66.95392 | +| ScenarioMIP | AWI | AWI-CM-1-1-MR | ssp585 | r1i1p1f1 | day | 2050-01-03 20:00:00 | 36.93492 | 301.875 | hurs | Near-Surface Relative Humidity | % | 71.37276 | +| ScenarioMIP | AWI | AWI-CM-1-1-MR | ssp585 | r1i1p1f1 | day | 2050-01-04 20:00:00 | 36.93492 | 301.875 | hurs | Near-Surface Relative Humidity | % | 82.09089 | +| ScenarioMIP | AWI | AWI-CM-1-1-MR | ssp585 | r1i1p1f1 | day | 2050-01-05 20:00:00 | 36.93492 | 301.875 | hurs | Near-Surface Relative Humidity | % | 65.37158 | +| ScenarioMIP | AWI | AWI-CM-1-1-MR | ssp585 | r1i1p1f1 | day | 2050-01-06 20:00:00 | 36.93492 | 301.875 | hurs | Near-Surface Relative Humidity | % | 78.18507 | ### Morphing EPW weather variables @@ -367,47 +329,55 @@ morphed <- morphing_epw(data) #> Morphing 'relative humidity'... #> Morphing 'dew point temperature'... #> Morphing 'atmospheric pressure'... +#> WARNING: Input does not contain any data of 'sea level pressure'. Skip. #> Morphing 'horizontal infrared radiation from the sky'... +#> WARNING: Input does not contain any data of 'surface downwelling longware radiation'. Skip. #> Morphing 'global horizontal radiation'... +#> WARNING: Input does not contain any data of 'surface downwelling shortware radiation'. Skip. #> Morphing 'diffuse horizontal radiation'... +#> WARNING: Input does not contain any data of 'surface downwelling shortware radiation'. Skip. #> Morphing 'direct normal radiation'... +#> WARNING: Input does not contain any data of 'surface downwelling shortware radiation'. Skip. #> Morphing 'wind speed'... +#> WARNING: Input does not contain any data of 'near-surface wind speed'. Skip. #> Morphing 'total sky cover'... +#> WARNING: Input does not contain any data of 'total cloud area fraction for the whole atmospheric column'. Skip. #> Morphing 'opaque sky cover'... +#> WARNING: Input does not contain any data of 'total cloud area fraction for the whole atmospheric column'. Skip. class(morphed) #> [1] "epw_cmip6_morphed" names(morphed) -#> [1] "epw" "tdb" "tdew" "rh" "p" -#> [6] "hor_ir" "glob_rad" "norm_rad" "diff_rad" "wind" -#> [11] "total_cover" "opaque_cover" +#> [1] "epw" "tdb" "tdew" "rh" +#> [5] "p" "hor_ir" "glob_rad" "norm_rad" +#> [9] "diff_rad" "wind" "total_cover" "opaque_cover" knitr::kable(head(morphed$tdb)) ``` -| activity\_drs | experiment\_id | institution\_id | source\_id | member\_id | table\_id | lon | lat | interval | datetime | year | month | day | hour | minute | dry\_bulb\_temperature | delta | alpha | -| :------------ | :------------- | :------------------ | :--------- | :--------- | :-------: | -------: | -------: | :------- | :------------------ | ---: | ----: | --: | ---: | -----: | ---------------------: | ------: | -------: | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 01:00:00 | 1999 | 1 | 1 | 1 | 0 | 13.050994 | 7.80078 | 1.812638 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 02:00:00 | 1999 | 1 | 1 | 2 | 0 | 13.050994 | 7.80078 | 1.812638 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 03:00:00 | 1999 | 1 | 1 | 3 | 0 | 12.144675 | 7.80078 | 1.812638 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 04:00:00 | 1999 | 1 | 1 | 4 | 0 | 11.057093 | 7.80078 | 1.812638 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 05:00:00 | 1999 | 1 | 1 | 5 | 0 | 7.975608 | 7.80078 | 1.812638 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 06:00:00 | 1999 | 1 | 1 | 6 | 0 | 7.975608 | 7.80078 | 1.812638 | +| activity\_drs | experiment\_id | institution\_id | source\_id | member\_id | table\_id | lon | lat | interval | datetime | year | month | day | hour | minute | dry\_bulb\_temperature | delta | alpha | +| :------------ | :------------- | :-------------- | :------------ | :--------- | :-------- | ------: | -------: | :------- | :------------------ | ---: | ----: | --: | ---: | -----: | ---------------------: | -------: | -------: | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 01:00:00 | 1999 | 1 | 1 | 1 | 0 | 13.056525 | 7.808153 | 1.813406 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 02:00:00 | 1999 | 1 | 1 | 2 | 0 | 13.056525 | 7.808153 | 1.813406 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 03:00:00 | 1999 | 1 | 1 | 3 | 0 | 12.149822 | 7.808153 | 1.813406 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 04:00:00 | 1999 | 1 | 1 | 4 | 0 | 11.061778 | 7.808153 | 1.813406 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 05:00:00 | 1999 | 1 | 1 | 5 | 0 | 7.978987 | 7.808153 | 1.813406 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 06:00:00 | 1999 | 1 | 1 | 6 | 0 | 7.978987 | 7.808153 | 1.813406 | ``` r knitr::kable(head(morphed$rh)) ``` -| activity\_drs | experiment\_id | institution\_id | source\_id | member\_id | table\_id | lon | lat | interval | datetime | year | month | day | hour | minute | relative\_humidity | delta | alpha | -| :------------ | :------------- | :------------------ | :--------- | :--------- | :-------: | -------: | -------: | :------- | :------------------ | ---: | ----: | --: | ---: | -----: | -----------------: | ---------: | --------: | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 01:00:00 | 1999 | 1 | 1 | 1 | 0 | 80.54769 | \-8.538842 | 0.8949743 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 02:00:00 | 1999 | 1 | 1 | 2 | 0 | 80.54769 | \-8.538842 | 0.8949743 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 03:00:00 | 1999 | 1 | 1 | 3 | 0 | 79.65271 | \-8.538842 | 0.8949743 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 04:00:00 | 1999 | 1 | 1 | 4 | 0 | 83.23261 | \-8.538842 | 0.8949743 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 05:00:00 | 1999 | 1 | 1 | 5 | 0 | 86.81251 | \-8.538842 | 0.8949743 | -| ScenarioMIP | ssp585 | EC-Earth-Consortium | EC-Earth3 | r1i1p1f1 | day | 301.6406 | 36.84202 | 2050 | 2017-01-01 06:00:00 | 1999 | 1 | 1 | 6 | 0 | 86.81251 | \-8.538842 | 0.8949743 | +| activity\_drs | experiment\_id | institution\_id | source\_id | member\_id | table\_id | lon | lat | interval | datetime | year | month | day | hour | minute | relative\_humidity | delta | alpha | +| :------------ | :------------- | :-------------- | :------------ | :--------- | :-------- | ------: | -------: | :------- | :------------------ | ---: | ----: | --: | ---: | -----: | -----------------: | ---------: | --------: | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 01:00:00 | 1999 | 1 | 1 | 1 | 0 | 75.94106 | \-12.70029 | 0.8437895 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 02:00:00 | 1999 | 1 | 1 | 2 | 0 | 75.94106 | \-12.70029 | 0.8437895 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 03:00:00 | 1999 | 1 | 1 | 3 | 0 | 75.09727 | \-12.70029 | 0.8437895 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 04:00:00 | 1999 | 1 | 1 | 4 | 0 | 78.47243 | \-12.70029 | 0.8437895 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 05:00:00 | 1999 | 1 | 1 | 5 | 0 | 81.84758 | \-12.70029 | 0.8437895 | +| ScenarioMIP | ssp585 | AWI | AWI-CM-1-1-MR | r1i1p1f1 | day | 301.875 | 36.93492 | 2050 | 2017-01-01 06:00:00 | 1999 | 1 | 1 | 6 | 0 | 81.84758 | \-12.70029 | 0.8437895 | ### Create future EPW files @@ -418,54 +388,69 @@ knitr::kable(head(morphed$rh)) ``` r # create future EPWs grouped by GCM, experiment ID, interval (year) -epws <- future_epw(morphed, by = c("source_id", "experiment_id", "interval"), - dir = tempdir(), separate = TRUE +epws <- future_epw(morphed, by = c("source", "experiment", "interval"), + dir = tempdir(), separate = TRUE, overwrite = TRUE ) -#> ── Info ──────────────────────────────────────────────────────────────────────── +#> Warning: Empty morphed data found for variables listed below. Original data from EPW will be used: +#> [1]: Atmospheric pressure +#> [2]: Horizontal infrared radiation intensity from sky +#> [3]: Global horizontal radiation +#> [4]: Direct normal radiation +#> [5]: Diffuse horizontal radiation +#> [6]: Wind speed +#> [7]: Total sky cover +#> [8]: Opaque sky cover +#> ── Info ────────────────────────────────────────────────────────────────── #> Data period #1 has been replaced with input data. +#> #> Name StartDayOfWeek StartDay EndDay #> 1: Data Sunday 1/ 1 12/31 -#> ── Info ──────────────────────────────────────────────────────────────────────── +#> ────────────────────────────────────────────────────────────────────────── +#> Replace the existing EPW file located at /tmp/RtmpDtbJVc/AWI-CM-1-1-MR/ssp585/2050/USA_CA_San.Francisco.Intl.AP.724940_TMY3.AWI-CM-1-1-MR.ssp585.2050.epw. +#> ── Info ────────────────────────────────────────────────────────────────── #> Data period #1 has been replaced with input data. +#> #> Name StartDayOfWeek StartDay EndDay #> 1: Data Sunday 1/ 1 12/31 +#> ────────────────────────────────────────────────────────────────────────── +#> Replace the existing EPW file located at /tmp/RtmpDtbJVc/AWI-CM-1-1-MR/ssp585/2080/USA_CA_San.Francisco.Intl.AP.724940_TMY3.AWI-CM-1-1-MR.ssp585.2080.epw. epws #> [[1]] -#> ══ EnergyPlus Weather File ═════════════════════════════════════════════════════ +#> ══ EnergyPlus Weather File ═══════════════════════════════════════════════ #> [Location ]: San Francisco Intl Ap, 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 +#> [Leap Year]: No #> [Interval ]: 60 mins #> -#> ── Data Periods ──────────────────────────────────────────────────────────────── +#> ── Data Periods ────────────────────────────────────────────────────────── #> Name StartDayOfWeek StartDay EndDay #> 1: Data Sunday 1/ 1 12/31 #> -#> ──────────────────────────────────────────────────────────────────────────────── +#> ────────────────────────────────────────────────────────────────────────── #> #> [[2]] -#> ══ EnergyPlus Weather File ═════════════════════════════════════════════════════ +#> ══ EnergyPlus Weather File ═══════════════════════════════════════════════ #> [Location ]: San Francisco Intl Ap, 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 +#> [Leap Year]: No #> [Interval ]: 60 mins #> -#> ── Data Periods ──────────────────────────────────────────────────────────────── +#> ── Data Periods ────────────────────────────────────────────────────────── #> Name StartDayOfWeek StartDay EndDay #> 1: Data Sunday 1/ 1 12/31 #> -#> ──────────────────────────────────────────────────────────────────────────────── +#> ────────────────────────────────────────────────────────────────────────── sapply(epws, function (epw) epw$path()) -#> [1] "/tmp/Rtmp7yrkZW/EC-Earth3/ssp585/2050/USA_CA_San.Francisco.Intl.AP.724940_TMY3.EC-Earth3.ssp585.2050.epw" -#> [2] "/tmp/Rtmp7yrkZW/EC-Earth3/ssp585/2080/USA_CA_San.Francisco.Intl.AP.724940_TMY3.EC-Earth3.ssp585.2080.epw" +#> [1] "/tmp/RtmpDtbJVc/AWI-CM-1-1-MR/ssp585/2050/USA_CA_San.Francisco.Intl.AP.724940_TMY3.AWI-CM-1-1-MR.ssp585.2050.epw" +#> [2] "/tmp/RtmpDtbJVc/AWI-CM-1-1-MR/ssp585/2080/USA_CA_San.Francisco.Intl.AP.724940_TMY3.AWI-CM-1-1-MR.ssp585.2080.epw" ``` ## Author