Skip to content

Commit

Permalink
Doc update and additions
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedia committed Sep 22, 2016
1 parent 6de3e67 commit 8b8cc37
Show file tree
Hide file tree
Showing 28 changed files with 474 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Suggests:
Type: Package
Title: Climate data manipulation
Version: 0.0-0
Date: 2016-09-19
Date: 2016-09-22
Authors@R: as.person(c(
"Santander Meteorology Group <http://meteo.unican.es> [aut]",
"Joaquin Bedia <[email protected]> [ctb, cre]",
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export(aggregateGrid)
export(array3Dto2Dmat)
export(climatology)
export(detrendGrid)
export(draw.world.lines)
export(easyVeri2grid)
export(filterGrid)
export(getCoordinates)
Expand Down Expand Up @@ -33,12 +34,14 @@ export(subsetSeason)
export(subsetSpatial)
export(subsetVar)
export(subsetYears)
importFrom(RCurl,getURL)
importFrom(abind,abind)
importFrom(abind,asub)
importFrom(akima,interp)
importFrom(fields,image.plot)
importFrom(fields,interp.surface.grid)
importFrom(grDevices,colorRampPalette)
importFrom(graphics,lines)
importFrom(graphics,mtext)
importFrom(graphics,par)
importFrom(graphics,title)
Expand All @@ -55,4 +58,5 @@ importFrom(stats,lm)
importFrom(stats,na.exclude)
importFrom(stats,na.omit)
importFrom(stats,sd)
importFrom(utils,packageDescription)
importFrom(utils,tail)
6 changes: 3 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
downscaleR 1.3-4
transformeR 0.0-0
=================

* Bug fix in getYearsAsIndex for annually-aggregated, year-crossing grids
* Other minor bug fixes and enhancements
* First package version
* Merged from downscaleR 1.3-4



19 changes: 19 additions & 0 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,22 @@ getShape <- function(obj, dimension = NULL) {
}


#' @title Land borders
#' @description Add land borders to a map
#' @param ... Graphical parameters passed to \code{\link{lines}}.
#' @return Draws a simplied land border areas as lines onto the map
#' @details The function loads a built-in world segments dataset created ad hoc to avoid dependencies on other packages (i.e. 'maps').
#' Geographical lonlat coordinates in wgs84.
#' @source Postprocessed from the original shapefile from Natural Earth (http://www.naturalearthdata.com/downloads/110m-physical-vectors/)
#' @author J. Bedia
#' @keywords internal
#' @importFrom graphics lines
#' @export

draw.world.lines <- function(...) {
load(system.file(package="transformeR","wrl.Rda"), envir = environment())
for (i in 1:length(node.list)) {
lines(node.list[[i]][,1], node.list[[i]][,2], ...)
}
}

29 changes: 29 additions & 0 deletions R/onAttach.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#' @importFrom utils packageDescription
#' @importFrom RCurl getURL

.onAttach <- function(...) {
pkgname <- "transformeR"
lib <- system.file(package = pkgname)
ver <- packageDescription(pkgname)$Version
builddate <- packageDescription(pkgname)$Date
mess <- paste(pkgname, " version ", ver, " (", builddate,") is loaded", sep = "")
packageStartupMessage(mess)
url <- paste0("https://raw.githubusercontent.com/SantanderMetGroup/", pkgname, "/master/DESCRIPTION")
con <- tryCatch(getURL(url, ssl.verifypeer = FALSE), error = function(er) {
er <- NULL
return(er)
})
if (!is.null(con)) {
b <- readLines(textConnection(con))
latest.ver <- package_version(gsub("Version: ", "", b[grep("Version", b)]))
if (ver < latest.ver) {
ver.mess1 <- paste0("WARNING: Your current version of ", pkgname, " (v", ver, ") is not up-to-date")
ver.mess <- paste0("Get the latest stable version (", latest.ver,
") using <devtools::install_github('SantanderMetGroup/", pkgname, "')>")
packageStartupMessage(ver.mess1)
packageStartupMessage(ver.mess)
}
}
}
# End

14 changes: 7 additions & 7 deletions R/plotClimatology.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,23 @@ plotClimatology <- function(grid, backdrop.theme = "none", ...) {
}
arg.list <- list(...)
bt <- match.arg(backdrop.theme, choices = c("none", "coastline", "countries"))
dimNames <- downscaleR:::getDim(grid)
dimNames <- getDim(grid)
## Multigrids are treated as realizations, previously aggregated by members if present
is.multigrid <- "var" %in% dimNames
if (is.multigrid) {
if ("member" %in% dimNames) {
mem.ind <- grep("member", dimNames)
n.mem <- downscaleR:::getShape(grid, "member")
n.mem <- getShape(grid, "member")
if (n.mem > 1) message("NOTE: The multimember mean will be displayed for each variable in the multigrid")
grid <- suppressMessages(aggregateGrid(grid, aggr.mem = list(FUN = "mean", na.rm = TRUE)))
dimNames <- downscaleR:::getDim(grid)
dimNames <- getDim(grid)
}
attr(grid[["Data"]], "dimensions") <- gsub("var", "member", dimNames)
}
grid <- redim(grid, drop = FALSE)
dimNames <- downscaleR:::getDim(grid)
dimNames <- getDim(grid)
mem.ind <- grep("member", dimNames)
n.mem <- downscaleR:::getShape(grid, "member")
n.mem <- getShape(grid, "member")
co <- expand.grid(grid$xyCoords$y, grid$xyCoords$x)[2:1]
le <- nrow(co)
aux <- vapply(1:n.mem, FUN.VALUE = numeric(le), FUN = function(x) {
Expand Down Expand Up @@ -171,8 +171,8 @@ plotClimatology <- function(grid, backdrop.theme = "none", ...) {
## Backdrop theme ---------------------
if (bt != "none") {
uri <- switch(bt,
"coastline" = system.file("coastline.rda", package = "downscaleR"),
"countries" = system.file("countries.rda", package = "downscaleR"))
"coastline" = system.file("coastline.rda", package = "transformeR"),
"countries" = system.file("countries.rda", package = "transformeR"))
load(uri)
if (is.null(arg.list[["sp.layout"]])) {
arg.list[["sp.layout"]] <- list(l1)
Expand Down
19 changes: 19 additions & 0 deletions man/EOBS_Iberia_tas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/EOBS_Iberia_tp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/NCEP_Iberia_tas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/NCEP_Iberia_tp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/S4_Iberia_tas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/S4_Iberia_tas_fut.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/S4_Iberia_tp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/S4_Iberia_tp_fut.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/VALUE_Iberia_tas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/VALUE_Iberia_tp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/VALUE_Igueldo_tas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/VALUE_Igueldo_tp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/VALUE_tas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8b8cc37

Please sign in to comment.