-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BASICSimulationModel: proposed changes to cryic/frigid logic #6
Merged
Conversation
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
3 tasks
3 tasks
brownag
force-pushed
the
frigidCrit
branch
4 times, most recently
from
July 23, 2023 05:16
13ca92f
to
a04dea8
Compare
…d logic - Use `fcd` not `1-fcd` for conversion MSAT->MSST for now, check `cs` expression - check `fcd` and `cs` usage -- make sure that the numerator and denominator of this ratios are correctly converted for different temperatures they may be used with and _documented_ as how they should be calculated - More adjustments - don't correct summer temperature threshold twice - JAR 1.6.4-3: clean and working without O/wet toggle
…amplitude, O horizon and saturation presence absence - Remove JDOM 1.1 from LICENCE; no longer included in source code or used to build jarfile
- misc/newDemo.R add O horizon estimate from canopy cover - fix versioning/batch functions - ensure arguments passed through
library(jNSMR)
#> jNSMR (0.3.0) -- R interface to the classic Newhall Simulation Model
#> Added JAR file (newhall-1.6.5.jar) to Java class path.
library(soilDB)
library(terra)
library(rgeedim)
x <- vect(fetchSDA_spatial(c("CA067", "CA628", "CA731", "CA729", "CA732"),
by.col = "areasymbol",
geom.src = "sapolygon"))
#> Using 1 chunks...
#> Chunk #1 completed (n = 5; 4.2 secs)
#> Done in 5 secs; mean/chunk: 4.2 secs; mean/symbol: 1 secs.
# get PRISM climate and SSURGO-derived available water storage data
predictors <- c(newhall_prism_subset(x), newhall_issr800_subset(x))
# take focal window to smooth/remove NoData in AWC
predictors$awc <- focal(predictors$awc, 5, fun="mean", na.rm=TRUE)
# use Lang et al. (2023) canopy height <https://www.nature.com/articles/s41559-023-02206-6>
gd_initialize()
gd_image_from_id('users/nlang/ETH_GlobalCanopyHeight_2020_10m_v1') |>
gd_download(region = as.polygons(x, ext = TRUE),
bands = list("b1"),
filename="canopy_height.tif",
scale = 100)
#> [1] "canopy_height.tif"
h <- classify(rast("canopy_height.tif"), cbind(NA, 0))
# inspect
plot(h) # assume if canopy is 2x minimum for tree height (4m) there is an O horizon
predictors$hasOHorizon <- project(h, predictors) > 8
plot(predictors$hasOHorizon) # add elevation
gd_image_from_id('USGS/NED') |>
gd_download(region = as.polygons(x, ext = TRUE),
bands = list("elevation"),
filename="elev.tif",
scale = 100)
#> [1] "elev.tif"
e <- rast("elev.tif")
predictors$elev <- project(e, predictors)
# run batches of models on gridded data
res <- newhall_batch(crop(predictors, ext(predictors)), cores=8, core_thresh = 1e5)
#> Batch 1 of 2 (n=99660 on 8 cores) done in 1.3 mins
#> Batch 2 of 2 (n=61152 on 8 cores) done in 40 secs
y <- fetchSDA_spatial(SDA_spatialQuery(predictors, "areasymbol")$areasymbol,
by.col = "areasymbol",
geom.src = "sapolygon")
#> Using 6 chunks...
#> Chunk #1 completed (n = 10; 5.3 secs)
#> Chunk #2 completed (n = 10; 9.4 secs)
#> Chunk #3 completed (n = 10; 3 secs)
#> Chunk #4 completed (n = 10; 5.1 secs)
#> Chunk #5 completed (n = 10; 8.1 secs)
#> Chunk #6 completed (n = 4; 0.3 secs)
#> Done in 32.2 secs; mean/chunk: 5.2 secs; mean/symbol: 0.6 secs.
# inspect one modeled soil taxonomic property
plot(
res$dryDaysAfterSummerSolstice,
main = "dryDaysAfterSummerSolstice",
col = grDevices::hcl.colors(50, "cividis")
)
plot(as.lines(vect(y)), add = TRUE, col = "darkorange") # apply xeric threshold (dry >1.5 months after summer solstice)
plot(
res$dryDaysAfterSummerSolstice > 45,
main = "dryDaysAfterSummerSolstice",
col = grDevices::hcl.colors(2, "cividis")
)
plot(as.lines(vect(y)), add = TRUE, col = "darkorange") plot(res$temperatureRegime,
col = grDevices::hcl.colors(7, "cividis"))
plot(as.lines(vect(y)), add = TRUE, col = "darkorange") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Newhall model gains support for additional spatially explicit inputs:
Cryic Soil Temperature Regime criteria now properly incorporate O horizon and saturation into thresholds
DRAFTPR for discussion and testing of changes to cryic/frigid determination in BASICSimulationModel