-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump to 1.1.0
- Loading branch information
Showing
136 changed files
with
5,947 additions
and
1,144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ ci_dependencies | |
^docs$ | ||
^pkgdown$ | ||
^\.github$ | ||
^cran-comments.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [master, dev, gitactions] | ||
pull_request: | ||
branches: [master, dev, gitactions] | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macOS-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master, dev] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
cache-version: 2 | ||
extra-packages: any::pkgdown | ||
needs: website | ||
|
||
- name: Downgrade terra | ||
run: | | ||
Rscript -e 'pak::pkg_install("devtools")' | ||
Rscript -e 'devtools::install_version("terra", version="1.6.7", repos = "https://cloud.r-project.org/")' | ||
- name: Deploy package | ||
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, commit_message =paste0(pkgdown:::construct_commit_message("."),"\n [skip ci]"))' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
branches: [master, dev] | ||
pull_request: | ||
branches: [master, dev] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
@@ -12,24 +14,38 @@ name: pkgdown | |
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v1 | ||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v1 | ||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v1 | ||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: pkgdown | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Deploy package | ||
- name: Downgrade terra | ||
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, commit_message =paste0(pkgdown:::construct_commit_message("."),"\n [skip ci]"))' | ||
Rscript -e 'pak::pkg_install("devtools")' | ||
Rscript -e 'devtools::install_version("terra", version="1.6.7", repos = "https://cloud.r-project.org/")' | ||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/[email protected] | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
Package: pastclim | ||
Type: Package | ||
Title: This package provides helper functions to interact with timeseries of worldwide climate | ||
reconstructions | ||
Version: 1.0.1 | ||
Title: Manipulate Timeseries of Paleoclimate Reconstructions | ||
Version: 1.1.0 | ||
Authors@R: c( | ||
person("Michela", "Leonardi", role = "aut"), | ||
person(c("Emily","Y."), "Hallet", role = "ctb"), | ||
|
@@ -12,32 +11,27 @@ Authors@R: c( | |
email = "[email protected]") | ||
) | ||
Maintainer: Andrea Manica <[email protected]> | ||
Description: Currently this package focuses on Beyer et al 2020, a reconstruction | ||
of climate based on the HadCM3 model for the last 120k years, and Krapp et al | ||
2021, covering the last 800k years. The reconstructions | ||
are bias-corrected and downscaled to 0.5 degree, and this package helps using | ||
these data for ecological and archaeological studies. | ||
Description: This R package is designed to provide an easy way to extract and manipulate paleoclimate | ||
reconstructions for ecological and anthropological analyses. | ||
License: CC BY 4.0 | ||
URL: https://github.com/EvolEcolGroup/pastclim, | ||
https://evolecolgroup.github.io/pastclim/ | ||
BugReports: https://github.com/EvolEcolGroup/pastclim/issues | ||
Encoding: UTF-8 | ||
LazyData: true | ||
LazyDataCompression: xz | ||
RoxygenNote: 7.1.2 | ||
RoxygenNote: 7.2.1 | ||
Depends: | ||
R (>= 3.5.0) | ||
R (>= 4.0.0) | ||
Imports: | ||
curl, | ||
ncdf4, | ||
terra | ||
terra, | ||
utils | ||
Suggests: | ||
rmarkdown, | ||
knitr, | ||
pastclimData, | ||
sf, | ||
testthat (>= 3.0.0) | ||
Remotes: | ||
EvolEcolGroup/pastclimData | ||
rmarkdown, | ||
knitr, | ||
sf, | ||
testthat (>= 3.0.0) | ||
VignetteBuilder: knitr | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(check_dataset_path) | ||
export(climate_for_locations) | ||
export(climate_for_time_slice) | ||
export(df_from_region_series) | ||
export(df_from_region_slice) | ||
export(download_dataset) | ||
export(get_available_datasets) | ||
export(get_biome_classes) | ||
export(get_data_path) | ||
export(get_downloaded_datasets) | ||
export(get_ice_mask) | ||
export(get_land_mask) | ||
export(get_mis_time_steps) | ||
export(get_pastclimdata_path) | ||
export(get_time_steps) | ||
export(get_vars_for_dataset) | ||
export(is_region_series) | ||
export(location_series) | ||
export(location_slice) | ||
export(region_series) | ||
export(region_slice) | ||
export(sample_region_series) | ||
export(sample_region_slice) | ||
export(set_data_path) | ||
export(slice_region_series) | ||
export(time_series_for_locations) | ||
import(terra) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# pastclim 1.1.0 | ||
|
||
* Expand functionality to handle time series for regions; rename functions to | ||
extract data for regions and locations to make them consistent. Old code will | ||
still work, but will raise a warning that the functions are deprecated. | ||
|
||
* Remove the need for `pastclimData`, we now put any data in the user dir returned | ||
by R>=4.0.0. This removes the need of re-downloading the data when upgrading R. | ||
|
||
* Add monthly variables to Beyer2020 and Krapp2021. | ||
|
||
# pastclim 1.0.1 | ||
|
||
* Fix bug when information was extracted for just one location. | ||
|
||
# pastclim 1.0.0 | ||
|
||
* Initial public release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#' Check if dataset is available. | ||
#' | ||
#' Internal getter function | ||
#' | ||
#' @param dataset string defining dataset | ||
#' @param include_custom boolean whether a 'custom' dataset is allowed | ||
#' | ||
#' @keywords internal | ||
|
||
|
||
check_available_dataset <- function(dataset, include_custom = FALSE) { | ||
available_datasets <- get_available_datasets() | ||
if (include_custom) { | ||
available_datasets <- c(available_datasets, "custom") | ||
} | ||
if (!dataset %in% available_datasets) { | ||
stop("'dataset' must be one of ", paste(available_datasets, | ||
collapse = ", " | ||
)) | ||
} else { | ||
return(TRUE) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' Check dataset and path_to_nc params. | ||
#' | ||
#' Check that the dataset and path_to_nc parameters are valid | ||
#' | ||
#' @param dataset string defining the dataset to use. If set to "custom", | ||
#' then a single nc file is used from "path_to_nc" | ||
#' @param path_to_nc the path to the custom nc file containing the paleoclimate | ||
#' reconstructions. All the variables of interest need to be included in | ||
#' this file. | ||
#' | ||
#' @export | ||
|
||
|
||
check_dataset_path <- function(dataset, path_to_nc) { | ||
check_available_dataset(dataset = dataset, include_custom = TRUE) | ||
|
||
if (all(dataset == "custom", is.null(path_to_nc))) { | ||
stop("you need to set path_to_nc if dataset='custom'") | ||
} | ||
# check that we are only given path_to_nc if we use a custom dataset | ||
if (!is.null(path_to_nc)) { | ||
if (dataset != "custom") { | ||
stop("path_to_nc can only be set if dataset=='custom'") | ||
} | ||
if (!file.exists(path_to_nc)) { | ||
stop("path_to_nc does not point to a file") | ||
} | ||
} | ||
return(TRUE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' Internal functions to check whether we have downloaded a given variable | ||
#' for a dataset | ||
#' | ||
#' @param variable a vector of names of the variables of interest | ||
#' @param dataset dataset of interest | ||
#' | ||
#' @keywords internal | ||
|
||
check_var_downloaded <- function(variable, dataset) { | ||
# first check the variable exists for that dataset | ||
check_available_variable(variable, dataset) | ||
|
||
# test if we have downloaded already | ||
if (!all(variable %in% get_downloaded_datasets() | ||
[[dataset]])) { | ||
missing_vars <- variable[!variable %in% | ||
get_downloaded_datasets()[[dataset]]] | ||
stop( | ||
"variable (", paste(missing_vars, collapse = ", "), | ||
") not yet downloaded, use `download_dataset()`" | ||
) | ||
} | ||
return(TRUE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.