Skip to content

Commit

Permalink
new naming for precipitation datasets (tp-->pr)
Browse files Browse the repository at this point in the history
change NCEP source to UDG
  • Loading branch information
miturbide committed Sep 19, 2017
1 parent cec6331 commit 4ee0657
Show file tree
Hide file tree
Showing 44 changed files with 230 additions and 242 deletions.
4 changes: 2 additions & 2 deletions R/climatologyVariogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
#' @importFrom graphics abline plot text grid
#' @importFrom stats var
#' @examples
#' data("EOBS_Iberia_tp")
#' data("EOBS_Iberia_pr")
#' # We compute the mean annual DJF precipitation
#' aggr.fun <- list(FUN = "sum")
#' annual.tp <- aggregateGrid(EOBS_Iberia_tp, aggr.m = aggr.fun, aggr.y = aggr.fun)
#' annual.tp <- aggregateGrid(EOBS_Iberia_pr, aggr.m = aggr.fun, aggr.y = aggr.fun)
#' # Now the winter precipitation climatology is computed
#' tp.clim <- climatology(annual.tp)
#' plotClimatology(tp.clim,
Expand Down
4 changes: 2 additions & 2 deletions R/grid2mopa.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#' # A raster stack from a multigrid
#' # A raster stack from a multigrid
#' data("EOBS_Iberia_tas")
#' data("EOBS_Iberia_tp")
#' multigrid <- makeMultiGrid(EOBS_Iberia_tas, EOBS_Iberia_tp)
#' data("EOBS_Iberia_pr")
#' multigrid <- makeMultiGrid(EOBS_Iberia_tas, EOBS_Iberia_pr)
#' multigridaggr <- aggregateGrid(multigrid, aggr.y = list(FUN = "mean"))
#' ras <- grid2mopa(multigridaggr)
#' require(sp)
Expand Down
36 changes: 18 additions & 18 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
#' str(getGrid(VALUE_Iberia_tas))
#'
#' # Interpolate NCEP onto the System4 grid:
#' data("CFS_Iberia_tp")
#' NCEP_interpolated <- interpGrid(NCEP_Iberia_hus850, getGrid(CFS_Iberia_tp), "bilinear")
#' 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_tp))
#' str(getGrid(CFS_Iberia_pr))
#'
#' # The other way round, using nearest neighbour interpolation:
#' CFS_interpolated <- interpGrid(CFS_Iberia_tp, getGrid(NCEP_Iberia_hus850))
#' 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

Expand Down Expand Up @@ -425,16 +425,16 @@ selectPar.pplyFun <- function(parallel.pars, .pplyFUN = c("apply", "lapply", "sa
#' @author J Bedia
#' @examples
#' data("VALUE_Iberia_tas")
#' data("VALUE_Iberia_tp")
#' checkDim(VALUE_Iberia_tas, VALUE_Iberia_tp) # ok, go on
#' data("VALUE_Iberia_pr")
#' checkDim(VALUE_Iberia_tas, VALUE_Iberia_pr) # ok, go on
#' data("EOBS_Iberia_tas")
#' data("EOBS_Iberia_tp")
#' checkDim(EOBS_Iberia_tas, EOBS_Iberia_tp) # ok, go on
#' data("EOBS_Iberia_pr")
#' checkDim(EOBS_Iberia_tas, EOBS_Iberia_pr) # ok, go on
#' data("NCEP_Iberia_psl")
#' try(checkDim(EOBS_Iberia_tas, EOBS_Iberia_tp, NCEP_Iberia_psl)) # inconsistent dimensions
#' try(checkDim(EOBS_Iberia_tas, EOBS_Iberia_pr, NCEP_Iberia_psl)) # inconsistent dimensions
#' data("CFS_Iberia_tas")
#' try(checkDim(NCEP_Iberia_psl, CFS_Iberia_tas, dimensions = "member"))
#' checkDim(VALUE_Iberia_tas, VALUE_Iberia_tp) # ok, go on
#' checkDim(VALUE_Iberia_tas, VALUE_Iberia_pr) # ok, go on


checkDim <- function(..., dimensions = c("var", "member", "time", "lat", "lon")) {
Expand All @@ -461,9 +461,9 @@ checkDim <- function(..., dimensions = c("var", "member", "time", "lat", "lon"))
#' @export
#' @examples
#' data("EOBS_Iberia_tas")
#' data("EOBS_Iberia_tp")
#' data("EOBS_Iberia_pr")
#' grid1 <- subsetGrid(EOBS_Iberia_tas, season = 1)
#' grid2 <- subsetGrid(EOBS_Iberia_tp, season = 1)
#' grid2 <- subsetGrid(EOBS_Iberia_pr, season = 1)
#' checkSeason(grid1, grid2) # ok, go on
#' \donttest{
#' try(checkSeason(grid1, grid2, EOBS_Iberia_tas)) # oops
Expand All @@ -475,8 +475,8 @@ checkDim <- function(..., dimensions = c("var", "member", "time", "lat", "lon"))
#'
#' #Station data
#' data("VALUE_Iberia_tas")
#' data("VALUE_Iberia_tp")
#' checkSeason(VALUE_Iberia_tas, VALUE_Iberia_tp)
#' data("VALUE_Iberia_pr")
#' checkSeason(VALUE_Iberia_tas, VALUE_Iberia_pr)


checkSeason <- function(...) {
Expand Down Expand Up @@ -694,12 +694,12 @@ array3Dto2Dmat.stations <- function(array3D) {
#' @family get.helpers
#' @export
#' @examples
#' data("CFS_Iberia_tp")
#' getVarNames(CFS_Iberia_tp)
#' getVarNames(CFS_Iberia_tp, "long")
#' data("CFS_Iberia_pr")
#' getVarNames(CFS_Iberia_pr)
#' getVarNames(CFS_Iberia_pr, "long")
#' ## Example with a multigrid
#' data("CFS_Iberia_tas")
#' mg <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_tp)
#' mg <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_pr)
#' getVarNames(mg)
#' getVarNames(mg, "long")
#' ## Example with station data
Expand Down
22 changes: 11 additions & 11 deletions R/interpGrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
#' @export
#' @examples
#' # boreal winter (DJF) precipitation data for the Iberian Peninsula and the period 1983-2002
#' data(EOBS_Iberia_tp)
#' plotClimatology(climatology(EOBS_Iberia_tp))
#' data(EOBS_Iberia_pr)
#' plotClimatology(climatology(EOBS_Iberia_pr))
#' # Bilinear interpolation to a regular grid of 0.5 degree
#' # resolution centered in the Iberian Peninsula
#' t1 <- interpGrid(EOBS_Iberia_tp, new.coordinates = list(x = seq(-10,5,.5),
#' t1 <- interpGrid(EOBS_Iberia_pr, new.coordinates = list(x = seq(-10,5,.5),
#' y = seq(36,44,.5)),
#' method = "bilinear",
#' bilin.method = "akima")
Expand All @@ -59,29 +59,29 @@
#' attributes(t1$xyCoords)
#'
#' # Using the coordinate information of another grid via getGrid()
#' data(NCEP_Iberia_tp)
#' t2 <- interpGrid(EOBS_Iberia_tp, new.coordinates = getGrid(NCEP_Iberia_tp),
#' data(NCEP_Iberia_pr)
#' t2 <- interpGrid(EOBS_Iberia_pr, new.coordinates = getGrid(NCEP_Iberia_pr),
#' method = "nearest")
#' plotClimatology(climatology(t2), backdrop.theme = "countries")
#'
#' #From station data to grid
#' data(VALUE_Iberia_tp)
#' plotClimatology(climatology(VALUE_Iberia_tp), backdrop.theme = "countries")
#' t3 <- interpGrid(VALUE_Iberia_tp, new.coordinates = getGrid(EOBS_Iberia_tp),
#' data(VALUE_Iberia_pr)
#' plotClimatology(climatology(VALUE_Iberia_pr), backdrop.theme = "countries")
#' t3 <- interpGrid(VALUE_Iberia_pr, new.coordinates = getGrid(EOBS_Iberia_pr),
#' method = "bilinear")
#' plotClimatology(climatology(t3), backdrop.theme = "countries")
#'
#' #From grid to station data
#' t4 <- interpGrid(EOBS_Iberia_tp, new.coordinates = getGrid(VALUE_Iberia_tp),
#' t4 <- interpGrid(EOBS_Iberia_pr, new.coordinates = getGrid(VALUE_Iberia_pr),
#' method = "nearest")
#' plotClimatology(climatology(t4), backdrop.theme = "countries")
#' t5 <- interpGrid(EOBS_Iberia_tp,
#' t5 <- interpGrid(EOBS_Iberia_pr,
#' new.coordinates = list(x = c(-6.7, -4.5, 2.5),
#' y = c(41.8, 40, 39)))
#' plotClimatology(climatology(t5), backdrop.theme = "countries")
#'
#' #From grid to a single point or station
#' t6 <- interpGrid(grid = EOBS_Iberia_tp,
#' t6 <- interpGrid(grid = EOBS_Iberia_pr,
#' new.coordinates = list(x = -6.7, y = 41.8))
#' str(t6$Data)

Expand Down
8 changes: 4 additions & 4 deletions R/localScaling.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@
#' lines(lc.ref.m$Data[,,,15,15], col = "red")
#'
#' # An example using the "ratio" type:
#' data("EOBS_Iberia_tp")
#' grid <- subsetGrid(EOBS_Iberia_tp, years = 1999)
#' base <- subsetGrid(EOBS_Iberia_tp, years = 1998)
#' ref <- subsetGrid(EOBS_Iberia_tp, years = 2000)
#' data("EOBS_Iberia_pr")
#' grid <- subsetGrid(EOBS_Iberia_pr, years = 1999)
#' base <- subsetGrid(EOBS_Iberia_pr, years = 1998)
#' ref <- subsetGrid(EOBS_Iberia_pr, years = 2000)
#' fun <- list(FUN = "sum")
#' # We plot the climatologies (total accumulated precip) to have a visual comparison of
#' # the input grid, the grid used as base and the reference
Expand Down
4 changes: 2 additions & 2 deletions R/makeMultiGrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
#' # Load three different multimember grids with the same spatiotemporal ranges:
#' data("CFS_Iberia_tas")
#' data("CFS_Iberia_hus850")
#' data("CFS_Iberia_tp")
#' mm.mf <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_hus850, CFS_Iberia_tp)
#' data("CFS_Iberia_pr")
#' mm.mf <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_hus850, CFS_Iberia_pr)
#' # Different fields can not be plotted together in the same plot directly.
#' # subsetGrid and plotClimatology can be conveniently used to that aim, if needed. For instance:
# tas <- subsetGrid(mm.mf, var = "tas")
Expand Down
4 changes: 2 additions & 2 deletions R/plotClimatology.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
#' scales = list(draw = TRUE))
#'
#' # Station data:
#' data("VALUE_Iberia_tp")
#' plotClimatology(climatology(VALUE_Iberia_tp), backdrop.theme = "countries")
#' data("VALUE_Iberia_pr")
#' plotClimatology(climatology(VALUE_Iberia_pr), backdrop.theme = "countries")



Expand Down
4 changes: 2 additions & 2 deletions R/prinComp.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@
#' str(pca.mm)
#'
#' # The most complex situation comes from multimember multigrids:
#' data("CFS_Iberia_tp", "CFS_Iberia_tas")
#' data("CFS_Iberia_pr", "CFS_Iberia_tas")
#' # Now the multimember multigrid is constructed
#' mm.multigrid <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_tp)
#' mm.multigrid <- makeMultiGrid(CFS_Iberia_tas, CFS_Iberia_pr)
#' # Use different n.eofs for each variable:
#' pca.mm.mf <- prinComp(mm.multigrid, n.eofs = c(3,5))

Expand Down
Loading

0 comments on commit 4ee0657

Please sign in to comment.