getTemporalIntersection: Temporal intersection

Description Usage Arguments Value Author(s) See Also Examples

View source: R/subsetGrid.R

Description

Takes two input grids and crops the overlapping part along time dimension

Usage

1
getTemporalIntersection(obs, prd, which.return = c("obs", "prd"))

Arguments

obs

First grid (typically observations, but not necessarily)

prd

Second grid (typically predictors in downscaling applications, but not necessarily)

which.return

Which subset grid should be returned, obs or prd?

Value

The grid indicated in which.return, encompassing the overlapping time period with the other one.

Author(s)

J Bedia

See Also

checkDim, checkSeason, getYearsAsINDEX, getSeason, for other time dimension helpers

Other subsetting: intersectGrid.spatial, intersectGrid.time, intersectGrid, limitArea, subsetCluster, subsetDimension, subsetGrid, subsetMembers, subsetRuntime, subsetSeason, subsetSpatial, subsetStation, subsetVar, subsetYears

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data("NCEP_Iberia_psl")
range(getRefDates(NCEP_Iberia_psl))
data("VALUE_Iberia_tas")
range(getRefDates(EOBS_Iberia_tas))
# Assuming sea-level pressure field from NCEP is the predictor, 
# and VALUE observations are the predictand,
# suppose they have different temporal periods:
predictor <- subsetGrid(NCEP_Iberia_psl, years = 1987:2001, season = 1)
getSeason(predictor) # January
range(getYearsAsINDEX(predictor)) # period 1987-2001 
predictand <- EOBS_Iberia_tas
getSeason(predictand) # December-January-February (winter)
range(getYearsAsINDEX(predictand)) # period 1983-2002
# We often want to ensure that their time dimension matches perfectly before downscaling:
try(checkDim(predictor, predictand, dimensions = "time"))
# getTemporalIntersection is the solution:
predictand.adj <- getTemporalIntersection(obs = predictand, prd = predictor, which.return = "obs")
getSeason(predictand.adj) # January 
range(getYearsAsINDEX(predictand.adj)) # 1987-2001 
# In the same vein, it is often required to be done again on the predictor 
predictor.adj <- getTemporalIntersection(obs = predictand, prd = predictor, which.return = "prd")
checkDim(predictor.adj, predictand.adj, dimensions = "time") # perfect

SantanderMetGroup/transformeR documentation built on March 14, 2020, 9:15 a.m.