R: Get information about the grid used by the air quality model
get.grid.info.M3
R Documentation
Get information about the grid used by the air quality model
Description
Pull information about the grid used from the
Models3-formatted file. This includes information such as the origin
of the grid (lower left corner coordinates in grid units), cell
spacing, etc.
Usage
get.grid.info.M3(file)
Arguments
file
File name of Models3-formatted file which contains
information about the projection. Currently, this function can only
handle files with Lambert conic conformal, polar stereographic, and
longitude/latitude projections.
Details
This function assumes that the projection is either Lambert
conic conformal or polar stereographic projection. Information about
grid cell size, extent of grid, etc. is stored in the global
attributes of the Models3-formatted file, which this function reads.
Value
List with the following components:
x.orig
X-coordinate of the origin point of the grid (lower
left corner, coordinates in model projection units)
y.orig
Y-coordinate of the origin point of the grid (lower
left corner, coordinates in model projection units)
x.cell.width
Width of grid cells in x-direction (in model
projection units)
y.cell.width
Width of grid cells in y-direction (in model
projection units)
hz.units
Units of the projection (“m”, “km”,
or “deg”)
ncols
Number of columns of grid cells
nrows
Number of rows of grid cells
nlays
Number of vertical layers
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
(http://www.unidata.ucar.edu/software/netcdf).
Usually, the user will not call this function directly; instead, it
will be called by the function get.coord.for.dimension.
Author(s)
Jenise Swall
See Also
get.proj.info.M3, get.coord.for.dimension
Examples
## As mentioned in notes above, user will not typically call
## this function directly.
## Find the path to a demo file with lambert conic conformal projection.
lcc.file <- system.file("extdata/ozone_lcc.ncf", package="M3")
## Get a list containing information about the grid in this file.
grid.info <- get.grid.info.M3(lcc.file)
## Find the path to a demo file with polar stereographic projection.
polar.file <- system.file("extdata/surfinfo_polar.ncf", package="M3")
## Get a list containing information about the grid in this file.
grid.info <- get.grid.info.M3(polar.file)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(M3)
Loading required package: ncdf4
Loading required package: rgdal
Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.3, released 2015/09/16
Path to GDAL shared files: /usr/share/gdal/1.11
Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.2-3
Loading required package: maps
# maps v3.1: updated 'world': all lakes moved to separate new #
# 'lakes' database. Type '?world' or 'news(package="maps")'. #
Loading required package: mapdata
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/M3/get.grid.info.M3.Rd_%03d_medium.png", width=480, height=480)
> ### Name: get.grid.info.M3
> ### Title: Get information about the grid used by the air quality model
> ### Aliases: get.grid.info.M3
> ### Keywords: IO
>
> ### ** Examples
>
> ## As mentioned in notes above, user will not typically call
> ## this function directly.
>
> ## Find the path to a demo file with lambert conic conformal projection.
> lcc.file <- system.file("extdata/ozone_lcc.ncf", package="M3")
> ## Get a list containing information about the grid in this file.
> grid.info <- get.grid.info.M3(lcc.file)
>
>
> ## Find the path to a demo file with polar stereographic projection.
> polar.file <- system.file("extdata/surfinfo_polar.ncf", package="M3")
> ## Get a list containing information about the grid in this file.
> grid.info <- get.grid.info.M3(polar.file)
>
>
>
>
>
> dev.off()
null device
1
>