Skip to content

Commit

Permalink
Merge pull request #186 from r-spatialecology/master
Browse files Browse the repository at this point in the history
Update v1.4.5
  • Loading branch information
mhesselbarth authored Jul 8, 2020
2 parents 8fe4b89 + c0bae69 commit 1bdfa0d
Show file tree
Hide file tree
Showing 41 changed files with 1,279 additions and 657 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# DO NOT CHANGE THE CODE BELOW
before_install:
- sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
- sudo apt-get update -qq
- sudo apt-get install --yes libudunits2-dev libproj-dev libgeos-dev libgdal-dev libgsl0-dev bwidget
- sudo apt-get --yes --force-yes update -qq
- sudo apt-get install --yes libudunits2-dev libproj-dev libgeos-dev libgdal-dev libgsl0-dev bwidget
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- sudo apt-get -qq install gcc
Expand Down Expand Up @@ -34,7 +34,6 @@ after_script: R -q -e 'tic::after_script()'
# Header
language: r
sudo: true
dist: trusty
cache: packages
warnings_are_errors: false

Expand All @@ -47,8 +46,8 @@ env:
notifications:
email:
recipients:
- maximilian.hesselbarth@uni-goettingen.de
on_success: always # default: change
- mhk.hesselbarth@gmail.com
on_success: change # default: change
on_failure: always # default: always

#services
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Before making changes make sure to pull changes in from upstream by doing either
* Push up to your account
* Submit a pull request to home base at `r-spatialecology/landscapemetrics`

### Questions? Get in touch: [[email protected]](mailto:[email protected]) or [maximilian.hesselbarth@uni-goettingen.de](mailto:maximilian.hesselbarth@uni-goettingen.de)
### Questions? Get in touch: [[email protected]](mailto:[email protected]) or [mhk.hesselbarth@gmail.com](mailto:mhk.hesselbarth@gmail.com)

### Thanks for contributing!
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: landscapemetrics
Title: Landscape Metrics for Categorical Map Patterns
Version: 1.4.4
Version: 1.4.5
Authors@R: c(person("Maximillian H.K.", "Hesselbarth",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down Expand Up @@ -77,6 +77,6 @@ ByteCompile: true
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1.9000
SystemRequirements: C++11
VignetteBuilder: knitr
9 changes: 7 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ S3method(get_boundaries,RasterBrick)
S3method(get_boundaries,RasterLayer)
S3method(get_boundaries,RasterStack)
S3method(get_boundaries,list)
S3method(get_boundaries,matrix)
S3method(get_boundaries,stars)
S3method(get_centroids,RasterBrick)
S3method(get_centroids,RasterLayer)
S3method(get_centroids,RasterStack)
S3method(get_centroids,list)
S3method(get_centroids,stars)
S3method(get_circumscribingcircle,RasterBrick)
S3method(get_circumscribingcircle,RasterLayer)
S3method(get_circumscribingcircle,RasterStack)
Expand All @@ -43,7 +47,6 @@ S3method(get_nearestneighbour,RasterBrick)
S3method(get_nearestneighbour,RasterLayer)
S3method(get_nearestneighbour,RasterStack)
S3method(get_nearestneighbour,list)
S3method(get_nearestneighbour,matrix)
S3method(get_nearestneighbour,stars)
S3method(get_patches,RasterBrick)
S3method(get_patches,RasterLayer)
Expand Down Expand Up @@ -783,6 +786,8 @@ export(data_info)
export(extract_lsm)
export(get_adjacencies)
export(get_boundaries)
export(get_boundaries_calc)
export(get_centroids)
export(get_circumscribingcircle)
export(get_nearestneighbour)
export(get_patches)
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# landscapemetrics 1.4.5
* Bugfixes
* Fix of patch id in `get_circumscribingcircle()`
* Improvements
* `lsm_p_gyrate` has an argument to force the cell centroid to be within patch
* `get_nearestneighbour()` can now return ID of neighbouring patch
* `get_boundaries()` allows now to specify edge depth
* `get_boundaries()` can return the patch id for edge cells
* New gunctions
* `get_centroid()` returns the coordinates of each patch centroid

# landscapemetrics 1.4.4
* Improvements
* Set labels = FALSE as default for all plotting functions (messy for larger raster)
Expand Down
4 changes: 4 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ rcpp_get_entropy <- function(x, base = "log2") {
.Call('_landscapemetrics_rcpp_get_entropy', PACKAGE = 'landscapemetrics', x, base)
}

find_min <- function(points, i, m) {
.Call('_landscapemetrics_find_min', PACKAGE = 'landscapemetrics', points, i, m)
}

#' @title First nearest neighbor distance
#'
#' @description Efficiently calculate the distance to the first nearest neighbor.
Expand Down
24 changes: 19 additions & 5 deletions R/calculate_lsm.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
#' @param landscape Raster* Layer, Stack, Brick or a list of rasterLayers.
#' @param level Level of metrics. Either 'patch', 'class' or 'landscape' (or vector with combination).
#' @param metric Abbreviation of metrics (e.g. 'area').
#' @param name Full name of metrics (e.g. 'core area')
#' @param name Full name of metrics (e.g. 'core area').
#' @param type Type according to FRAGSTATS grouping (e.g. 'aggregation metrics').
#' @param what Selected level of metrics: either "patch", "class" or "landscape".
#' It is also possible to specify functions as a vector of strings, e.g. `what = c("lsm_c_ca", "lsm_l_ta")`.
#' @param directions The number of directions in which patches should be
#' connected: 4 (rook's case) or 8 (queen's case).
#' @param count_boundary Include landscape boundary in edge length
#' @param count_boundary Include landscape boundary in edge length.
#' @param consider_boundary Logical if cells that only neighbour the landscape
#' boundary should be considered as core
#' boundary should be considered as core.
#' @param edge_depth Distance (in cells) a cell has the be away from the patch
#' edge to be considered as core cell
#' @param classes_max Potential maximum number of present classes
#' edge to be considered as core cell.
#' @param cell_center If true, the coordinates of the centroid are forced to be
#' a cell center within the patch.
#' @param classes_max Potential maximum number of present classes.
#' @param neighbourhood The number of directions in which cell adjacencies are considered as neighbours:
#' 4 (rook's case) or 8 (queen's case). The default is 4.
#' @param ordered The type of pairs considered. Either ordered (TRUE) or unordered (FALSE).
Expand Down Expand Up @@ -69,6 +71,7 @@ calculate_lsm <- function(landscape,
count_boundary,
consider_boundary,
edge_depth,
cell_center,
classes_max,
neighbourhood,
ordered,
Expand All @@ -89,6 +92,7 @@ calculate_lsm.RasterLayer <- function(landscape,
count_boundary = FALSE,
consider_boundary = FALSE,
edge_depth = 1,
cell_center = FALSE,
classes_max = NULL,
neighbourhood = 4,
ordered = TRUE,
Expand All @@ -108,6 +112,7 @@ calculate_lsm.RasterLayer <- function(landscape,
count_boundary = count_boundary,
consider_boundary = consider_boundary,
edge_depth = edge_depth,
cell_center = cell_center,
classes_max = classes_max,
neighbourhood = neighbourhood,
ordered = ordered,
Expand Down Expand Up @@ -138,6 +143,7 @@ calculate_lsm.RasterStack <- function(landscape,
count_boundary = FALSE,
consider_boundary = FALSE,
edge_depth = 1,
cell_center = FALSE,
classes_max = NULL,
neighbourhood = 4,
ordered = TRUE,
Expand Down Expand Up @@ -165,6 +171,7 @@ calculate_lsm.RasterStack <- function(landscape,
count_boundary = count_boundary,
consider_boundary = consider_boundary,
edge_depth = edge_depth,
cell_center = cell_center,
classes_max = classes_max,
neighbourhood = neighbourhood,
ordered = ordered,
Expand Down Expand Up @@ -198,6 +205,7 @@ calculate_lsm.RasterBrick <- function(landscape,
count_boundary = FALSE,
consider_boundary = FALSE,
edge_depth = 1,
cell_center = FALSE,
classes_max = NULL,
neighbourhood = 4,
ordered = TRUE,
Expand Down Expand Up @@ -225,6 +233,7 @@ calculate_lsm.RasterBrick <- function(landscape,
count_boundary = count_boundary,
consider_boundary = consider_boundary,
edge_depth = edge_depth,
cell_center = cell_center,
classes_max = classes_max,
neighbourhood = neighbourhood,
ordered = ordered,
Expand Down Expand Up @@ -258,6 +267,7 @@ calculate_lsm.stars <- function(landscape,
count_boundary = FALSE,
consider_boundary = FALSE,
edge_depth = 1,
cell_center = FALSE,
classes_max = NULL,
neighbourhood = 4,
ordered = TRUE,
Expand Down Expand Up @@ -285,6 +295,7 @@ calculate_lsm.stars <- function(landscape,
count_boundary = count_boundary,
consider_boundary = consider_boundary,
edge_depth = edge_depth,
cell_center = cell_center,
classes_max = classes_max,
neighbourhood = neighbourhood,
ordered = ordered,
Expand Down Expand Up @@ -319,6 +330,7 @@ calculate_lsm.list <- function(landscape,
count_boundary = FALSE,
consider_boundary = FALSE,
edge_depth = 1,
cell_center = FALSE,
classes_max = NULL,
neighbourhood = 4,
ordered = TRUE,
Expand All @@ -344,6 +356,7 @@ calculate_lsm.list <- function(landscape,
count_boundary = count_boundary,
consider_boundary = consider_boundary,
edge_depth = edge_depth,
cell_center = cell_center,
classes_max = classes_max,
neighbourhood = neighbourhood,
ordered = ordered,
Expand Down Expand Up @@ -375,6 +388,7 @@ calculate_lsm_internal <- function(landscape,
count_boundary,
consider_boundary,
edge_depth,
cell_center,
classes_max,
neighbourhood,
ordered,
Expand Down
Loading

0 comments on commit 1bdfa0d

Please sign in to comment.