nc.get.proj4.string: Gets the proj4 string for a file

Description Usage Arguments Details Value References Examples

View source: R/helpers.r

Description

Gets the proj4 string for a file.

Usage

1

Arguments

f

The file (an object of class ncdf4)

v

The name of a variable

Details

Most NetCDF files are stored without any projection information as a lat-long grid. However, some files – particularly those from RCMs – are on a projected grid. This function returns a proj4 string, suitable for use with the 'proj4' library, which can be used to perform forward and inverse projections.

Given a file and a variable, this function returns the proj4 string for the given file should be. If no projection data is found, it returns an empty string. It currently supports Lambert Conformal Conic, Transverse Mercator, Polar Sterographic, and Rotated Pole projections, plus the latitude_longitude pseudo-projection.

Value

A string containing the proj4 string, or NULL if a translator is not available for the given projection.

References

http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/ch05s06.html

Examples

1
2
3
4
5
6
7
## Get the proj4 string for a hypothetical file.
## Not run: 
f <- nc_open("pr.nc")
proj4.string <- nc.get.proj4.string(f, "pr")
nc_close(f)

## End(Not run)

ncdf4.helpers documentation built on May 29, 2017, 9:36 p.m.