getTemporalIntersection | R Documentation |
Takes two input grids and crops the overlapping part along time dimension
getTemporalIntersection(obs, prd, which.return = c("obs", "prd"))
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, |
The grid indicated in which.return
, encompassing the overlapping time period with the other one.
J Bedia
checkDim
, checkSeason
, getYearsAsINDEX
, getSeason
, for other time dimension helpers
Other subsetting:
intersectGrid()
,
intersectGrid.spatial()
,
intersectGrid.time()
,
limitArea()
,
subsetCluster()
,
subsetDimension()
,
subsetGrid()
,
subsetMembers()
,
subsetRuntime()
,
subsetSeason()
,
subsetSpatial()
,
subsetStation()
,
subsetVar()
,
subsetYears()
require(climate4R.datasets)
data("NCEP_Iberia_psl")
range(getRefDates(NCEP_Iberia_psl))
data("EOBS_Iberia_tas")
range(getRefDates(EOBS_Iberia_tas))
# Assume NCEP's sea-level pressure is the predictor,
# and EOBS observations are the predictand,
# encompassing both datasets 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 do the same on the predictor
predictor.adj <- getTemporalIntersection(obs = predictand, prd = predictor, which.return = "prd")
checkDim(predictor.adj, predictand.adj, dimensions = "time") # perfect
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.