kzpdr: Average Periodogram for Spatial Data in Given Directions

Description Usage Arguments Details Value See Also Examples

Description

Functions in this group are designed to check periodogram for data series in a given direction or a list of directions.

kzpdr samples the data of wave field, and outputs the average pattern of periodogram for series in a given direction. A collection of these pattern records will be sent to kzpdr.eval or kzpdr.estimate to estimate the wave frequencies and directions.

Usage

1
2
3
kzpdr(ds, angle, plot = F, pair = T, ...)

kzpdr.3d(ds, angle, ...)

Arguments

ds

Data array. Only 2 dimensional arrays are allowed for current version.

angle

Vector or single numeric value in radians.

plot

TRUE or FLASE. Flag for outputting designed periodogram plot or not. Defaults to FLASE. In kzpdr, the plot is the mean periodogram for data series in a given direction.

pair

Logic. Defaults to TRUE, i.e., check the given directions and their orthogonal opposition at the same time.

...

Other arguments.

  • For function kzpdr, it could be the following arguments (right of equals signs are their default setting):

    • w = 20 : smoothing window size.

    • dpct = 0.01 : a percentage of total variation of periodogram; smoothing window is extended until variation within the window reaches this number. See DZ method in kzft::kzp for details.

    • rg = c(0,0.5) : the frequency range for the periodogram.

    • raw = FALSE : if use the raw periodogram directly.

    • log = FALSE : if use log scale for periodogram.

    • frun = FALSE : if force to run the sampling on given directions. Defaults to check records and not sample on duplicate directions

    • min.ln = 0.6 : the minimum ratio of sampling data length vs. original data length to product a periodogram for a direction.

  • In kzpdr.3d function, it could be arguments of the perspective plot, like theta, phi, etc., please refer function graphics::persp for more information.

  • For kzpdr.valid, level control the cross-validation process: integer number k means to run cross-validation by excluding k pairs of directional samples each time. Default value is 1.

Details

kzpdr is used to sample the spatial data and generates periodograms in orthogonal direction pairs; the frequencies of spikes for each directional periodogram are identified and recorded as the function output. The spike pattern of average periodograms for spatial directions can help to identify wave frequencies and directions.

Function kzpdr.3d will provide 3D perspective plot as the global view for periodograms of data series in a given direction.

Value

The returned data list of function kzpdr includes the data frame for frequencies of spikes on mean periodograms of each checked direction. It also includes a vector recording the md5sum value of the spatial wave data array for internal control.

Function kzpdr will output the periodogram plots when option plot is set as TRUE. The frequencies of marked spikes will also be print out for each sampling direction.

kzpdr.3d returns back the data frame for re-gridded mean periodogram for data series in given direction, as showed in the perspective plot.

See Also

kzp2, kzpdr.tol, kzpdr.eval kzpdr.valid, kzpdr.spikes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
dx <- 300			 
dy <- 300			 

b <- expand.grid(x=1:dx, y=1:dy)
q1 <- pi/3; f1 <- 0.2;
b$v1 <- sin(f1*2*pi*(b$x*cos(q1)+b$y*sin(q1))+100*runif(1))
q2 <- pi/6; f2 <- 0.05;
b$v2 <- sin(f2*2*pi*(b$x*cos(q2)+b$y*sin(q2))+100*runif(1))

a <- array(0,c(dx,dy))
a[as.matrix(b[,1:2])] <- b$v1 + 1.5*b$v2
persp(1:dx, 1:dy, a, theta=90, phi=-110, 
	ticktype="detailed", col="lightblue")
a <- a + 5*matrix(rnorm(dx*dy,0,1),ncol=dy)
persp(1:dx, 1:dy, a, theta=90, phi=-110, 
	ticktype="detailed", col="lightblue")

# It may take about 30 seconds
# o <- kzpdr.3d(a, -pi/6) 

# Load pre-saved data to save running-time
data(kzpdr.demo);

# sampling, it may take a few minutes 
# system.time(kzpdr.demo <- kzpdr(a, pi/12, pair=FALSE, plot=TRUE)) 
# system.time(kzpdr.demo <- kzpdr(a, pi/12, plot=TRUE))
# system.time(kzpdr.demo <- kzpdr(a, c(0, pi/6, pi/4, pi/3), plot=TRUE))
 
kzpdr.spikes(kzpdr.demo)

# For identification of the wave parameters, see kzpdr.estimate

kzfs documentation built on June 2, 2019, 5:04 p.m.

Related to kzpdr in kzfs...