grid2D: Generate longitude and latitude grid matrices

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/grid2D.R

Description

grid2D is a helper function that generates longitude and latitude rectangular mesh from short longitude and latitude vectors in gridded data.

Usage

1

Arguments

lon

a vector of longitudes with length N. Longitudes takes values from -180 to 180 (not 0 to 360). For gridded data, the length may have the value (n) provided that n * m = N where n = length(unique(lon)) and m = length(unique(lat)).

lat

a vector of latitudes with length N or m. See lon.

Details

grid2D function convert the long latitude and longitude vectors to a rectangular two-dimensional grid for visualization and geographic masking purposes for gridded data in HiClimR package.

Value

A list with the following components:

lon

an (n rows by m columns) matrix of 'double' values for longitude mesh grid, or a vector with length n * m.

lat

an (n rows by m columns) matrix of 'double' values for latitude mesh grid, or a vector with length n * m.

Author(s)

Hamada S. Badr <badr@jhu.edu>, Benjamin F. Zaitchik <zaitchik@jhu.edu>, and Amin K. Dezfuli <amin.dezfuli@nasa.gov>.

References

Hamada S. Badr, Zaitchik, B. F. and Dezfuli, A. K. (2015): A Tool for Hierarchical Climate Regionalization, Earth Science Informatics, 8(4), 949-958, doi: 10.1007/s12145-015-0221-7.

Hamada S. Badr, Zaitchik, B. F. and Dezfuli, A. K. (2014): Hierarchical Climate Regionalization, Comprehensive R Archive Network (CRAN), https://cran.r-project.org/package=HiClimR.

See Also

HiClimR, HiClimR2nc, validClimR, geogMask, coarseR, fastCor, grid2D and minSigCor.

Examples

1
2
3
4
5
6
7
8
9
require(HiClimR)

## Load test case data
x <- TestCase$x

## Generate longitude and latitude mesh vectors
xGrid <- grid2D(lon = unique(TestCase$lon), lat = unique(TestCase$lat))
lon <- c(xGrid$lon)
lat <- c(xGrid$lat)

Example output



HiClimR documentation built on Jan. 21, 2022, 1:08 a.m.