-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
bd2f69f
commit 45fed5f
Showing
3 changed files
with
94 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
library(akgfmaps) | ||
library(MultiscaleDTM) | ||
|
||
# 2023 Review: Queen case (3x3 neighborhood) for deriving seafloor terrain | ||
neighbors <- 8 | ||
bpi_w = c(3, 64) # 2023 Review: AI and GOA Radius 3 x 65; EBS radius 3 x 64 | ||
|
||
x <- terra::rast(here::here("output", "efh_bathy", "efh_bathy_1km.tif")) | ||
|
||
# SLOPE using terra ---- | ||
start1 <- Sys.time() | ||
slope_t <- terra::terrain(x = x, | ||
v = "slope", | ||
unit = "degrees", | ||
neighbors = neighbors) | ||
|
||
# MultiscaleDTM: SLOPE (degrees), EASTNESS, AND NORTHNESS | ||
# Queen case with window = 5 | ||
slope_aspect_dtm <- MultiscaleDTM::SlpAsp(r = x, | ||
unit = "degrees", # Output units | ||
w = c(5, 5), | ||
method = "queen", | ||
metrics = c("slope", "eastness", "northness"), | ||
na.rm = TRUE) | ||
|
||
# MultiscaleDTM: MEAN CURVATURE, PROFILE CURVATURE, SLOPE | ||
# Derived from quadratic fit using OLS | ||
curvature_slope_dtm <- MultiscaleDTM::Qfit(r = x, | ||
unit = "degrees", # Output units | ||
w = c(5, 5), | ||
metrics = c("meanc", "profc", "qslope"), | ||
na.rm = TRUE) | ||
|
||
# MultiscaleDTM: BATHYMETRIC POSITION INDEX (BPI) ---- | ||
start1 <- Sys.time() | ||
bpi_dtm <- MultiscaleDTM::BPI(r = x, | ||
w = bpi_w, | ||
unit = "cell", # Units for window | ||
stand = "none", | ||
na.rm = TRUE | ||
) | ||
|
||
end1 <- Sys.time() | ||
difftime(end1, start1) | ||
|
||
|
||
# Test 100-m resolution | ||
|
||
x_100 <- terra::rast(here::here("output", "efh_bathy", "efh_bathy_100m.tif")) | ||
|
||
# SLOPE using terra ---- | ||
start2 <- Sys.time() | ||
slope_t <- terra::terrain(x = x_100, | ||
v = "slope", | ||
unit = "degrees", | ||
neighbors = neighbors) | ||
|
||
# MultiscaleDTM: SLOPE (degrees), EASTNESS, AND NORTHNESS | ||
# Queen case with window = 5 | ||
slope_aspect_dtm <- MultiscaleDTM::SlpAsp(r = x_100, | ||
unit = "degrees", # Output units | ||
w = c(5, 5), | ||
method = "queen", | ||
metrics = c("slope", "eastness", "northness"), | ||
na.rm = TRUE) | ||
|
||
# MultiscaleDTM: MEAN CURVATURE, PROFILE CURVATURE, SLOPE | ||
# Derived from quadratic fit using OLS | ||
curvature_slope_dtm <- MultiscaleDTM::Qfit(r = x_100, | ||
unit = "degrees", # Output units | ||
w = c(5, 5), | ||
metrics = c("meanc", "profc", "qslope"), | ||
na.rm = TRUE) | ||
diff(Sys.time(), start2) | ||
|
||
# MultiscaleDTM: BATHYMETRIC POSITION INDEX (BPI) ---- | ||
start1 <- Sys.time() | ||
bpi_dtm <- MultiscaleDTM::BPI(r = x_100, | ||
w = bpi_w, | ||
unit = "cell", # Units for window | ||
stand = "none", | ||
na.rm = TRUE | ||
) | ||
|
||
end2 <- Sys.time() | ||
difftime(end2, start2) |
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
File renamed without changes.