> For the complete documentation index, see [llms.txt](https://swatplus.gitbook.io/io-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swatplus.gitbook.io/io-docs/theoretical-documentation/section-1-climate/chapter-1-3-weather-generator/1-3.5-relative-humidity/1-3.5.2-generated-daily-value.md).

# 1:3.5.2 Generated Daily Value

The triangular distribution used to generate daily relative humidity values requires four inputs: mean monthly relative humidity, maximum relative humidity value allowed in month, minimum relative humidity value allowed in month, and a random number between 0.0 and 1.0.&#x20;

&#x20;The maximum relative humidity value, or upper limit of the triangular distribution, is calculated from the mean monthly relative humidity with the equation:

$$R\_{hUmon}=R\_{hmon}+(1-R\_{hmon})\*exp(R\_{hmon}-1)$$                                                                              1:3.5.4

where $$R\_{hUmon}$$ is the largest relative humidity value that can be generated on a given day in the month, and $$R\_{hmon}$$ is the average relative humidity for the month.

The minimum relative humidity value, or lower limit of the triangular distribution, is calculated from the mean monthly relative humidity with the equation:

$$R\_{hLmon}=R\_{hmon}\*(1-exp(-R\_{hmon}))$$                                                                                                      1:3.5.5

where $$R\_{hLmon}$$ is the smallest relative humidity value that can be generated on a given day in the month, and $$R\_{hmon}$$ is the average relative humidity for the month.

The triangular distribution uses one of two sets of equations to generate a relative humidity value for the day. If $$rnd\_1 \le (\frac{R\_{hmon}-R\_{hLmon}}{R\_{hUmon}-R\_{hLmon}})$$ then

$$R\_h=R\_{hmon}*\frac{R\_{hLmon}+\[rnd\_1*(R\_{hUmon}-R\_{hLmon})\*(R\_{hmon}-R\_{hLmon})]^{0.5}}{R\_{hmon,mean}}$$                                                                    1:3.5.6

If   $$rnd\_1>(\frac{R\_{hmon}-R\_{hLmon}}{R\_{hUmon}-R\_{hLmon}})$$ then&#x20;

$$R\_h=R\_{hmon}*\frac{R\_{hUmon}-(R\_{hUmon}-R\_{hmon})*\[\frac{R\_{hUmon}(1-rnd\_1)-R\_{hLmon}(1-rnd\_1)}{R\_{hUmon}-R\_{hmon}}]^{0.5}}{R\_{hmon,mean}}$$                                                            1:3.5.7

where $$R\_h$$ is the average relative humidity calculated for the day, $$rnd\_1$$ is a random number generated by the model each day, $$R\_{hmon}$$ is the average relative humidity for the month, $$R\_{hLmon}$$ is the smallest relative humidity value that can be generated on a given day in the month, $$R\_{hUmon}$$ is the largest relative humidity value that can be generated on a given day in the month, and $$R\_{hmon,mean}$$ is the mean of $$R\_{hLmon},R\_{hmon},$$ and $$R\_{hUmon}$$.             &#x20;
