Dear NicheMapR users,
I just pushed a new function to github called get_profile that you can use to get wind speeds, air temperatures and relative humidities at heights other than the one specified in the microclimate model via the 'Usrhyt' argument. This might be useful if you're simulating an organism that changes height in subtle ways, or as it grows, or if you're considering a multi-part animal where the parts are at different heights (I was motivated to do it for a human model I'm almost finished developing). It also reports the convective heat exchange term for the ground surface, if that's of use to you. Let me know if you find any issues with it. I've pasted an example of how to use it below.
All the best,
Mike
library(NicheMapR)
RUF <- 0.004 # choose a roughness height
micro <- micro_global(RUF = RUF) # run with defaults other than roughness height (Madison, Wisconsin)
dates <- micro$dates # extract mock dates (units of months)
metout <- as.data.frame(micro$metout) # above ground min shade conditions
soil <- as.data.frame(micro$soil) # below ground min shade conditions
newheights <- c(0.1, 0.4) # m, new height needed (can be a single value or a vector of heights)
profile.out <- lapply(1:length(metout$TALOC),
function(x){get_profile(Refhyt = 1.2, # needs to be what micro_global uses as Refhyt
RUF = RUF,
heights = newheights,
TAREF = metout$TAREF[x],
VREF = metout$VREF[x],
RH = metout$RH[x],
D0cm = soil$D0cm[x],
ZEN = metout$ZEN[x])}) # run get_profile across all times at new height
profile.out1 <- do.call("rbind", lapply(profile.out, data.frame)) # turn results into data frame
newheight.out <- subset(profile.out1, heights == newheights[2])
plot(dates, metout$TALOC, ylab = 'air temperature, deg C', type = 'l')
points(dates, profile.out1$TAs[profile.out1$heights == newheights[1]], type = 'l', lty = 2)
points(dates, profile.out1$TAs[profile.out1$heights == newheights[2]], type = 'l', lty = 3)
plot(dates, metout$VLOC, ylab = 'wind speed, m/s', type = 'l', ylim = c(0, 3))
points(dates, profile.out1$VELs[profile.out1$heights == newheights[1]], type = 'l', lty = 2)
points(dates, profile.out1$VELs[profile.out1$heights == newheights[2]], type = 'l', lty = 3)
plot(dates, metout$RHLOC, ylab = 'relative humidity, %', type = 'l', ylim = c(0, 100))
points(dates, profile.out1$RHs[profile.out1$heights == newheights[1]], type = 'l', lty = 2)
points(dates, profile.out1$RHs[profile.out1$heights == newheights[2]], type = 'l', lty = 3)