Skip to content
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
merged 15 commits into from
Oct 3, 2023

Conversation

brownag
Copy link
Member

@brownag brownag commented Jul 12, 2022

  • Newhall model gains support for additional spatially explicit inputs:

    • O horizon (presence/absence)
    • Saturation (presence/absence)
    • soilAirOffset (degrees C or degrees F)
  • Cryic Soil Temperature Regime criteria now properly incorporate O horizon and saturation into thresholds


DRAFT PR for discussion and testing of changes to cryic/frigid determination in BASICSimulationModel

  • it appears one of the cryic criteria was misinterpreted at some point, will try to translate it literally and see if results change
  • as background (more to come on this) climate simulations run in the Sierra Nevada anecdotally skip from mesic directly to cryic. Need to evaluate which of the criteria are triggering this.
  • May fuel some future proposals for clarifying how to apply cryic criteria 1a and 1b on p.31 in KST (12th edition)

@brownag brownag linked an issue Sep 19, 2022 that may be closed by this pull request
3 tasks
@brownag brownag force-pushed the frigidCrit branch 4 times, most recently from 13ca92f to a04dea8 Compare July 23, 2023 05:16
brownag and others added 5 commits July 22, 2023 22:32
…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
@brownag brownag marked this pull request as ready for review October 2, 2023 02:04
@brownag
Copy link
Member Author

brownag commented Oct 2, 2023

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")

@brownag brownag merged commit d751ed4 into main Oct 3, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saturated conditions, O horizon presence/absence
1 participant