Stochastic Weather Generator (WGEN)
WGEN is the stochastic algorithm underneath R-THYM's weather generator -- it manufactures one statistically realistic value per day (rain or no rain, how much, high/low temperature) from a handful of monthly statistics, instead of replaying one historical record.
WGEN only produces the daily sequence. R-THYM uses it as the foundation for CLIGEN, which takes WGEN's daily totals and breaks each wet day into sub-daily storm bursts (down to 1-minute resolution) -- see Stochastic Weather Generator (CLIGEN) for how to configure and run it.
How It's Programmed
WGEN follows the method of Richardson & Wright (1984), the same approach used by USDA's CLIGEN and similar agricultural weather generators. Each simulated day is built in three stages:
1. Wet or dry?
Rather than treating each day independently, WGEN uses a two-state Markov chain -- today's chance of rain depends on whether yesterday was wet or dry:
P(wet | yesterday wet) = PWW P(wet | yesterday dry) = PWD
PWW and PWD are set per month, so the model can capture a location's actual rainfall persistence (e.g. wet spells that tend to run several days in a row during a stormy season) rather than assuming every day is a fresh coin flip.
2. How much rain, if wet?
On a wet day, the storm depth is drawn from a gamma distribution:
depth ~ Gamma(α, β)
with shape α and scale β set per month. The gamma distribution is the standard choice for daily rainfall because it naturally produces mostly-small storms with an occasional large one -- the skew real rainfall records show -- rather than a bell curve that would make big storms too rare or small storms too large.
3. Temperature
Daily high and low temperature follow a smooth seasonal cycle (a cosine curve peaking in summer) plus day-to-day random scatter, with two refinements:
- Wet days run cooler. The mean daily high is lower on wet days than dry days (clouds and rain measurably suppress daytime heating), using separate monthly mean/variability inputs for wet vs. dry days.
- Optional correction to known monthly averages. If you have independent monthly temperature records for the site, WGEN can nudge its generated temperatures so their monthly averages match those records, while keeping the day-to-day variability WGEN itself produces.
Where You'll See This
WGEN isn't configured on its own -- its monthly inputs (PWW, PWD, Alpha, Beta, and the temperature harmonics) are entered as part of the same dialog used for sub-daily time stepping, in Data → CLIGEN Parameters.... See Stochastic Weather Generator (CLIGEN) for a walkthrough of that dialog, including a screen capture.
If you instead want a single synthetic design event rather than a multi-year stochastic record, use Data → Design Storm... -- see Design Storm.