R: Coerce data into a CM object

as.cm {oce} | R Documentation

## Coerce data into a CM object

### Description

Coerce data into a CM object

### Usage

    as.cm(
      time,
      u = NULL,
      v = NULL,
      pressure = NULL,
      conductivity = NULL,
      temperature = NULL,
      salinity = NULL,
      longitude = NA,
      latitude = NA,
      filename = "",
      debug = getOption("oceDebug")
    )

### Arguments

`time` | A vector of times of observation, or an `oce` object from which time and two velocity components can be inferred, e.g. an adv object, or an adp object that has only one distance bin. If `time` is an `oce` object, then all of the following arguments are ignored.
`u, v` | optional numerical vectors containing the x and y components of velocity (m/s).
`pressure, conductivity, salinity, temperature` | optional numerical vectors containing pressure (dbar), electrical conductivity, practical salinity, and in-situ temperature (degree C).
`longitude, latitude` | optional position specified in degrees East and North.
`filename` | optional source file name.
`debug` | an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many `oce` functions. Generally, setting `debug=0` turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of `debug` first, so that a user can often obtain deeper debugging by specifying higher `debug` values.

### See Also

Other things related to cm data: `[[,cm-method`, `[[<-,cm-method`, `cm-class`, `cm`, `plot,cm-method`, `read.cm()`, `rotateAboutZ()`, `subset,cm-method`, `summary,cm-method`

### Examples

    library(oce)
    # Example 1: creation from scratch
    t <- Sys.time() + 0:50
    u <- sin(2*pi*0:50/5) + rnorm(51)
    v <- cos(2*pi*0:50/5) + rnorm(51)
    p <- 100 + rnorm(51)
    summary(as.cm(t, u, v, p))

    # Example 2: creation from an adv object
    data(adv)
    summary(as.cm(adv))

[Package oce version 1.7-2 Index]