get.proj.info.M3 {M3} | R Documentation |
Obtain information about the projection used in the Models3 file
Description
Obtain information about the projection used by in the Models3-formatted file. Build a string describing the projection which can be used by the R package sf.
Usage
get.proj.info.M3(file, earth.radius=6370000)
Arguments
file |
File name of Models3-formatted file which contains information about the projection. Currently, this function can only handle files with a Lambert conic conformal, polar stereographic, and longitude/latitude projections. |
earth.radius |
Radius of the earth (in meters), which is assumed to be spherical by the Models3 I/O API. Default value is 6 370 000 m. Note that the radius in some previous version of the Models3 I/O API was 6 370 997 m, which may be appropriate for some users. For instance, this latter value was used in previous packages supplied by Battelle. |
Details
This function assumes that the file uses the Lambert
conic conformal projection, polar stereographic projection, or
longitude/latitude.
The Models3 I/O API assumes a spherical earth. The default value for
earth.radius
is 6 370 000 m (sometimes referred to as
“sphere 20”), which is the current value used in the Models3
I/O API. Note that the radius in some previous versions of the Models3
I/O API was 6 370 997 m, and this value was also used in previous
packages for reading Models3-formatted files, which were developed for
EPA by Battelle.
Value
String describing model projection, which can be utilized by the sf package (for projections to and from longitude/latitude, for example).
Warning
Currently, this function can only handle files with Lambert conic conformal, polar stereographic, and longitude/latitude projections.
Note
This function relies on the R package ncdf4 to read
information from Models3-formatted files, since the Models3 format
is built on netCDF
(https://www.unidata.ucar.edu/software/netcdf/).
The string that is returned by this function is appropriate for
use with package sf. Usually, the user will not call this function
directly; instead, it will be called by other functions in this package.
Author(s)
Jenise Swall
References
See information about the meaning of Models3 I/O API
projection arguments at
https://www.cmascenter.org/ioapi/documentation/all_versions/html/GRIDS.html.
See Also
project.lonlat.to.M3
,
project.M3.to.lonlat
,
project.M3.1.to.M3.2
,
get.map.lines.M3.proj
Examples
## Find the path to a demo file on lambert conic conformal projection.
lcc.file <- system.file("extdata/ozone_lcc.ncf", package="M3")
## Get string with projection information, using previous value for
## the earth's radius.
get.proj.info.M3(lcc.file, earth.radius=6370997)
## Find the path to a demo file on polar stereographic projection.
polar.file <- system.file("extdata/surfinfo_polar.ncf", package="M3")
## Get string with projection information.
get.proj.info.M3(polar.file)