getGrid: Get regular grid definition

View source: R/helpers.R

getGridR Documentation

Get regular grid definition

Description

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

Usage

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(), getVarNames(), getWT(), getYearsAsINDEX(), setGridProj(), typeofGrid(), which.leap()

Examples

 
require(climate4R.datasets)
# 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)
require(visualizeR)
spatialPlot(climatology(NCEP_Iberia_hus850), backdrop.theme = "countries")
spatialPlot(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))
spatialPlot(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 Oct. 28, 2023, 5:26 a.m.