Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fitslope

Compute logarithmic slope of a spatial power spectrum


Description

Uses a linear fit to derive the log-log slope of a Fourier power spectrum.

Usage

fitslope(fx, kmin = 1, kmax = length(fx))

Arguments

fx

vector containing input power spectrum starting from k=1.

kmin

minimum wavenumber for logarithmic fit range.

kmax

maximum wavenumber for logarithmic fit range.

Value

The spatial spectral slope minus one. The slope is returned as the logarithmic slope of k*|A(k)|^2 where |A(k)|^2 are the squared spectral amplitudes provided in input..

Author(s)

Jost von Hardenberg, j.vonhardenberg@isac.cnr.it

Examples

# Make a synthetic rainfall field with prescribed logarithmic spectral slope
f = initmetagauss(1.7, 64)
r = metagauss(f)
# Check spectral slope of the resulting field
fx <- fft2d(r)
print(fitslope(fx))
# 1.640373

rainfarmr

Stochastic Precipitation Downscaling with the RainFARM Method

v0.1
Apache License 2.0
Authors
Jost von Hardenberg [aut, cre, cph] (<https://orcid.org/0000-0002-5312-8070>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.