-
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.
- Loading branch information
Showing
94 changed files
with
1,048 additions
and
746 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
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
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,3 +1,3 @@ | ||
Version: 1.2.3 | ||
Date: 2022-12-16 08:38:38 UTC | ||
SHA: 81c730879176e3ceecabce36f4cadb05d4286291 | ||
Version: 1.2.4 | ||
Date: 2023-04-25 20:01:34 UTC | ||
SHA: 56d0482f982fd7b991442fd6b8fc62d4168647e3 |
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,7 +1,7 @@ | ||
Package: pastclim | ||
Type: Package | ||
Title: Manipulate Time Series of Palaeoclimate Reconstructions | ||
Version: 1.2.3 | ||
Version: 1.2.4 | ||
Authors@R: c( | ||
person("Michela", "Leonardi", role = "aut"), | ||
person(c("Emily","Y."), "Hallet", role = "ctb"), | ||
|
@@ -13,7 +13,7 @@ Authors@R: c( | |
Maintainer: Andrea Manica <[email protected]> | ||
Description: Methods to easily extract and manipulate palaeoclimate | ||
reconstructions for ecological and anthropological analyses, as described | ||
in Leonardi et al. (2022) <doi:10.1101/2022.05.18.492456>. | ||
in Leonardi et al. (2023) <doi:10.1111/ecog.06481>. | ||
License: CC BY 4.0 | ||
Language: en-GB | ||
URL: https://github.com/EvolEcolGroup/pastclim, | ||
|
@@ -22,19 +22,22 @@ BugReports: https://github.com/EvolEcolGroup/pastclim/issues | |
Encoding: UTF-8 | ||
LazyData: true | ||
LazyDataCompression: xz | ||
RoxygenNote: 7.2.2 | ||
RoxygenNote: 7.2.3 | ||
Roxygen: list(markdown = TRUE) | ||
Depends: | ||
R (>= 4.0.0), | ||
terra (>= 1.6.41) | ||
methods, | ||
terra (>= 1.7.18) | ||
Imports: | ||
curl, | ||
ncdf4, | ||
utils | ||
Suggests: | ||
rmarkdown, | ||
knitr, | ||
sf, | ||
ggplot2, | ||
testthat (>= 3.0.0) | ||
rmarkdown, | ||
knitr, | ||
sf, | ||
ggplot2, | ||
testthat (>= 3.0.0), | ||
spelling | ||
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
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
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
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
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
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
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
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,28 @@ | ||
#' Compute a raster of distances from the sea for each land pixel. | ||
#' | ||
#' Get the land mask for a dataset at a given time point, and compute distance | ||
#' from the sea for each land pixel. | ||
#' | ||
#' @param time_bp time slice in years before present (negative) | ||
#' @param dataset string defining the dataset to use (a list of possible | ||
#' values can be obtained with [get_available_datasets()]). This function | ||
#' will not work on custom datasets. | ||
#' @returns a [`terra::SpatRaster`] of distances | ||
#' | ||
#' @import terra | ||
#' @export | ||
|
||
distance_from_sea <- function(time_bp, dataset) { | ||
this_land_mask <- get_land_mask(time_bp=time_bp, | ||
dataset=dataset) | ||
coastlines_polyline <- terra::as.polygons(this_land_mask) # first get polygon | ||
coastlines_polyline <- terra::as.lines(coastlines_polyline) # then extract line | ||
|
||
distances_rast <- terra::distance(this_land_mask$land_mask, | ||
coastlines_polyline, | ||
unit="km") | ||
distances_rast <- terra::mask(distances_rast, this_land_mask) | ||
names(distances_rast) <- "distance_from_sea" | ||
|
||
return(distances_rast) | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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.