Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite14f0d1

Browse files
committed
southwest/mu-comparison v4.1.2
1 parentf1c6375 commite14f0d1

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

‎inst/reports/southwest/mu-comparison/changes.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
2025-03-12 (4.1.2): fix for no categorical or circular variables; handle all missing values better in multivariate summary and polygon flagging
12
2025-03-06 (4.1.1): use {sf} package for regular sampling, terra is throwing memory allocation errors related to PROJ/SSL access
23
2025-02-27 (4.1.0): simplify sampling scheme, remove usage of plyr functions
34
2023-12-27 (4.0.3): fixes to run report with no continuous raster inputs

‎inst/reports/southwest/mu-comparison/custom.R‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ abbreviateNames <- function(spdf) {
267267
# return DF with proportions outside range for each polygon (by pID)
268268
flagPolygons<-function(i,p.crit=NULL) {
269269

270+
if (all(is.na(i$value))) {
271+
return(data.frame(pID=numeric(0),prop.outside.range=numeric(0)))
272+
}
273+
270274
# convert to values -> quantiles
271275
e.i<- ecdf(i$value)
272276
q.i<- e.i(i$value)

‎inst/reports/southwest/mu-comparison/report.Rmd‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -354,20 +354,20 @@ if (cache.samples & file.exists('cached-samples.Rda')) {
354354
355355
.do_raster_summary <- function(raster.list, musub) {
356356
e.mu <- terra::as.polygons(terra::ext(musub), crs = terra::crs(musub))
357-
358357
359-
360358
data.table::rbindlist(lapply(raster.list, function(x) {
361-
data.frame(Variable = names(x),
362-
File = unlist(x),
363-
Resolution = sapply(x, function(y) terra::res(terra::rast(y))[1]),
364-
inMemory = FALSE,
365-
ContainsMU = rapply(x, f = function(r) {
366-
r <- terra::rast(r)
367-
e.r <- terra::as.polygons(terra::ext(r), crs = terra::crs(r))
368-
e.mu.r <- terra::project(e.mu, terra::crs(e.r))
369-
return(terra::relate(e.r, e.mu.r, "contains")[1])
370-
}))
359+
if (length(x) > 0) {
360+
data.frame(Variable = names(x),
361+
File = unlist(x),
362+
Resolution = sapply(x, function(y) terra::res(terra::rast(y))[1]),
363+
inMemory = FALSE,
364+
ContainsMU = rapply(x, f = function(r) {
365+
r <- terra::rast(r)
366+
e.r <- terra::as.polygons(terra::ext(r), crs = terra::crs(r))
367+
e.mu.r <- terra::project(e.mu, terra::crs(e.r))
368+
return(terra::relate(e.r, e.mu.r, "contains")[1])
369+
}))
370+
}
371371
}))
372372
}
373373
@@ -706,7 +706,7 @@ d.mu.wide <- na.omit(d.mu.wide)
706706
d.mu.wide.vars <- findSafeVars(d.mu.wide, id = c(mu.col, 'sID', 'pID'))
707707
708708
# must have > 1 variables to perform multivariate summary
709-
if (length(d.mu.wide.vars) < 2) {
709+
if (length(d.mu.wide.vars) < 2 || nrow(d.mu.wide) == 0) {
710710
multivariate.summary <- FALSE
711711
} else {
712712
multivariate.summary <- TRUE

‎inst/reports/southwest/mu-comparison/setup.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## version number
1111

1212
.report.name<-'mu-comparison'
13-
.report.version<-'4.1.1'
13+
.report.version<-'4.1.2'
1414
.report.description<-'compare stack of raster data, sampled from polygons associated with 1-8 map units'
1515

1616
.paths.to.copy<-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp