Skip to content

Commit 8c31a0a

Browse files
authored
Merge pull request #331 from r-spatialecology/main
landscapemetrics v2.1.4
2 parents a77e718 + caaed12 commit 8c31a0a

File tree

8 files changed

+32
-6
lines changed

8 files changed

+32
-6
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: landscapemetrics
33
Title: Landscape Metrics for Categorical Map Patterns
4-
Version: 2.1.3
4+
Version: 2.1.4
55
Authors@R: c(person("Maximilian H.K.", "Hesselbarth",
66
role = c("aut", "cre"),
77
email = "[email protected]",
@@ -76,5 +76,5 @@ Encoding: UTF-8
7676
LazyData: true
7777
Config/testthat/edition: 3
7878
Roxygen: list(markdown = TRUE)
79-
RoxygenNote: 7.3.1
79+
RoxygenNote: 7.3.2
8080
VignetteBuilder: knitr

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(landscape_as_list,PackedSpatRaster)
34
S3method(landscape_as_list,RasterBrick)
45
S3method(landscape_as_list,RasterLayer)
56
S3method(landscape_as_list,RasterStack)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# landscapemetrics 2.1.4
2+
* Various
3+
* Adding `landscape_as_list()` method for `PackedSpatRaster`
4+
15
# landscapemetrics 2.1.3
26
* Bugfixes
37
* Fixed bug in `get_centroids()` related to the patch id

R/landscape_as_list.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ landscape_as_list <- function(landscape) UseMethod("landscape_as_list")
1818
#' @name landscape_as_list
1919
#' @export
2020
landscape_as_list.SpatRaster <- function(landscape) {
21+
2122
landscape <- terra::as.list(landscape)
2223

2324
return(landscape)
@@ -87,3 +88,16 @@ landscape_as_list.numeric <- function(landscape) {
8788

8889
return(landscape)
8990
}
91+
92+
#' @name landscape_as_list
93+
#' @export
94+
landscape_as_list.PackedSpatRaster <- function(landscape) {
95+
96+
landscape <- terra::unwrap(landscape)
97+
landscape <- terra::as.list(landscape)
98+
99+
warning("Unwrapped Packed* input object.", call. = FALSE)
100+
101+
return(landscape)
102+
103+
}

codemeta.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"codeRepository": "https://r-spatialecology.github.io/landscapemetrics/",
88
"issueTracker": "https://github.com/r-spatialecology/landscapemetrics/issues",
99
"license": "https://spdx.org/licenses/GPL-3.0",
10-
"version": "2.1.3",
10+
"version": "2.1.4",
1111
"programmingLanguage": {
1212
"@type": "ComputerLanguage",
1313
"name": "R",
1414
"url": "https://r-project.org"
1515
},
16-
"runtimePlatform": "R version 4.4.0 (2024-04-24)",
16+
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
1717
"provider": {
1818
"@id": "https://cran.r-project.org",
1919
"@type": "Organization",
@@ -303,7 +303,7 @@
303303
},
304304
"SystemRequirements": null
305305
},
306-
"fileSize": "1743.581KB",
306+
"fileSize": "1746.291KB",
307307
"citation": [
308308
{
309309
"@type": "ScholarlyArticle",

cran-comments.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# landscapemetrics 2.1.4
2+
Minor feature improvments
3+
14
# landscapemetrics 2.1.3
2-
* Improve documentation and minor bugfixes
35
* This is a re-submission. The below error has now been fixed
46
`Please provide package anchors for all Rd \link{} targets`
7+
* Improve documentation and minor bugfixes
58

69
# landscapemetrics 2.1.2
710
Minor bugfixes

man/landscape_as_list.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-landscape_as_list.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ test_that("landscape_as_list returns a list", {
33
expect_type(landscape_as_list(landscape_stack), "list")
44
expect_type(landscape_as_list(landscape_list), "list")
55
expect_type(landscape_as_list(landscape_matrix), "list")
6+
expect_type(landscape_as_list(terra::wrap(landscape)), "list")
67

78
})

0 commit comments

Comments
 (0)