Skip to content

Commit

Permalink
Merge pull request DrylandEcology#6 from aestears/main
Browse files Browse the repository at this point in the history
changes AES has made to the grid stdf so far
  • Loading branch information
aestears authored Jun 12, 2024
2 parents 79769ba + 4891211 commit c4c6b84
Show file tree
Hide file tree
Showing 17 changed files with 3,252 additions and 3,204 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ HPC_Files/Outs/
projects/06_TestOutputs/*.csv
projects/07_TestOutputForFRESC/*.zip
projects/07_TestOutputForFRESC/full_netCDFs.zip
./projects/07_TestOutputForFRESC/trimmed_netCDFs.zip
./projects/07_TestOutputForFRESC/trimmed_netCDFs.zip
Main/Data/soilsDB/
6 changes: 3 additions & 3 deletions functions/formatEcologicalIndicatorOutput.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ formatOConnor2020 <- function(Hist_OConnor2020, Future_OConnor2020) {
All <- rbind(Hist_OConnor2020, Future_OConnor2020)

# get stats
Outs <- setDT(All)[, .(sTemp_mean = mean(Lyr_1),
sTemp_CI95 = std(Lyr_1 * 1.96),
Outs <- setDT(All)[, .(sTemp_mean = mean(Lyr_1_avg_C),
sTemp_CI95 = std(Lyr_1_avg_C * 1.96),
SWP_mean = mean(SWP),
SWP_CI95 = std(SWP) * 1.96),
.(Date, TP)]

return(Outs)
}
}
13 changes: 7 additions & 6 deletions functions/getEcologicalIndicatorsInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ getOConnor2020Vars <- function(sTempDF, VWCDF, SoilsDF, TimePeriod,
currDate = currDate) {

# Soil texture values
sand <- as.numeric(SoilsDF[1, 'sand_frac'])/100
clay <- as.numeric(SoilsDF[1, 'clay_frac'])/100
sand <- as.numeric(SoilsDF[1, 'sand_frac'])
clay <- as.numeric(SoilsDF[1, 'clay_frac'])

if(TimePeriod == 'Future') {

Expand Down Expand Up @@ -71,7 +71,7 @@ getOConnor2020Vars <- function(sTempDF, VWCDF, SoilsDF, TimePeriod,
# soil temp: 0 - 5cm, mean and std. error * 1.96
# SWP: 0 -5cm, mean and SE * 1.96
# all days
sTemp_top <- sTempDF[, c('Year', 'Day', 'Lyr_1', 'TP')]
sTemp_top <- sTempDF[, c('Year', 'Day', 'Lyr_1_avg_C', 'TP')] # do we want the average temp? (is basically the same)
sTemp_top <- makeDateMonthDat(sTemp_top, 'Day')
sTemp_top <- sTemp_top[sTemp_top$Date %in% c(paste0('03-0',1:9),paste0('03-',10:31)) ,]

Expand All @@ -81,13 +81,14 @@ getOConnor2020Vars <- function(sTempDF, VWCDF, SoilsDF, TimePeriod,
VWC_top <- makeDateMonthDat(VWC_top, 'Day')
VWC_top <- VWC_top[VWC_top$Date %in% c(paste0('03-0',1:9),paste0('03-',10:31)) ,]

VWC_top$SWP <- rSOILWAT2::VWCtoSWP(VWC_top$value, sand, clay)
VWC_top$SWP <- rSOILWAT2::swrc_vwc_to_swp(vwcBulk = VWC_top$value, sand = sand, clay = clay)
VWC_top$SWP <- ifelse(VWC_top$SWP < -8, -8, VWC_top$SWP)

# statistics taken in format step
vars <- merge(sTemp_top[,c('Date', 'Year', 'TP','Lyr_1')],
vars <- merge(sTemp_top[,c('Date', 'Year', 'TP','Lyr_1_avg_C')],
VWC_top[,c('Date', 'Year', 'TP', 'SWP')], by = c('Year','Date', 'TP'))

return(vars)

}
}

8 changes: 4 additions & 4 deletions functions/getOutputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ getOutputs <- function(sw_out, sw_in, SoilsDF, calc_EcoVars = TRUE,
Shriver2018Vars <- getShriver2018Vars(Data, VWC1)

#OConnor Vars
#Oconnor2020Vars <- getOConnor2020Vars(sTemp, VWC1, SoilsDF, TimePeriod,
# currYear, currDate)
Oconnor2020Vars <- getOConnor2020Vars(sTemp, VWC1, SoilsDF, TimePeriod,
currYear, currDate)

GISSM_1 <- suppressWarnings(rSW2funs::calc_GISSM(
x = sw_out,
Expand Down Expand Up @@ -77,8 +77,8 @@ getOutputs <- function(sw_out, sw_in, SoilsDF, calc_EcoVars = TRUE,
if(!calc_EcoVars) return(list(Data))
if(calc_EcoVars) return(list(Data,
Shriver2018Vars,
data.table(GISSM_1[[1]])))
#Oconnor2020Vars))
data.table(GISSM_1[[1]]),#))
Oconnor2020Vars))

}

Expand Down
Loading

0 comments on commit c4c6b84

Please sign in to comment.