cdfextract {clim.pact} | R Documentation

## Extract a subfield from a netCDF file.

### Description

A slow routine that extraxcts a subfield. This routine is suitable for reading subsections of large data files that are too big for `retrieve.nc`.

This version uses `cdfcont` to obtain vital meta data for handling the data in the netCDF file and constructing a 'field' object.

### Usage

    cdfextract(filename,varname,x.rng=NULL,y.rng=NULL,t.rng=NULL,
                           greenwich=TRUE,x.nam="lon",y.nam="lat",t.nam="tim",
                           plot=TRUE,l.scale=TRUE)

### Arguments

`filename` | name of netCDF file.
`varname` | name ov variable.
`x.rng` | X-range (in degrees East): c(min,max).
`y.rng` | Y-range (in degrees North): c(min,max).
`t.rng` | T-range (in units stored in 'tim'): c(min,max).
`greenwich` | TRUE: longitude runs from -180E to 180E.
`x.nam` | name of X-dimension.
`y.nam` | name of Y-dimension.
`t.nam` | name of T-dimension.
`plot` | TRUE for plotting.
`l.scale` | scale field by offset and scaling-factor.

### Value

a field object. Also see `retrieve.nc`. Saves the extracted data in a netCDF file called "cdfextract.nc" under current working directory (see `r2cdf`).

### Author(s)

R.E. Benestad

### Examples

    ## Not run:
    slp <- cdfextract("data/nmc_slp.nc","slp",x.rng=c(-80,40),y.rng=c(20,75),
                      t.rng=c(times[is],times[is]+499),plot=FALSE)
    ## End(Not run)

[Package Contents]