wind speed and air temperature profile function

96 views
Skip to first unread message

NicheMapR

unread,
Sep 7, 2024, 10:08:45 AM9/7/24
to NicheMapR
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)

Zhong-Wen Jiang

unread,
Oct 27, 2025, 10:52:22 PM10/27/25
to NicheMapR
Hi Mike and everyone,

I’m trying to use the get_profile function to obtain wind speed, air temperature, and other parameters at high altitudes for species flight analysis. Do you think this function is suitable for that purpose?

However, when I run the code below, I only see wind speed varying with height, while air temperature and relative humidity remain constant.

loc <- c(133.8779, -23.6987) # Alice Springs, Australia
Usrhyt <- 1.2 # height of midpoint of animal, m; need to change the height
micro <- micro_global(loc = loc, Usrhyt = Usrhyt) # run the model with specified location and animal height
metout <- as.data.frame(micro$metout) # above ground microclimatic conditions, min shade
soil <- as.data.frame(micro$soil) # soil temperatures, minimum shade


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(5, 10, 20,50,100) # 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 = 0.004,

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


profile.out1
    heights      VELs      TAs       RHs       QCONV      USTAR
1       0.0 0.0000000 19.26493 35.064694   19.919836 0.10377323
2       1.2 1.4806131 21.68502 30.200000   19.919836 0.10377323
3       5.0 1.8340447 21.68502 30.200000   19.919836 0.10377323
4      10.0 2.0350000 21.68502 30.200000   19.919836 0.10377323
5      20.0 2.2579739 21.68502 30.200000   19.919836 0.10377323
6      50.0 2.5906570 21.68502 30.200000   19.919836 0.10377323
7     100.0 2.8745139 21.68502 30.200000   19.919836 0.10377323
8       0.0 0.0000000 19.26493 37.380736   15.585540 0.08383979
9       1.2 1.1962073 21.51907 32.523239   15.585540 0.08383979
10      5.0 1.4817494 21.51907 32.523239   15.585540 0.08383979
11     10.0 1.6441039 21.51907 32.523239   15.585540 0.08383979
12     20.0 1.8242475 21.51907 32.523239   15.585540 0.08383979
13     50.0 2.0930266 21.51907 32.523239   15.585540 0.08383979
14    100.0 2.3223585 21.51907 32.523239   15.585540 0.08383979
15      0.0 0.0000000 18.80236 40.907678   14.313209 0.06390635
16      1.2 0.9118014 21.39333 34.846479   14.313209 0.06390635
17      5.0 1.1294541 21.39333 34.846479   14.313209 0.06390635
18     10.0 1.2532078 21.39333 34.846479   14.313209 0.06390635
19     20.0 1.3905211 21.39333 34.846479   14.313209 0.06390635
20     50.0 1.5953963 21.39333 34.846479   14.313209 0.06390635
21    100.0 1.7702030 21.39333 34.846479   14.313209 0.06390635
22      0.0 0.0000000 18.38205 44.537807   11.754154 0.04397291
23      1.2 0.6273956 21.29805 37.169718   11.754154 0.04397291
24      5.0 0.7771588 21.29805 37.169718   11.754154 0.04397291
25     10.0 0.8623117 21.29805 37.169718   11.754154 0.04397291
26     20.0 0.9567947 21.29805 37.169718   11.754154 0.04397291
27     50.0 1.0977660 21.29805 37.169718   11.754154 0.04397291
28    100.0 1.2180476 21.29805 37.169718   11.754154 0.04397291

Best wishes,
Zhong-Wen

NicheMapR

unread,
Oct 28, 2025, 2:12:06 AM10/28/25
to NicheMapR
Hi Zhong-Wen,

It's because you're asking for values above 1 m. Note that you're extrapolating here because the reference height is 1.2 m. Wind speed should keep increasing above 1.2 m but air temperature (and relative humidity, given the change in air temperature - note the assumption is that the absolute humidity stays constant) won't change.

All the best,
Mike
Reply all
Reply to author
Forward
0 new messages