Skip to content

Commit

Permalink
Doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedia committed Dec 13, 2017
1 parent 7d6a8cf commit 3f1fd44
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 23 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Suggests:
visualizeR
Type: Package
Title: An R package for climate data manipulation and transformation
Version: 1.1.2
Date: 2017-11-23
Version: 1.2.0
Date: 2017-12-13
Authors@R: as.person(c(
"Santander Meteorology Group <http://meteo.unican.es> [cph]",
"Jorge Bano Medina <[email protected]> [ctb]",
Expand Down
14 changes: 11 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
transformeR 1.1.2
transformeR 1.2.0
=================

* New helper functions (mainly for downscaling):
* `convert2bin`, for binary grid calculation based on user-defined thresholds
* `dataSplit`, for dataset folding along time dimension
* `filterNA`, for missing value removal
* Changed the variable naming convention when multigrids are created. Now the vertical level (when defined) is appended to the name of the variable, following the definition `"var@@level"`.

Other minor bug fixes and changes:

* Bug fix in `subsetSeason` (exit with message when attempting to aggregate already annual grids)
* Bug fix in `makeMultigrid` attribute retrieval from input grids
* Changed the variable naming convention when multigrids are created. Now the vertical level (when defined) is appended to the name of the variable, following the definition `"var@@level"`.
* Other minor documentation updates
* Renamed precipitation dataset suffixes (tp --> pr)
* Several documentation updates



Expand Down
3 changes: 2 additions & 1 deletion R/convert2bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#' @author J. Bano-Medina
#' @importFrom stats quantile
#' @export
#' @family downscaling.helpers
#' @examples
#' # Take a look at the data:
#' head(VALUE_Iberia_pr$Data)
Expand Down Expand Up @@ -62,4 +63,4 @@ convert2bin. <- function(x,threshold, partial) {
x[x < threshold] <- 0}
else {
x[x < threshold] <- 0}
return(x)}
return(x)}
2 changes: 1 addition & 1 deletion R/dataSplit.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' third and fourth would be the train set.
#' @param scale A logical value. Indicates if the data should be estandardized (i.e., 0 mean and 1 standard deviation).
#' @return A list containing the grids x and y splitted.
#'
#' @family downscaling.helpers
#' @author J. Bano-Medina
#' @export
#' @examples
Expand Down
25 changes: 14 additions & 11 deletions R/filterNA.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
#' @return A new grid object without missing values
#' @details The function also takes care of adjusting dates and other relevant metadata (via the internal \code{\link{subsetDimension}}).
#'
#' @importFrom magrittr %>%
#' @author J. Bano-Medina
#' @importFrom magrittr %>% extract2
#' @author J. Bano-Medina, J. Bedia
#' @family downscaling.helpers
#' @export
#' @examples
#' # Check if the dataset contains missing values (YES):
Expand All @@ -34,12 +35,14 @@
#' getShape(na.filtered)

filterNA <- function(grid) {
if (!anyNA(grid$Data)) {
message("NOTE: No missing values were found in the input grid")}
else {
time.ind <- grep("time", getDim(grid))
na.index <- which(!is.finite(grid$Data), arr.ind = TRUE) %>% as.data.frame() %>% extract2(time.ind) %>% unique()
na.index <- setdiff(1:getShape(grid, "time"), na.index)
grid <- subsetDimension(grid, dimension = "time", indices = na.index)
attr(grid$Variable, "subset") <- "filterNA"}
return(grid)}
if (!anyNA(grid$Data)) {
message("NOTE: No missing values were found in the input grid")
} else {
time.ind <- grep("time", getDim(grid))
na.index <- which(!is.finite(grid$Data), arr.ind = TRUE) %>% as.data.frame() %>% extract2(time.ind) %>% unique()
na.index <- setdiff(1:getShape(grid, "time"), na.index)
grid <- subsetDimension(grid, dimension = "time", indices = na.index)
attr(grid$Variable, "subset") <- "filterNA"
}
return(grid)
}
4 changes: 1 addition & 3 deletions R/makeMultiGrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.




#' @title Multigrid constructor
#' @description Constructs a (possibly multimember) multigrid from different (multimember) grids.
#' A multigrid can be considered as a \dQuote{stack} of grids with similar spatiotemporal extents,
Expand Down Expand Up @@ -62,6 +59,7 @@
#' multimember grids should be interpolated individually prior to multigrid construction.
#' @export
#' @importFrom abind abind
#' @family downscaling.helpers
#' @author J. bedia
#' @seealso \code{\link{interpGrid}} for spatial consistency of input grids.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/plotClimatology.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#' \code{\link{map.lines}}, to add lines and polygons to climatological maps
#' Also see \code{\link[sp]{spplot}} in package \pkg{sp} for further information on plotting capabilities and options
#' @examples
# data("CFS_Iberia_tas")
#' data("CFS_Iberia_tas")
# # Climatology is computed:
# clim <- climatology(CFS_Iberia_tas, by.member = TRUE)
# plotClimatology(clim)
Expand Down
4 changes: 4 additions & 0 deletions man/convert2bin.Rd

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

4 changes: 4 additions & 0 deletions man/dataSplit.Rd

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

6 changes: 5 additions & 1 deletion man/filterNA.Rd

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

3 changes: 3 additions & 0 deletions man/makeMultiGrid.Rd

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

3 changes: 3 additions & 0 deletions man/plotClimatology.Rd

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

0 comments on commit 3f1fd44

Please sign in to comment.