Skip to content

Commit 0d326ba

Browse files
committed
Merge branch 'development' of https://github.com/USDAForestService/ForestVegetationSimulator-Interface into open_staging
2 parents 83b9f48 + d3a605c commit 0d326ba

17 files changed

Lines changed: 2913 additions & 597 deletions

fvsOL/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: fvsOL
22
Title: Forest Vegetation Simulator
3-
Version: 2025.09.30
3+
Version: 2026.04.01
44
Authors@R: c(person("Nicholas", "Crookston", email = "ncrookston.fs@gmail.com",
55
role = c("aut")),
66
person("FVS", "Staff", email = "sm.fs.fvs-support@usda.gov",

fvsOL/R/change_project_dir.R

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,42 @@ change_project_dir <- function(new_proj_dir) {
9393
cat("cmd for launch project=", cmd, "\nrtn=", rtn, "\n")
9494
}
9595
}
96+
}
97+
98+
getVolumes2 <- function(exclude) {
99+
if (missing(exclude)) exclude <- NULL
100+
101+
function() {
102+
osSystem <- Sys.info()["sysname"]
103+
if (osSystem == "Darwin") {
104+
volumes <- dir_ls("/Volumes")
105+
names(volumes) <- basename(volumes)
106+
} else if (osSystem == "Linux") {
107+
volumes <- c("Computer" = "/")
108+
if (isTRUE(dir_exists("/media"))) {
109+
media <- dir_ls("/media")
110+
names(media) <- basename(media)
111+
volumes <- c(volumes, media)
112+
}
113+
} else if (osSystem == "Windows") {
114+
volumes_info <- system2("powershell", "$dvr=[System.IO.DriveInfo]::GetDrives();Write-Output $dvr.length $dvr.name $dvr.VolumeLabel;", stdout = TRUE)
115+
num = as.integer(volumes_info[1])
116+
if(num == 0) return(NULL)
117+
mat <- matrix(volumes_info[-1], nrow = num, ncol = 2)
118+
mat[, 1] <- gsub(":\\\\$", ":/", mat[, 1])
119+
sel <- mat[, 2] == ""
120+
mat[sel, 2] <- mat[sel, 1]
121+
volumes <- mat[, 1]
122+
volNames <- mat[, 2]
123+
volNames <- paste0(volNames, " (", gsub(":/$", ":", volumes), ")")
124+
names(volumes) <- volNames
125+
volumes <- gsub(":$", ":/", volumes)
126+
} else {
127+
stop("unsupported OS")
128+
}
129+
if (!is.null(exclude)) {
130+
volumes <- volumes[!names(volumes) %in% exclude]
131+
}
132+
volumes
133+
}
96134
}

fvsOL/R/fvsRunUtilities.R

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ loadStandTableData <- function (globals, dbIcon)
1313

1414
loadVarData <- function(globals,input,dbIcon)
1515
isolate({
16-
cat ("in loadVarData, input$inTabs=",input$inTabs," globals$activeVariants=",globals$activeVariants,"\n")
16+
cat ("in loadVarData, input$inTabs=",input$inTabs," globals$activeVariants=",globals$activeVariants,"\n")
1717
dbtabs = dbGetQuery(dbIcon,"select name from sqlite_master where type='table';")[,1]
1818
dbtabsU = toupper(dbtabs)
1919
intab = if (is.null(input$inTabs)) toupper("FVS_StandInit") else toupper(input$inTabs)
@@ -169,17 +169,17 @@ cat("findCmp, cmp=",cmp,"\n")
169169
}
170170

171171

172-
mkSimCnts <- function (fvsRun,sels=NULL,foundStand=0L,justGrps=FALSE)
172+
mkSimCnts <- function(fvsRun,sels=NULL,foundStand=0L,justGrps=FALSE)
173173
{
174174
tmpcnts = list()
175-
tmptags = list()
175+
tmptags = list()
176176
if (!is.null(sels)) if (length(sels) == 0) sels = NULL
177-
if (!is.null(sels)) if (length(sels) && is.null(sels[[1]])) sels = NULL
178-
if (justGrps)
177+
if (!is.null(sels)) if (length(sels) && is.null(sels[[1]])) sels = NULL
178+
if (justGrps)
179179
{
180180
start=1
181181
end=0
182-
for (grp in fvsRun$grps)
182+
for (grp in fvsRun$grps)
183183
{
184184
end=end+1+length(grp$cmps)
185185
tmpcnts <- append(tmpcnts,paste(">",grp$grp))
@@ -382,6 +382,8 @@ resetActiveFVS <- function(globals)
382382
"climate", "econ", "wrd3", "phewrd3", "armwrd3", "ardwrd3"),
383383
FVSem = c("em", "estb", "dbs", "cover", "mist", "fire", "climate",
384384
"econ", "wrd3", "phewrd3", "armwrd3", "ardwrd3" ),
385+
FVShi = c("hi", "strp", "dbs", "mist", "fire", "econ", "climate",
386+
"cover", "wrd3", "armwrd3", "phewrd3", "ardwrd3"),
385387
FVSie = c("ie", "estb", "dbs", "cover", "mist", "fire", "climate",
386388
"econ", "wrd3", "armwrd3", "phewrd3", "ardwrd3"),
387389
FVSkt = c("kt", "estb", "dbs", "cover", "mist", "fire", "climate",
@@ -436,6 +438,7 @@ cat ("in resetActiveFVS, avalFVS=",avalFVS,"\nglobals$lastRunVar=",globals$lastR
436438
"ut: Utah"="ut",
437439
"wc: West Cascades"="wc",
438440
"pn: Pacific Northwest Coast"="pn",
441+
"hi: Hawaii (modified Pacific Northwest Coast)"="hi",
439442
"ws: Western Sierra Nevada,CA"="ws",
440443
"cs: Central States"="cs",
441444
"kt: Kootenai/Kaniksu/Tally LK,ID - MT"="kt",
@@ -717,8 +720,7 @@ mkMgmtCats <- function(globals)
717720
"Seedtree" = "SeedTreeWin",
718721
"Shelterwood" = "ShelterwoodWin"),
719722
"Regeneration Methods: Uneven-aged"=c(
720-
"Thin to a Q-factor" = "uneven-aged_Q",
721-
"Group Selection, Distance-independent" = "uneven-aged_grp_select"),
723+
"Thin to a Q-factor" = "uneven-aged_Q"),
722724
"Thinning & Pruning Operations"=c(
723725
"Thin from below" = "ThinFromBelowWin",
724726
"Thin from above" = "ThinFromAboveWin",
@@ -1936,3 +1938,17 @@ DupSpGrpKwdFormat <- function(orgName, dupName, orgKwd){
19361938

19371939
return(replacementkwd)
19381940
}
1941+
1942+
initializeUserGroups <- function(glbs){
1943+
for(i in glbs$fvsRun$simcnts){
1944+
cmp <- findCmp(glbs$fvsRun, i)
1945+
if(!is.null(cmp) &&
1946+
(cmp$kwdName == "GenGroup")){
1947+
if(!length(glbs$GrpNum)) glbs$GrpNum[1] <- 1 else
1948+
glbs$GrpNum[(length(glbs$GrpNum)+1)] <- length(glbs$GrpNum)+1
1949+
glbs$GenGrp[length(glbs$GrpNum)]<-cmp$title
1950+
cat("Found Group\n")
1951+
cat(paste(i,"\n"))
1952+
}
1953+
}
1954+
}

fvsOL/R/mkInputElements.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ mkSelForest <- function (pkey,prms,pmt,fpvs,choices,globals)
179179
fors[1]="blank"
180180
myInlineListButton (pkey, pmt, fors, selected = if (is.null(fpvs)) choices else fpvs, NULL)
181181
}
182-
183-
184-
mkSelSpecies <- function (pkey,prms,pmt,fpvs,choices,globals)
185-
{
182+
183+
184+
mkSelSpecies <- function(pkey,prms,pmt,fpvs,choices,globals)
185+
{
186186
variant <- globals$activeVariants[1]
187187
spGrp <- as.numeric()
188188
spkeys <- prms[[paste0("species_",variant)]]
@@ -389,7 +389,7 @@ myInlineListButton <- function (inputId, label, mklist, selected=NULL, deltll)
389389
# all dropdowns where a blank is not allowed (no deleteAll pkey)
390390
# applies to most keywords, and when editing previously saved selections (deltll==2).
391391
# Remove duplicate SpGroup names in species dropdowns due to cut/paste
392-
if(names(mklist[1])=="All species"){
392+
if(!is.null(names(mklist[1])) && names(mklist[1])=="All species"){
393393
spgsidxs <- grep("SpGroup", names(mklist))
394394
spgs <- mklist[spgsidxs]
395395
if(length(spgsidxs) > 1 && length(spgs)!=length(unique(spgs))){
@@ -491,6 +491,7 @@ mkVarList <- function (globals)
491491
"BNumSS: Before thin number of valid strata (StrClass keyword required)"="BNumSS",
492492
"BRDen: Before thin relative density (Curtis 1982)"="BRDen",
493493
"BRDen2: Before thin relative density, SILVAH (Marquis and Ernst 1992)"="BRDen2",
494+
"BGMD: Before thin generalized mean diameter"="BGMD",
494495
"BSClass: Before thin stand structural classification (StrClass keyword required)"="BSClass",
495496
"BSawBio: Before thin sawlog biomass" = "BSawBio",
496497
"BSawCrb: Before thin sawlog carbon" = "BSawCrb",
@@ -546,6 +547,7 @@ mkVarList <- function (globals)
546547
"ANumSS: After thin number of valid strata (StrClass keyword required)"="ANumSS",
547548
"ARDEN: After thin relative density (Curtis 1982)"="ARDEN",
548549
"ARDen2: After thin relative density, SILVAH (Marquis and Ernst 1992)"="ARDen2",
550+
"AGMD: After thin generalized mean diameter"="AGMD",
549551
"ASClass: After thin stand structural classification (StrClass keyword required)"="ASClass",
550552
"ASawBio: After thin sawlog biomass" = "ASawBio",
551553
"ASawCrb: After thin sawlog carbon" = "ASawCrb",

0 commit comments

Comments
 (0)