R: Smooth a Section

sectionSmooth {oce} | R Documentation

## Smooth a Section

### Description

Smooth a section in the lateral (alpha version that may change).

### Usage

    sectionSmooth(section, method = c("spline", "barnes"), xg, yg, xgl, ygl, xr,
      yr, gamma = 0.5, iterations = 2, trim = 0, pregrid = FALSE,
      debug = getOption("oceDebug"), ...)

### Arguments

`section` | A `section` object containing the section to be smoothed. For `method="spline"`, the pressure levels must match for each station in the section.
`method` | Specifies the method to use; see ‘Details’.
`xg, xgl` | passed to `interpBarnes`, if `method="barnes"`; ignored otherwise. If `xg` is supplied, it defines the x component of the grid, i.e. the resultant "stations". Alternatively, if `xgl` is supplied, the x grid is established using `seq`, to span the data with `xgl` elements. If neither of these is supplied, the output x grid will equal the input x grid.
`yg, ygl` | similar to `xg` and `xgl`.
`xr, yr` | influence ranges in x and y, passed to `interpBarnes` if `method="barnes"`; ignored otherwise.
`gamma` | scale-reduction parameter, passed to `interpBarnes`, if `method="barnes"`; ignored otherwise.
`iterations` | number of interations of Barnes algorithm, passed to `interpBarnes`, if `method="barnes"`; ignored otherwise.
`trim` | passed to `interpBarnes`, if `method="barnes"`; ignored otherwise
`pregrid` | passed to `interpBarnes`, if `method="barnes"`; ignored otherwise
`debug` | A flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more.
`...` | Optional extra arguments, passed to either `smooth.spline` or `interpBarnes`.

### Details

This function should be used with caution, as should any operation that changes data. Although smoothing may be desirable to produce aesthetically-pleasing plots, it can also introduce artifacts that can lead to erroneous conclusions. The prudent analyst starts by comparing plots of the raw data with plots of the smoothed data.

For `method="spline"`, the section is smoothed using `smooth.spline` on individual pressure levels, with any parameters listed in `parameters` being passed to that function. If `df` is not present in `parameters`, then this function sets it to the number of stations divided by 5. Smoothing is done separately for temperature, salinity, and sigma-theta.

For the (much slower) `method="barnes"` method, smoothing is done across both horizontal and vertical coordinates, using `interpBarnes`. The stations are changed to lie on the grid supplied defined `xg` and `yg`, or by `xgl` and `ygl` (see those arguments)

### Value

An object of `section-class` that ordered in some way.

### Author(s)

Dan Kelley

### See Also

Other things related to `section` data: `[[,section-method`, `[[<-,section-method`, `as.section`, `handleFlags,section-method`, `plot,section-method`, `read.section`, `section-class`, `sectionAddStation`, `sectionGrid`, `sectionSort`, `section`, `subset,section-method`, `summary,section-method`

### Examples

    library(oce)
    data(section)
    gs <- subset(section, 109<=stationId&stationId<=129)
    gsg <- sectionGrid(gs, p=seq(0, 5000, 150))
    gss1 <- sectionSmooth(gsg, "spline", df=16)
    plot(gss1)
    ## Not run:
    gss2 <- sectionSmooth(gsg, "barnes", xr=24, yr=100)
    plot(gss2)

    ## End(Not run)

[Package oce version 0.9-20 Index]