getGrid: Get regular grid definition

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

View source: R/helpers.R

Description

Get the (regular) grid definition from an existing (gridded) dataset

Usage

1
getGrid(gridData)

Arguments

gridData

A grid data object coming from loadGridData (package loadeR) or interpGrid or the function loadECOMS of package loadeR.ECOMS.

Details

In case of irregular grid definitions, the function forces the grid to regularity. The returned grid object inherits the attributes from the input xyCoords definition.

Value

A list of two named components, x and y, consisting of a vector of length two each one, defining the x/y lower and upper bounds. The grid-cell resolution is given by the attributes 'resX' and 'resY' respectively.

Author(s)

S. Herrera and J. Bedia

See Also

Other get.helpers: get2DmatCoordinates, getCoordinates, getDim, getGridProj, getGridVerticalLevels, getRefDates, getSeason, getShape, getStationID, getTimeResolution, getVarNames, getYearsAsINDEX, setGridProj, typeofGrid, which.leap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Regular grid
data("NCEP_Iberia_hus850")
str(getGrid(NCEP_Iberia_hus850))
# Regular rotated grid with correpondence with a non regular grid in the 
# lat/lon domain.
data("CORDEX_Iberia_tas")
str(getGrid(CORDEX_Iberia_tas))
# Station data
data("VALUE_Iberia_tas")
str(getGrid(VALUE_Iberia_tas))

# Interpolate NCEP onto the System4 grid:
data("CFS_Iberia_pr")
NCEP_interpolated <- interpGrid(NCEP_Iberia_hus850, getGrid(CFS_Iberia_pr), "bilinear")
# Note the warnings because of the non-overlapping domain extents (longitudes)
plotClimatology(climatology(NCEP_Iberia_hus850), backdrop.theme = "countries")
plotClimatology(climatology(NCEP_interpolated), backdrop.theme = "countries")
str(getGrid(NCEP_interpolated))
str(getGrid(CFS_Iberia_pr))

# The other way round, using nearest neighbour interpolation:
CFS_interpolated <- interpGrid(CFS_Iberia_pr, getGrid(NCEP_Iberia_hus850))
plotClimatology(climatology(CFS_interpolated), backdrop.theme = "countries")
# In this case, the mismatch in domain extent occurs in the longitudes and latitudes

SantanderMetGroup/transformeR documentation built on Feb. 14, 2020, 5:55 p.m.