Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #43

Merged
merged 146 commits into from
Oct 13, 2023
Merged

Dev #43

Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
dc562e8
preliminary internal functions
dramanica Dec 7, 2022
4ba037e
download reliefs
dramanica Dec 7, 2022
30b4bf3
remove pdf
dramanica Dec 7, 2022
8518c59
fix for terra bug on cran
dramanica Dec 7, 2022
74d5844
ideas for monthly vars
dramanica Dec 7, 2022
269bfa1
First implementation of bioclim_vars
dramanica Dec 9, 2022
5b8720d
biovars for sds
dramanica Dec 9, 2022
d2a1266
improve docs for methods
dramanica Dec 9, 2022
e58c898
Fix possible problems with relief extent
dramanica Dec 9, 2022
7eb94f3
new vignette for downscaling
dramanica Dec 9, 2022
40189e8
worldclim helper functions
dramanica Dec 10, 2022
898d9b9
initial files for ds
dramanica Dec 12, 2022
7b2a3a3
Merge branch 'cran_fixes' into ds_files
dramanica Dec 14, 2022
58dd456
move ds draft vignette
dramanica Dec 14, 2022
cb41d83
fix rounding bug for resolution
dramanica Dec 14, 2022
58d9ba8
silence idw messages
dramanica Dec 14, 2022
33ba3b7
Merge branch 'cran_fixes' into ds_files
dramanica Dec 14, 2022
3c21ca8
Update namespace
dramanica Dec 14, 2022
7c9cf71
initial implementation of a remote test
dramanica Dec 15, 2022
0ef8270
direct casting from bathy to spatraster
dramanica Dec 15, 2022
fc62ee0
Update pdf vignette
dramanica Dec 21, 2022
49c55e9
clean up old files
dramanica Dec 21, 2022
890daa2
Merge remote-tracking branch 'origin/dev' into ds_files
dramanica Mar 21, 2023
315f906
Merge remote-tracking branch 'origin/dev' into ds_files
dramanica Mar 31, 2023
dc30746
Update ds files
dramanica Apr 1, 2023
7b90a17
Clean up for ds
dramanica Apr 1, 2023
163d7f0
Merge branch 'dev' into ds_files
dramanica Apr 2, 2023
768464b
Merge branch 'dev' into ds_files
dramanica Apr 20, 2023
bd4d91f
Spell out limitations for land mask
dramanica Apr 24, 2023
62a3eed
Merge branch 'dev' into ds_files
dramanica Apr 26, 2023
c6e3dd9
Update docs
dramanica Apr 26, 2023
705f0f4
Small docs updates
dramanica Apr 26, 2023
d6e21cf
minor doc tweaks
dramanica Apr 26, 2023
db54801
Merge branch 'ds_files' of github.com:EvolEcolGroup/pastclim into ds_…
dramanica Apr 27, 2023
5540b0e
Get time_bp for region_series
dramanica Apr 27, 2023
6a9cf7d
Use dev terra
dramanica Apr 27, 2023
4af2f4d
fix time_bp<- for SpatRasterDataset
dramanica Apr 27, 2023
34613cc
fix docs
dramanica Apr 27, 2023
d12bd35
make some more functions work with series
dramanica Apr 28, 2023
b34455b
Small edits to docs
dramanica Apr 28, 2023
1bb193f
Merge pull request #27 from EvolEcolGroup/time_bp_series
dramanica Apr 28, 2023
bd2f778
bump version
dramanica Apr 28, 2023
c8c69c6
minor wording improvement
dramanica Apr 28, 2023
4576f82
Linting of vignette
dramanica Apr 28, 2023
16cef89
Readme fixes
dramanica Apr 28, 2023
2879558
Update news
dramanica Apr 28, 2023
6a6afd8
Merge branch 'dev' into ds_files
dramanica Apr 28, 2023
92ee8b1
typo
dramanica Apr 29, 2023
0013472
Prepare update_dataset_list to work on CRAN
dramanica May 1, 2023
864d0ec
clean readme
dramanica May 1, 2023
20f8877
clean readme
dramanica May 1, 2023
ea936bf
Merge branch 'dev' into ds_files
dramanica May 1, 2023
aa85766
Notes about parallelising idw
dramanica May 7, 2023
2e7597b
Some more ds functionality
dramanica May 9, 2023
9c39f13
more ds infrastructure
dramanica May 10, 2023
06db7d5
Fix temporary path problem for set_data_path
dramanica May 11, 2023
6f6b698
spelling fixes
dramanica May 11, 2023
00426ab
clean up scripts to prepare Beyer2020
dramanica May 17, 2023
dad3aba
fix missing value
dramanica May 19, 2023
c69263d
Update script for Beyer2020 packing
dramanica May 19, 2023
1d0b103
fix monthly prep
dramanica May 19, 2023
e04d552
clean up biomes
dramanica May 19, 2023
d12ed46
Updated repackage scripts for Beyer
dramanica May 20, 2023
a0f06f7
A few minor tweaks
dramanica May 20, 2023
7259a54
small fix to load_etopo
dramanica May 24, 2023
2c5f560
Clean up
dramanica Jun 5, 2023
f097996
Try to fix windows warnings
dramanica Jun 5, 2023
bf26dcf
fix error in Windows
dramanica Jun 5, 2023
abace31
Merge pull request #28 from EvolEcolGroup/clean_up
dramanica Jun 5, 2023
bfc3020
show only annual vars by default.
dramanica Jun 5, 2023
345b12f
Add worldclim present day datasets
dramanica Jun 23, 2023
32193c0
Merge pull request #29 from EvolEcolGroup/present
dramanica Jun 23, 2023
4598a07
future worldclim
dramanica Jun 23, 2023
6f47b7e
full future datasets
dramanica Jun 23, 2023
9b55657
fix vignette
dramanica Jun 23, 2023
68ab88c
future reconstructions
dramanica Jun 23, 2023
2d7b035
Update docs
dramanica Jun 24, 2023
b926082
Clean up WorldClim implementation
dramanica Jun 24, 2023
3a314c2
Merge pull request #30 from EvolEcolGroup/future
dramanica Jun 24, 2023
e2fb443
add option to use time_ce
dramanica Jun 28, 2023
fb26981
ce implementation
dramanica Jun 28, 2023
e7617ce
Minor doc edits
dramanica Jun 28, 2023
fab79ac
more ce changes
dramanica Jun 28, 2023
0c1054c
fix get_land_mask for ce
dramanica Jun 28, 2023
f5cb453
fix ce error
dramanica Jun 29, 2023
824b0fb
Small var fixes
dramanica Jun 29, 2023
feba578
Fix download future projections
dramanica Jun 29, 2023
a4cf89b
temporary fix for reloading sf if needed.
dramanica Jun 29, 2023
4709a1d
bump version number
dramanica Jun 29, 2023
3963c76
Merge pull request #32 from EvolEcolGroup/times_coords
dramanica Jun 29, 2023
c4afd02
Update vignette
dramanica Jul 2, 2023
e302a64
minor vignette update
dramanica Jul 2, 2023
d7e439f
start new vignette
dramanica Jul 9, 2023
3712d90
Avoid unloading sf
dramanica Jul 9, 2023
e748d6f
Fix warnings for WorldClim
dramanica Jul 9, 2023
ff39674
Merge pull request #34 from EvolEcolGroup/present_future
dramanica Jul 9, 2023
ab8de3d
refurbish location workings
dramanica Jul 12, 2023
0b0abfb
custom coords for location_series
dramanica Jul 12, 2023
ed1dc20
Merge branch 'location_rewrite' into dev
dramanica Jul 12, 2023
23be888
update docs for location functions
dramanica Jul 12, 2023
3939a59
For biome, use the mode when interpolating
dramanica Jul 12, 2023
144dd41
add compression to custom example
dramanica Jul 12, 2023
ec9be7c
fix land mask for Krapp2021
dramanica Aug 1, 2023
8b9ee6d
Merge pull request #36 from EvolEcolGroup/land_mask
dramanica Aug 19, 2023
969b198
Fix lack of a pastclim-package alias
dramanica Aug 30, 2023
3499c4b
Fix help for cran
dramanica Aug 30, 2023
0daeafb
Bump version
dramanica Aug 30, 2023
d523192
Merge pull request #38 from EvolEcolGroup/help_page
dramanica Aug 31, 2023
bfb8933
speed up region_* when cropping
dramanica Sep 8, 2023
a56c6fa
Merge pull request #39 from EvolEcolGroup/speed
dramanica Sep 8, 2023
edcdf44
Merge branch 'dev' into file_testing
dramanica Sep 8, 2023
a563182
test files
dramanica Sep 8, 2023
b012853
checks
dramanica Sep 8, 2023
3f73e8c
test_fix
dramanica Sep 8, 2023
2e38302
filter tif for worldclim
dramanica Sep 8, 2023
fdaec41
Note on fixing future monthly
dramanica Sep 8, 2023
e3905fe
fix var names
dramanica Sep 12, 2023
0d27b28
Merge branch 'file_testing' of github.com:EvolEcolGroup/pastclim into…
dramanica Sep 12, 2023
eec464e
remove debug code
dramanica Sep 13, 2023
036886b
remove note after bugfix
dramanica Sep 13, 2023
1160c0b
Merge pull request #40 from EvolEcolGroup/file_testing
dramanica Sep 13, 2023
c0e1b9b
Minor edit
dramanica Sep 14, 2023
53e9981
Add link to reprex package
dramanica Sep 14, 2023
98e17f5
Initial integration of Barreto et al 2023
dramanica Sep 18, 2023
03cd05d
Give warning for long operations with Barreto2023
dramanica Sep 19, 2023
3f4c6f1
Update readme and co
dramanica Sep 19, 2023
7416aa8
Merge pull request #41 from EvolEcolGroup/paleopgem2
dramanica Sep 19, 2023
e1e2dda
Merge remote-tracking branch 'origin/dev' into dev
dramanica Sep 19, 2023
cf5d20e
initial work for check vars
dramanica Aug 31, 2023
1edcc82
Explore variable issues
dramanica Sep 8, 2023
4908d2d
Beyer check
dramanica Sep 8, 2023
40bc2ef
minor tweaks for checks
dramanica Sep 14, 2023
7285330
first draft of script for krapp2021
dramanica Oct 4, 2023
484b3bf
addendum
dramanica Oct 5, 2023
b3a0de7
monthly start
dramanica Oct 5, 2023
746d235
Update Krapp2021
dramanica Oct 6, 2023
8e0b6e3
Merge pull request #42 from EvolEcolGroup/var_fixes
dramanica Oct 6, 2023
f11962e
styler clean up
dramanica Oct 11, 2023
d5badeb
Fix docs
dramanica Oct 12, 2023
8b7b4f6
Minor doc edits
dramanica Oct 12, 2023
bb1c7b6
add date conversion
dramanica Oct 12, 2023
6f5426a
Add lubridate to imports
dramanica Oct 13, 2023
7576d99
Add test for ybp2date
dramanica Oct 13, 2023
a7e1971
Fix documentation for internal function.
dramanica Oct 13, 2023
79d7a60
Update cran comments
dramanica Oct 13, 2023
b2f9d86
Merge branch 'master' into dev
dramanica Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# development
* Add Barreto et al 2023 (based on PALEO-PGEM, covering the last 5 M years),
and all the WorldClim data (present, and future projections with multiple models
and emission scenarios).
* 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.

# pastclim 1.2.4
* Updates on how time is handled to stay in sync with changes in `terra`.
Expand Down
55 changes: 49 additions & 6 deletions R/datasets_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ NULL
#' Documentation for the WorldClim datasets
#'
#' WorldClim version 2.1 is a database of high spatial resolution global weather and
#' climate data, covering both the present and future projections.
#' climate data, covering both the present and future projections. If you use this
#' dataset, make sure to cite the original publication:
#'
#' Fick, S.E. and R.J. Hijmans, 2017. WorldClim 2: new 1km spatial resolution
#' climate surfaces for global land areas. International Journal of Climatology 37 (12): 4302-4315.
#' \doi{doi.org/10.1002/joc.5086}
#'
#' **Present-day reconstructions** are based on the mean for the period 1970-2000,
#' and are available at multiple resolutions of
Expand Down Expand Up @@ -116,11 +121,6 @@ NULL
#' are automatically downloaded for each combination of GCM model and SSP, and are selected
#' as usual by defining the time in functions such as [region_slice()].
#'
#' If you use this dataset, make sure to cite the original publication:
#'
#' Fick, S.E. and R.J. Hijmans, 2017. WorldClim 2: new 1km spatial resolution
#' climate surfaces for global land areas. International Journal of Climatology 37 (12): 4302-4315.
#' \doi{doi.org/10.1002/joc.5086}
#'
#' @name WorldClim_2.1
NULL
Expand All @@ -140,3 +140,46 @@ NULL
NULL
#> NULL

#' Documentation for the Barreto et al 2023 dataset
#'
#' Spatio-temporal series of monthly temperature and precipitation and 17
#' derived bioclimatic variables covering the last 5 Ma (Pliocene–Pleistocene),
#' at intervals of 1,000 years, and a spatial resolution of 1
#' degrees (see Barreto et al., 2023 for details).
#'
#' PALEO-PGEM-Series is downscaled to 1° × 1° spatial resolution from the
#' outputs of the PALEO-PGEM emulator (Holden et al., 2019), which emulates
#' reasonable and extensively validated global estimates of monthly temperature
#' and precipitation for the Plio-Pleistocene every 1 kyr at a spatial
#' resolution of ~5° × 5° (Holden et al., 2016, 2019).
#'
#' PALEO-PGEM-Series includes the mean and the standard deviation (i.e.,
#' standard error) of the emulated climate over 10 stochastic GCM emulations
#' to accommodate aspects of model uncertainty. This allows users to estimate
#' the robustness of their results in the face of the stochastic aspects of
#' the emulations. For more details, see Section 2.4 in Barreto et al. (2023).
#'
#' Note that this is a very large dataset, with 5001 time slices. It takes
#' approximately 1 minute to set up each variable when creating a region_slice or
#' region_series. However, once the object has been created, other operations tend
#' to be much faster (especially if you subset the dataset to a small number
#' of time steps of interest).
#'
#' If you use this dataset, make sure to cite the original publications:
#'
#' Barreto, E., Holden, P. B., Edwards, N. R., & Rangel, T. F. (2023).
#' PALEO-PGEM-Series: A spatial time series of the global climate over the
#' last 5 million years (Plio-Pleistocene). Global Ecology and
#' Biogeography, 00, 1– 12.
#' \doi{doi.org/10.1111/geb.13683}
#'
#' Holden, P. B., Edwards, N. R., Rangel, T. F., Pereira, E. B., Tran, G. T.,
#' and Wilkinson, R. D. (2019): PALEO-PGEM v1.0: a statistical emulator of
#' Pliocene–Pleistocene climate, Geosci. Model Dev., 12, 5137–5155,
#' \doi{doi.org/10.5194/gmd-12-5137-2019}.
#'
#' @name Barreto2023
NULL
#> NULL


23 changes: 15 additions & 8 deletions R/download_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ download_dataset <- function(dataset, bio_variables = NULL, annual = TRUE,
# check the dataset exists
available_datasets <- unique(getOption("pastclim.dataset_list")$dataset)
if (!dataset %in% available_datasets) {
cat("'dataset' must be one of ")
get_available_datasets()
stop(
"'dataset' must be one of ",
paste(available_datasets, collapse = ", ")
"Invalid 'dataset', for a comprehensive list of all possible combinations, use `list_available_datasets()`"
)
}

Expand Down Expand Up @@ -55,13 +56,19 @@ 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")
}
}
# 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")
}


# special case for the example dataset
# as we have a copy on the package
if (dataset == "Example"){
Expand Down
4 changes: 3 additions & 1 deletion R/region_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ region_series <-
time_bp <- check_time_vars(time_bp = time_bp, time_ce = time_ce)

check_dataset_path(dataset = dataset, path_to_nc = path_to_nc)

if (dataset=="Barreto2023"){
message("This is a large dataset, it might take a while...")
}

if (!is.null(ext)){
if(!any(inherits(ext,"SpatExtent"),
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ dev](https://img.shields.io/github/checks-status/EvolEcolGroup/pastclim/dev?labe

This `R` library is designed to provide an easy way to extract and
manipulate palaeoclimate reconstructions for ecological and
anthropological analyses.
anthropological analyses. It is also able to handle timeseries of future
reconstructions.

The functionalities of `pastclim` are described in [Leonardi et al.
(2023)](https://doi.org/10.1111/ecog.06481). Please cite it if you use
Expand Down Expand Up @@ -54,10 +55,12 @@ updated for the `dev` branch of `pastclim` (on the top left of the dev
website, the version number is in red and in the format x.x.x.9xxx,
indicating it is a development version).

`pastclim` currently includes data from Beyer et al 2020, a reconstruction
of climate based on the HadCM3 model for the last 120k years, and Krapp
et al 2021, which covers the last 800k years. The reconstructions are
bias-corrected and downscaled to 0.5 degree. More details on these
Pastclim currently includes data from Beyer et al 2020 (a reconstruction
of climate based on the HadCM3 model for the last 120k years), Krapp
et al 2021 (which covers the last 800k years with a statistical emulator of HadCM3),
Barreto et al 2023 (covering the last 5M years using hte PALEO-PGEM emulator),
and the WorldClim data (present, and future projections with a number of models and
emission scenarios). More details on each of these
datasets can be found
[here](https://evolecolgroup.github.io/pastclim/articles/a1_available_datasets.html).
There are also instructions on how to build and use [custom
Expand Down
1 change: 1 addition & 0 deletions data-raw/data_files/.~lock.dataset_list_included.csv#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,am315,zoopc805.biosci.cam.ac.uk,18.09.2023 15:12,file:///home/am315/.config/libreoffice/4;
Loading
Loading