Saturday, 30 April 2011

Online generation of temporal and spatial fractal red noise

It is relatively easy to generate fields with fractal noise using Fourier, wavelet or cascade algorithms (see also my page on cloud generators). However, these noise fields have to be calculated fully before their first use. This can be problematic in case a 2D or 3D spatial field is needed as input to a dynamical model that should also have a temporal fractal structure. Often the number of temporal time steps is so large, that the noise field become impractically large. Therefore, this essay introduces an online method to generate fractal red noise fields, where the new field is calculated from the previous field without the need to know all previous fields; only the current and the new field have to be stored in memory.
The algorithm involves two steps. The spatially correlated red noise is calculated from a white noise field using Fourier filtering. The white noise field evolves temporally correlated by addition of Gaussian noise. In other words, every pixel of the white noise field represents a fractal Brownian noise time series. Fortunately, the spatially correlated noise field retains the fractal nature of the temporal structure of the white noise field.


Spatial noise

In this essay, the spatial noise fields are calculated from white noise fields using a filtering in the Fourier domain. With a fast Fourier transform, the Fourier coefficients of the white noise field are calculated. The magnitudes of the Fourier coefficients, which are on average equal for white noise, are adapted using a power law function of the frequency, E2(f)~f. The phases of the complex Fourier coefficients are not changed. By transforming the Fourier coefficients back to normal space a spatially correlated field is obtained.
In the example shown in Figure 1, the power law exponent (-β) of the power spectrum is -8/3, but any other exponent can probably be chosen to get a rougher or smoother spatial field. Also non-fractal, i.e. non-power-law, functions can be used for the power spectrum. The field has on average about a normally distributed probability density function (PDF), in case the field is not too smooth. In case another pdf is required, one can probably apply the IAAFT algorithm to adapt the PDF of the fields, without changing the structure; see my work on IAAFT cloud fields.
Spatially correlated noise field, click for larger picture
Figure 1. Spatial noise field calculated from a white noise field by adapting the magnitudes of the Fourier coefficients.

Online temporal noise

By integrating white noise, you obtain a correlated time series. This is called Brownian noise in analogy to the random Brownian motion made by small particles in a fluid. The random walk made by these small particles is determined by many small collisions with molecules, our white noise. Its position (the value of our Brownian noise) is the integration of many small collisions.
Rather unpractical for our purposes, Brownian motion is non-stationary; its value diverges. As a workaround, a small bias to the white noise is introduced to force the value of the Brownian noise towards zero. This bias is 1 % of the standard deviation of the white noise. It seems as if this bias does not disturb the fractal structure of the noise too much, see Figures 2 and 3. Only at the smalles scales the time series are a bit too noisy. The PDF of this biased Brownian motion was numerically determined to be an exponential function (y~10-c|x|).
Normally a Brownian time series has a power law power spectrum with exponent -2, in our example the exponent is -1.8. This may be due to the bias, or due to a limited sample size and averaging.

Time series of bias Brownian motion, click to enlarge
Figure 2. Some example time series of the biased Brownian motion. These time series are the values of the pixels of the temporally correlated field.

Average power spectrum of biased Brownian noise time series
Figure 3. Average power spectrum of biased Brownian noise time series.

Putting it all together

The field made with biased Brownian motion is temporally correlated, but spatially white. To acquire a field that is both temporally and spatially correlated, a spatially correlated field in calculated from the white noise field by a filtering in the Fourier domain. The red noise field is a separate field; the white noise field is not altered.
This spatial filtering could potentially disturb the temporal structure of the field. As can be seen in Figures 4 and 5, this seems not to happen. The temporal structure of the spatially correlated field is still fractal. The deviation found in the temporal structure of the white noise field at high frequencies is unexpectedly much reduced or gone. However, the temporal structure did become a bit rougher: the white noise field had a temporal exponent of -1.8, the new red noise field of -1.7. If you have Matlab, you can see the temporal evolution of the white and the red noise field by saving and executing this m-file, which contains the complete commented code.

Example times series of pixels of the red noise field; click to enlarge.
Figure 4. Example times series of pixels of the red noise field to show the evolution of the values with time.

Average temporal power spectrum of time series from the spatially red noise field; click to enlarge.
Figure 5.Average temporal power spectrum of time series from the spatially red noise field.

Conclusions

This essay presented an algorithm to generate spatially and temporally fractal noise fields without the need to store the complete temporal evolution in memory. The structure of the spatial fields can be freely chosen. The temporal structure is fixed by the algorithm.
I would imagine that this algorithm could be useful in many geo-physical applications, for example in the stochastic simulation of rain and clouds, or for the generation of random number for stochastic parameterisations.

Further reading

If you are interested in this topic, you may be interested as well in may work on 3-dimensional surrogate cloud fields and on the structure of clouds

Disclaimer

This essay should not be seen as a work of science. This idea is presented here on the web in the hope that someone else will find it useful and make real science out of it. The algorithm has not been tested with the usual scientific rigor, nor have I a made a search in the literature whether similar algorithms already exist. I would appreciate comments, especially in case deficiencies are found. See also the general disclaimer to these essays.

This post was first published on my homepage on 15 March 2005.

No comments: