From 951a942a842c4a3e00c07ee2fad84ebb69c28b0a Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Fri, 20 Oct 2023 17:57:26 +0100 Subject: [PATCH] Add HYDE 3.3. database --- NEWS.md | 8 +- R/datasets_docs.R | 31 ++++++ R/download_dataset.R | 9 +- R/sysdata.rda | Bin 11101 -> 11895 bytes R/time_bp.R | 24 ++--- R/ybp2date.R | 4 +- data-raw/data_files/dataset_list_included.csv | 16 +++ .../format_climate_datasets/test_bio_vars.R | 100 ----------------- .../test_bio_vars_beyer.R | 92 ---------------- .../test_bio_vars_new_krapp.R | 101 ------------------ inst/WORDLIST | 5 + man/HYDE_3.3_baseline.Rd | 31 ++++++ 12 files changed, 100 insertions(+), 321 deletions(-) delete mode 100644 data-raw/format_climate_datasets/test_bio_vars.R delete mode 100644 data-raw/format_climate_datasets/test_bio_vars_beyer.R delete mode 100644 data-raw/format_climate_datasets/test_bio_vars_new_krapp.R create mode 100644 man/HYDE_3.3_baseline.Rd diff --git a/NEWS.md b/NEWS.md index 4be7ed3e..ba084905 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,12 @@ # pastclim 2.0.0 * Add Barreto et al 2023 (based on PALEO-PGEM, covering the last 5 M years) * Add all the WorldClim data (present, and future projections with multiple models -and emission scenarios). + and emission scenarios). +* Add the HYDE 3.3 database providing information on agriculture and population sizes + for the last 10k years. * Change the units of Krapp et al 2021 to match those of other datasets. Also, fix -data duplication of some variables which has now also been fixed on the OSF repository -for that dataset. + data duplication of some variables which has now also been fixed on the OSF repository + for that dataset. * Improve `get_ice_mask()`, `get_land_mask()`, and `distance_from_sea()` to work on series rather than just on slices. * Speed up `region_*()` functions when subsetting the extent/cropping. diff --git a/R/datasets_docs.R b/R/datasets_docs.R index 85eddb43..e480c04b 100644 --- a/R/datasets_docs.R +++ b/R/datasets_docs.R @@ -187,3 +187,34 @@ NULL #' @name Barreto2023 NULL #> NULL + +#' Documentation for HYDE 3.3 dataset +#' +#' This database presents an update and expansion of the History Database of +#' the Global Environment (HYDE, v 3.3) and replaces former HYDE 3.2 +#' version from 2017. HYDE is and internally consistent combination of +#' updated historical population estimates and land use. Categories +#' include cropland, with a new distinction into irrigated and rain fed +#' crops (other than rice) and irrigated and rain fed rice. Also grazing +#' lands are provided, divided into more intensively used pasture, +#' converted rangeland and non-converted natural (less intensively used) +#' rangeland. Population is represented by maps of total, urban, rural +#' population and population density as well as built-up area. +#' +#' The period covered is 10 000 BCE to 2023 CE. Spatial resolution is +#' 5 arc minutes (approx. 85 km2 at the equator). The full HYDE 3.3 release +#' contains: a Baseline estimate scenario, a Lower estimate scenario and an +#' Upper estimate scenario. Currently only the baseline scenario is available +#' in `pastclim` +#' +#' If you use this dataset, make sure to cite the original publication +#' for the HYDE 3.2 (there is no current publication for 3.3): +#' +#' Klein Goldewijk, K., Beusen, A., Doelman, J., and Stehfest, E.: +#' Anthropogenic land-use estimates for the Holocene; HYDE 3.2, +#' Earth Syst. Sci. Data, 9, 927-953, 2017. \doi{doi.org/10.5194/essd-9-1-2017} +#' +#' @name HYDE_3.3_baseline +NULL +#> NULL + diff --git a/R/download_dataset.R b/R/download_dataset.R index 1ec546fe..53df8bc0 100644 --- a/R/download_dataset.R +++ b/R/download_dataset.R @@ -31,7 +31,7 @@ download_dataset <- function(dataset, bio_variables = NULL, annual = TRUE, # check that the variable is available for this dataset available_variables <- getOption("pastclim.dataset_list")$variable[getOption("pastclim.dataset_list")$dataset == dataset] - # if variable is null, donwload all possible variables + # if variable is null, download all possible variables if (is.null(bio_variables)) { bio_variables <- getOption("pastclim.dataset_list")[getOption("pastclim.dataset_list")$dataset == dataset, ] if (!monthly) { @@ -55,13 +55,6 @@ download_dataset <- function(dataset, bio_variables = NULL, annual = TRUE, ) } - # if (dataset %in% c("Krapp2021", "Beyer2020", "Example")){ - # # add biome to list of variables (we need it to generate the landmask) - # if (!"biome" %in% bio_variables) { - # bio_variables <- c(bio_variables, "biome") - # } - # } - # add biome to list of variables (we need it to generate the landmask) if (all((!"biome" %in% bio_variables), ("biome" %in% available_variables))) { bio_variables <- c(bio_variables, "biome") diff --git a/R/sysdata.rda b/R/sysdata.rda index 10dd0edaac753c3385f5d4a738d2238611cc8c44..a67d877758888d91d629589d66ec1a01f152b116 100644 GIT binary patch literal 11895 zcmbt)2_Tf)+xQS=sbm>jA~W`}B^22zV;G4s7|NcILXmwJVXUK>tWlOM*PeY(2-#DV zB}?{o?7Q!!d%O2`fA{;o|M!31?K#gm&pFTbKIgp4wOf`_7q05@p!I6^@n?@kCLRnQ z`~nJ~^B@q3@#Pv05QsEdEKaWz1b`)Qa9q9S4PphYPJyC8$U`EB!f~=wdBD{ps&5ta zk{m>W(2aNrRFDFDq5^;b&`E~ZQ1`@JJyVm{6g%vO`0YDBx?8k-u<;OK`^qwZon#K>p&$F6FW^|@kraF`d z-6i>qcA8aO90WR%PBL>$;neY1OYx6N>dGJnJl0x+$FH6z&F}c@P*BfmsCcWND{YJ# zzR9xl6le{^Y9=PTOeL&hG}WWbZY*0}xpqEjB{J0?X^2!99lLyF7c##UeIUvt8#)jwJAD6>8-RA@6g}a;fvLqR~**mSSaSx1RSao1*lq-JwU2?jKGU^NTJM{+?2{~SYi3;k=^ix6mrXHMf#)(tB+d-@K z+rI8y@_p)#yze`Hqxa~GTiKSWvdWA!jLI*PU92di64;i%-e$*#^NXz$={i%3xA}%!SKgv6(265qTB$L=?RyBwkfY@s=U0WMoMRShH&zj zq6vR5UtnOcpxs-@_aq1e!ZC`XrKLSHrE5Ud>~9xsNJ(Cs1*59V%VO3!c|Na>=T2)3 z+(iZTJ4on}HJ`ak2J9z&vGYEUsX=*v?8dssjxjW3QP)zx@rif9=RE0L<<|` zcJs>(BrMWZi^OfwBzh^PA~o@;e8cC@aEmJ7eMmJZ=)B?X6uCa&B}g?HrWU(NYq$&> zf}6sATwS`urBRbenQ6oezLiw=hd#XglKs}j$`OqhLhdlP$|^wK@`VS_*~2kaYZhh& z?E85qvyv`6Q1j212#U5})N1JBYrryfjI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qs>9a`-=7V(j83=VS1dMGk bB##{Sul_z)^qND|lLs9_``fY)P3Qjrtwk;% diff --git a/R/time_bp.R b/R/time_bp.R index a1f7462d..596b650c 100644 --- a/R/time_bp.R +++ b/R/time_bp.R @@ -24,17 +24,21 @@ setGeneric("time_bp", function(x) { setMethod( "time_bp", signature(x = "SpatRaster"), function(x) { - if (timeInfo(x)$step != "years") { + if (timeInfo(x)$step == "years") { + time_bp <- terra::time(x) - 1950 + } else if (any(inherits(terra::time(x), "POSIXct"), inherits(terra::time(x), "Date"))) { + time_bp <- date2ybp(terra::time(x)) + } else { # as of 1.7.18, the bug in terra setting years to negative has ben fixed stop( - "The time units of SpatRaster are not 'years'.\n", + "The time units of SpatRaster are not 'years' or a 'days'.\n", "It might be a problem with the time units not being properly set in the original nc file.\n", "Set time units correctly with time_bp(x)<-c(-10000,-400).\n", "NOTE do NOT use terra:time, as that terra measures years from 0AD, not BP" ) } - time_yr <- terra::time(x) - return(time_yr - 1950) + + return(time_bp) } ) @@ -46,17 +50,7 @@ setMethod( if (!is_region_series(x)) { stop("this is not a valid region series; it should be a SpatRasterDataset where each dataset (i.e. variable) has the same time steps") } - if (timeInfo(x[[1]])$step != "years") { - # as of 1.7.18, the bug in terra setting years to negative has been fixed - stop( - "The time units of SpatRaster are not 'years'.\n", - "It might be a problem with the time units not being properly set in the original nc file.\n", - "Set time units correctly with time_bp(x)<-c(-10000,-400).\n", - "NOTE do NOT use terra:time, as that terra measures years from 0AD, not BP" - ) - } - time_yr <- terra::time(x[[1]]) - return(time_yr - 1950) + time_bp(x[[1]]) } ) diff --git a/R/ybp2date.R b/R/ybp2date.R index bf522c49..7fd40b8e 100644 --- a/R/ybp2date.R +++ b/R/ybp2date.R @@ -25,8 +25,8 @@ ybp2date <- function(x) { #' @rdname ybp2date #' @export date2ybp <- function(x) { - if (!inherits(x, "POSIXct")) { - stop("x should be a POSIXct object") + if (!any(inherits(x, "POSIXct"), inherits(x, "Date"))) { + stop("x should be a POSIXct or Date object") } lubridate::year(x) - 1950 } diff --git a/data-raw/data_files/dataset_list_included.csv b/data-raw/data_files/dataset_list_included.csv index b15a2641..b1f01cb7 100644 --- a/data-raw/data_files/dataset_list_included.csv +++ b/data-raw/data_files/dataset_list_included.csv @@ -6528,3 +6528,19 @@ temperature_max_09,temperature_max_09,WorldClim_2.1_UKESM1-0-LL_ssp585_5m,TRUE,W temperature_max_10,temperature_max_10,WorldClim_2.1_UKESM1-0-LL_ssp585_5m,TRUE,WorldClim_2.1_UKESM1-0-LL_ssp585_5m_tmax_v1.4.0.nc,,download_worldclim_future,,,1.4.0,maximum temperature Oct,max T Oct,october,degrees Celsius,*degree*C*, temperature_max_11,temperature_max_11,WorldClim_2.1_UKESM1-0-LL_ssp585_5m,TRUE,WorldClim_2.1_UKESM1-0-LL_ssp585_5m_tmax_v1.4.0.nc,,download_worldclim_future,,,1.4.0,maximum temperature Nov,max T Nov,november,degrees Celsius,*degree*C*, temperature_max_12,temperature_max_12,WorldClim_2.1_UKESM1-0-LL_ssp585_5m,TRUE,WorldClim_2.1_UKESM1-0-LL_ssp585_5m_tmax_v1.4.0.nc,,download_worldclim_future,,,1.4.0,maximum temperature Dec,max T Dec,december,degrees Celsius,*degree*C*, +cropland,cropland,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_cropland.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/cropland.nc,,,,1.4.0,total cropland area,cropland,annual,km^2 per gridcell,*km^2*, +grazing_land,grazing_land,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_grazing_land.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/grazing_land.nc,,,,1.4.0,total grazing land,grazing land,annual,km^2 per gridcell,*km^2*, +irrigated_rice,irrigated_rice,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_irrigated_rice.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/irrigated_rice.nc,,,,1.4.0,irrigated rice,irrigated rice,annual,km^2 per gridcell,*km^2*, +irrigated_not_rice,irrigated_not_rice,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_irrigated_not_rice.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/irrigated_not_rice.nc,,,,1.4.0,irrigated not rice,irrigated not rice,annual,km^2 per gridcell,*km^2*, +pasture,pasture,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_pasture.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/pasture.nc,,,,1.4.0,total pasture area,pasture,annual,km^2 per gridcell,*km^2*, +population_density,population_density,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_population_density.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/population_density.nc,,,,1.4.0,total population_density area,population_density,annual,km^2 per gridcell,*km^2*, +population,population,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_population.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/population.nc,,,,1.4.0,total population area,population,annual,km^2 per gridcell,*km^2*, +rainfed_not_rice,rainfed_not_rice,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_rainfed_not_rice.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/rainfed_not_rice.nc,,,,1.4.0,total rainfed_not_rice area,rainfed_not_rice,annual,km^2 per gridcell,*km^2*, +rainfed_rice,rainfed_rice,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_rainfed_rice.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/rainfed_rice.nc,,,,1.4.0,total rainfed_rice area,rainfed_rice,annual,km^2 per gridcell,*km^2*, +rangeland,rangeland,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_rangeland.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/rangeland.nc,,,,1.4.0,total rangeland area,rangeland,annual,km^2 per gridcell,*km^2*, +rural_population,rural_population,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_rural_population.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/rural_population.nc,,,,1.4.0,total rural_population area,rural_population,annual,km^2 per gridcell,*km^2*, +total_irrigated,total_irrigated,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_total_irrigated.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/total_irrigated.nc,,,,1.4.0,total total_irrigated area,total_irrigated,annual,km^2 per gridcell,*km^2*, +total_rainfed,total_rainfed,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_total_rainfed.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/total_rainfed.nc,,,,1.4.0,total total_rainfed area,total_rainfed,annual,km^2 per gridcell,*km^2*, +total_rice,total_rice,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_total_rice.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/total_rice.nc,,,,1.4.0,total total_rice area,total_rice,annual,km^2 per gridcell,*km^2*, +urban_area,urban_area,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_urban_area.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/urban_area.nc,,,,1.4.0,total urban_area area,urban_area,annual,km^2 per gridcell,*km^2*, +urban_population,urban_population,HYDE_3.3_baseline,FALSE,HYDE_3.3_baseline_urban_population.nc,https://geo.public.data.uu.nl/vault-hyde-data/HYDE%203.3%5B1696419673%5D/original/Baseline_scenario/NetCDF/urban_population.nc,,,,1.4.0,total urban_population area,urban_population,annual,km^2 per gridcell,*km^2*, diff --git a/data-raw/format_climate_datasets/test_bio_vars.R b/data-raw/format_climate_datasets/test_bio_vars.R deleted file mode 100644 index 982117ef..00000000 --- a/data-raw/format_climate_datasets/test_bio_vars.R +++ /dev/null @@ -1,100 +0,0 @@ -# monthly_vars <- c(paste0("temperature_",sprintf("%02d", 1:12)), -# paste0("precipitation_",sprintf("%02d", 1:12))) -# pastclim:::download_dataset(dataset = "Krapp2021",bio_variables = monthly_vars) - -setwd("~/Downloads/data/processed/") - -krapp_new <- terra::rast(dir("./")) - - -krapp_temp <- pastclim::region_slice( - time_bp = 0, - dataset = "Krapp2021", - bio_variables = paste0("temperature_", sprintf("%02d", 1:12)) -) -krapp_temp <- krapp_temp - 273.15 - -krapp_prec <- pastclim::region_slice( - time_bp = 0, - dataset = "Krapp2021", - bio_variables = paste0("precipitation_", sprintf("%02d", 1:12)) -) -krapp_biovar <- pastclim::bioclim_vars(prec = krapp_prec, tavg = krapp_temp) - -krapp_pastclim_biovar <- pastclim::region_slice( - time_bp = 0, - dataset = "Krapp2021", - bio_variables = names(krapp_biovar) -) - - -cor_all <- vector() -for (i in names(krapp_biovar)) { - cor_all[i] <- cor.test( - as.matrix(krapp_biovar[[i]]), - as.matrix(krapp_new[[i]]) - )$estimate -} -cor_all - -krapp_new[101, 150] -krapp_biovar[101, 150] -krapp_prec[101, 150] - -# bio07, bio15 - -# bio12, bio13, bio14,bio16,bio17,bio18,bio19 - -# bio12 should not be divided by 12 (it should be the sum) -# bio13, bio14, bio16, bio17,bio18,and bio19 are divided by 12 - -# find discrepancies -# bio05 -krapp_pastclim_biovar$bio10[101, 150] -krapp_biovar$bio10[101, 150] - - -krapp_temp[100, 150] - -# check that monhtly temperature make sense -this_temp <- ncdf4::nc_open("bio19_800ka.nc") -sep_temp <- ncdf4::ncvar_get(nc = this_temp, varid = "bio19") -sep_temp[, , 800] -> foo -foo[foo > 10^10] <- NA -image(foo) -foo <- foo[, ncol(foo):1] -foo <- terra::rast(t(foo)) -plot(foo) -foo[101, 150] - - - -# bio15 is seasonality. In Mario's formula, the +1 is only applied to the sum, but not the - -this_prec <- unlist(krapp_prec[101, 150]) -100 * sd(this_prec) / ((sum(this_prec) + 1) / 12) - - - -## Unit issues -# bio04 in Krapp not multiplied by 100 (but maybe somethign else) -# bio12 in Krapp is the mean of the precipitation (not the total annual precipitation) -# bio16 and bio17 is the sum of the precipitation in that quarter, not the monthly mean - -## inconsistencies -# bio05, bio06, bio07 are different as they are based on monthly temperatures using the pastclim function, -# but on monthly temperatures when using the downscaling functions. Depsite bio05 and bio06 being well correlated, -# bio07 (their difference) is not. However, bio05 and bio06 are less extreme than the monthly average, which does not make sense. - -# bio15 - -## Variable duplication -# bio08 is copy of bio10, -# bio09 is copy of bio 11 -# bio18 is a copy of bio16 -# bio19 is a copy of bio17 - -cor.test( - as.matrix(krapp_pastclim_biovar$bio16), - as.matrix(krapp_pastclim_biovar$bio18) -)$estimate diff --git a/data-raw/format_climate_datasets/test_bio_vars_beyer.R b/data-raw/format_climate_datasets/test_bio_vars_beyer.R deleted file mode 100644 index 9401601c..00000000 --- a/data-raw/format_climate_datasets/test_bio_vars_beyer.R +++ /dev/null @@ -1,92 +0,0 @@ -# monthly_vars <- c(paste0("temperature_",sprintf("%02d", 1:12)), -# paste0("precipitation_",sprintf("%02d", 1:12))) -# pastclim:::download_dataset(dataset = "beyer2021",bio_variables = monthly_vars) - - -beyer_temp <- pastclim::region_slice( - time_bp = 0, - dataset = "Beyer2020", - bio_variables = paste0("temperature_", sprintf("%02d", 1:12)) -) -# beyer_temp <- beyer_temp - 273.15 - -beyer_prec <- pastclim::region_slice( - time_bp = 0, - dataset = "Beyer2020", - bio_variables = paste0("precipitation_", sprintf("%02d", 1:12)) -) -beyer_biovar <- pastclim::bioclim_vars(prec = beyer_prec, tavg = beyer_temp) - -beyer_pastclim_biovar <- pastclim::region_slice( - time_bp = 0, - dataset = "Beyer2020", - bio_variables = names(beyer_biovar) -) - - -cor_all <- vector() -for (i in names(beyer_biovar)) { - cor_all[i] <- cor.test( - as.matrix(beyer_biovar[[i]]), - as.matrix(beyer_pastclim_biovar[[i]]) - )$estimate -} -cor_all - - -# bio07, bio15 - -# bio12, bio13, bio14,bio16,bio17,bio18,bio19 - -# bio12 should not be divided by 12 (it should be the sum) -# bio13, bio14, bio16, bio17,bio18,and bio19 are divided by 12 - -# find discrepancies -# bio05 -beyer_pastclim_biovar[101, 150] -beyer_biovar[101, 150] - -beyer_temp[100, 150] - -# check that monhtly temperature make sense -this_temp <- ncdf4::nc_open("bio19_800ka.nc") -sep_temp <- ncdf4::ncvar_get(nc = this_temp, varid = "bio19") -sep_temp[, , 800] -> foo -foo[foo > 10^10] <- NA -image(foo) -foo <- foo[, ncol(foo):1] -foo <- terra::rast(t(foo)) -plot(foo) -foo[101, 150] - - - -# bio15 is seasonality. In Mario's formula, the +1 is only applied to the sum, but not the - -this_prec <- unlist(beyer_prec[101, 150]) -100 * sd(this_prec) / ((sum(this_prec) + 1) / 12) - - - -## Unit issues -# bio04 in beyer not multiplied by 100 (but maybe somethign else) -# bio12 in beyer is the mean of the precipitation (not the total annual precipitation) -# bio16 and bio17 is the sum of the precipitation in that quarter, not the monthly mean - -## inconsistencies -# bio05, bio06, bio07 are different as they are based on monthly temperatures using the pastclim function, -# but on monthly temperatures when using the downscaling functions. Depsite bio05 and bio06 being well correlated, -# bio07 (their difference) is not. However, bio05 and bio06 are less extreme than the monthly average, which does not make sense. - -# bio15 - -## Variable duplication -# bio08 is copy of bio10, -# bio09 is copy of bio 11 -# bio18 is a copy of bio16 -# bio19 is a copy of bio17 - -cor.test( - as.matrix(beyer_pastclim_biovar$bio16), - as.matrix(beyer_pastclim_biovar$bio18) -)$estimate diff --git a/data-raw/format_climate_datasets/test_bio_vars_new_krapp.R b/data-raw/format_climate_datasets/test_bio_vars_new_krapp.R deleted file mode 100644 index 67e1577c..00000000 --- a/data-raw/format_climate_datasets/test_bio_vars_new_krapp.R +++ /dev/null @@ -1,101 +0,0 @@ -# monthly_vars <- c(paste0("temperature_",sprintf("%02d", 1:12)), -# paste0("precipitation_",sprintf("%02d", 1:12))) -# pastclim:::download_dataset(dataset = "Krapp2021",bio_variables = monthly_vars) - -# setwd("~/Downloads/data/processed/") - -pastclim::set_data_path(path_to_nc = "~/project_temp/mario_data/", copy_example = FALSE) - - -# krapp_new <- terra::rast(dir("./")) - - -krapp_temp <- pastclim::region_slice( - time_bp = 0, - dataset = "Krapp2021", - bio_variables = paste0("temperature_", sprintf("%02d", 1:12)) -) -krapp_prec <- pastclim::region_slice( - time_bp = 0, - dataset = "Krapp2021", - bio_variables = paste0("precipitation_", sprintf("%02d", 1:12)) -) -krapp_biovar <- pastclim::bioclim_vars(prec = krapp_prec, tavg = krapp_temp) - -krapp_pastclim_biovar <- pastclim::region_slice( - time_bp = 0, - dataset = "Krapp2021", - bio_variables = names(krapp_biovar) -) - - -cor_all <- vector() -for (i in names(krapp_biovar)) { - cor_all[i] <- cor.test( - as.matrix(krapp_biovar[[i]]), - as.matrix(krapp_pastclim_biovar[[i]]) - )$estimate -} -cor_all - -krapp_pastclim_biovar[101, 150] -krapp_biovar[101, 150] -krapp_prec[101, 150] - -# bio07, bio15 - -# bio12, bio13, bio14,bio16,bio17,bio18,bio19 - -# bio12 should not be divided by 12 (it should be the sum) -# bio13, bio14, bio16, bio17,bio18,and bio19 are divided by 12 - -# find discrepancies -# bio05 -krapp_pastclim_biovar$bio10[101, 150] -krapp_biovar$bio10[101, 150] - - -krapp_temp[100, 150] - -# check that monhtly temperature make sense -this_temp <- ncdf4::nc_open("bio19_800ka.nc") -sep_temp <- ncdf4::ncvar_get(nc = this_temp, varid = "bio19") -sep_temp[, , 800] -> foo -foo[foo > 10^10] <- NA -image(foo) -foo <- foo[, ncol(foo):1] -foo <- terra::rast(t(foo)) -plot(foo) -foo[101, 150] - - - -# bio15 is seasonality. In Mario's formula, the +1 is only applied to the sum, but not the - -this_prec <- unlist(krapp_prec[101, 150]) -100 * sd(this_prec) / ((sum(this_prec) + 1) / 12) - - - -## Unit issues -# bio04 in Krapp not multiplied by 100 (but maybe somethign else) -# bio12 in Krapp is the mean of the precipitation (not the total annual precipitation) -# bio16 and bio17 is the sum of the precipitation in that quarter, not the monthly mean - -## inconsistencies -# bio05, bio06, bio07 are different as they are based on monthly temperatures using the pastclim function, -# but on monthly temperatures when using the downscaling functions. Depsite bio05 and bio06 being well correlated, -# bio07 (their difference) is not. However, bio05 and bio06 are less extreme than the monthly average, which does not make sense. - -# bio15 - -## Variable duplication -# bio08 is copy of bio10, -# bio09 is copy of bio 11 -# bio18 is a copy of bio16 -# bio19 is a copy of bio17 - -cor.test( - as.matrix(krapp_pastclim_biovar$bio16), - as.matrix(krapp_pastclim_biovar$bio18) -)$estimate diff --git a/inst/WORDLIST b/inst/WORDLIST index 0d779f8e..c9421e52 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,10 +1,12 @@ ANUCLIM +Beusen CHELSA CMCC CMD CMIP CSM Chalki +Doelman ESM ETOPO Edmundson @@ -17,6 +19,7 @@ GCMs GFDL GISS Geosci +Goldewijk HR HadCM HadGEM @@ -45,6 +48,8 @@ Sci SpatRaster SpatRasterDataset Spratt +Stehfest +Syst TraCE Tran UKESM diff --git a/man/HYDE_3.3_baseline.Rd b/man/HYDE_3.3_baseline.Rd new file mode 100644 index 00000000..012e7c8d --- /dev/null +++ b/man/HYDE_3.3_baseline.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/datasets_docs.R +\name{HYDE_3.3_baseline} +\alias{HYDE_3.3_baseline} +\title{Documentation for HYDE 3.3 dataset} +\description{ +This database presents an update and expansion of the History Database of +the Global Environment (HYDE, v 3.3) and replaces former HYDE 3.2 +version from 2017. HYDE is and internally consistent combination of +updated historical population estimates and land use. Categories +include cropland, with a new distinction into irrigated and rain fed +crops (other than rice) and irrigated and rain fed rice. Also grazing +lands are provided, divided into more intensively used pasture, +converted rangeland and non-converted natural (less intensively used) +rangeland. Population is represented by maps of total, urban, rural +population and population density as well as built-up area. +} +\details{ +The period covered is 10 000 BCE to 2023 CE. Spatial resolution is +5 arc minutes (approx. 85 km2 at the equator). The full HYDE 3.3 release +contains: a Baseline estimate scenario, a Lower estimate scenario and an +Upper estimate scenario. Currently only the baseline scenario is available +in \code{pastclim} + +If you use this dataset, make sure to cite the original publication +for the HYDE 3.2 (there is no current publication for 3.3): + +Klein Goldewijk, K., Beusen, A., Doelman, J., and Stehfest, E.: +Anthropogenic land-use estimates for the Holocene; HYDE 3.2, +Earth Syst. Sci. Data, 9, 927-953, 2017. \doi{doi.org/10.5194/essd-9-1-2017} +}