Skip to content

Commit

Permalink
Several changes for successful R CMD check
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedia committed Aug 22, 2014
1 parent d4cd81c commit 90906d1
Show file tree
Hide file tree
Showing 36 changed files with 42 additions and 60 deletions.
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
Package: downscaleR
Depends:
rJava,
downscaleR.java,
maps,
R(>= 3.0.0)
Imports:
utils,
RCurl,
rJava,
abind,
fields,
MASS,
R(>= 3.0.0)
MASS
Type: Package
Title: R package for climate data analysis and downscaling
Version: 0.2-2
Date: 20-Aug-2014
Date: 22-Aug-2014
Author: Santander Meteorology Group <http://www.meteo.unican.es>
Maintainer: Joaquin Bedia <[email protected]>
BugReports: https://github.com/SantanderMetGroup/downscaleR/issues
Expand Down
9 changes: 2 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ export(getGrid)
export(getLatLonDomain)
export(getTimeDomain)
export(hurs2huss)
export(iberia_ncep_hus850)
export(iberia_ncep_psl)
export(iberia_ncep_ta850)
export(interpGridData)
export(isimip)
export(loadGridData)
export(loadMultiField)
export(loadStationData)
export(login_SMG)
export(makeAggregatedDataset)
export(makeMultifield)
export(makeMultiField)
export(makeSubset)
export(mat2Dto3Darray)
export(mslp2ps)
Expand All @@ -33,12 +30,10 @@ export(plotMeanField)
export(prinComp)
export(revArrayLatDim)
export(scanVarDimensions)
export(tasmax_forecast)
export(tasmin_forecast)
export(tdps2hurs)
export(timeBounds)
export(toDD)
export(tp_forecast)
import(maps)
import(rJava)
importFrom(MASS,fitdistr)
importFrom(RCurl,getURL)
Expand Down
3 changes: 1 addition & 2 deletions R/iberia_ncep_hus850.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#' @format A field
#' @source \url{http://www.meteo.unican.es/ecoms-udg}
#' @name iberia_ncep_hus850
#' @export
#' @seealso \code{\link{makeMultifield}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @seealso \code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @examples
#' data(iberia_ncep_hus850)
#' plotMeanField(iberia_ncep_hus850)
Expand Down
3 changes: 1 addition & 2 deletions R/iberia_ncep_psl.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#' @format A field
#' @source \url{http://www.meteo.unican.es/ecoms-udg}
#' @name iberia_ncep_psl
#' @export
#' @seealso \code{\link{makeMultifield}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @seealso \code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @examples
#' data(iberia_ncep_psl)
#' plotMeanField(iberia_ncep_psl)
Expand Down
3 changes: 1 addition & 2 deletions R/iberia_ncep_ta850.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#' @format A field
#' @source \url{http://www.meteo.unican.es/ecoms-udg}
#' @name iberia_ncep_ta850
#' @export
#' @seealso \code{\link{makeMultifield}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @seealso \code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @examples
#' data(iberia_ncep_ta850)
#' plotMeanField(iberia_ncep_ta850)
Expand Down
2 changes: 1 addition & 1 deletion R/isimip.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ isimip <- function (obs, pred, sim, pr.threshold = 1) {
if (any(grepl(obs$Variable$varName,c("pr","tp","precipitation","precip")))){
threshold<-pr.threshold
if (length(threshold)==1){
threshold<-array(dat = threshold, dim = 3)
threshold<-array(data = threshold, dim = 3)
}
# First Step: Monthly Correction
dimAux<-dimPred
Expand Down
2 changes: 1 addition & 1 deletion R/plotMeanField.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#' @description Plot the spatial mean of a gridded variable, or variables in the case of multi-fields.
#'
#' @importFrom fields image.plot
#' @import maps
#' @importFrom fields world
#'
#' @param gridData A grid dataset
#' @param multi.member Should members be plotted sepparately (TRUE), or just a plot
#' of the multi-member mean (FALSE, default)?. Ignored if the dataset has no members.
Expand Down
2 changes: 1 addition & 1 deletion R/prinComp.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
#' # We interpolate using an identical grid than the previous example:
#' multimember2 <- interpGridData(tasmin_forecast, new.grid = getGrid(multimember))
#' # Now the multimember multifield is constructed
#' mm.multifield <- mm2mm.mf(list(multimember, multimember2))
#' mm.multifield <- makeMultiField(list(multimember, multimember2))
#' pca.mm.mf <- prinComp(mm.multifield, n.eofs = 10)
#' # Now there is a "COMBINED" element at the end of the output list
#' str(pca.mm.mf)
Expand Down
3 changes: 1 addition & 2 deletions R/tasmax_forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#' @references
#' Saha, S. \emph{et al.}, 2013. The NCEP Climate Forecast System Version 2. J Clim 130925135638001. doi:10.1175/JCLI-D-12-00823.1
#' @name tasmax_forecast
#' @export
#' @seealso \code{\link{mm2mm.mf}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @seealso \code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @examples
#' data(tasmax_forecast)
#' plotMeanField(tasmax_forecast, multi.member = TRUE)
Expand Down
3 changes: 1 addition & 2 deletions R/tasmin_forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#' Saha, S. \emph{et al.}, 2013. The NCEP Climate Forecast System Version 2. J Clim 130925135638001. doi:10.1175/JCLI-D-12-00823.1

#' @name tasmin_forecast
#' @export
#' @seealso \code{\link{mm2mm.mf}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @seealso \code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @examples
#' data(tasmin_forecast)
#' plotMeanField(tasmin_forecast, multi.member = TRUE)
Expand Down
3 changes: 1 addition & 2 deletions R/tp_forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#' Saha, S. \emph{et al.}, 2013. The NCEP Climate Forecast System Version 2. J Clim 130925135638001. doi:10.1175/JCLI-D-12-00823.1

#' @name tp_forecast
#' @export
#' @seealso \code{\link{mm2mm.mf}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @seealso \code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
#' @examples
#' data(tp_forecast)
#' plotMeanField(tp_forecast, multi.member = TRUE)
Expand Down
Binary file removed data/iberia_ncep_hus850.Rda
Binary file not shown.
Binary file added data/iberia_ncep_hus850.rda
Binary file not shown.
Binary file removed data/iberia_ncep_psl.Rda
Binary file not shown.
Binary file added data/iberia_ncep_psl.rda
Binary file not shown.
Binary file removed data/iberia_ncep_ta850.Rda
Binary file not shown.
Binary file added data/iberia_ncep_ta850.rda
Binary file not shown.
Binary file removed data/tasmax_forecast.Rda
Binary file not shown.
Binary file added data/tasmax_forecast.rda
Binary file not shown.
Binary file removed data/tasmin_forecast.Rda
Binary file not shown.
Binary file added data/tasmin_forecast.rda
Binary file not shown.
Binary file removed data/tp_forecast.Rda
Binary file not shown.
Binary file added data/tp_forecast.rda
Binary file not shown.
3 changes: 1 addition & 2 deletions man/getGrid.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ S. Herrera and J. Bedia \email{[email protected]}
}
\seealso{
Other loading.grid: \code{\link{interpGridData}};
\code{\link{loadGridData}}; \code{\link{loadMultiField}};
\code{\link{plotEOF}}
\code{\link{loadGridData}}; \code{\link{loadMultiField}}
}

2 changes: 1 addition & 1 deletion man/iberia_ncep_hus850.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ data(iberia_ncep_hus850)
plotMeanField(iberia_ncep_hus850)
}
\seealso{
\code{\link{makeMultifield}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
\code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
}

2 changes: 1 addition & 1 deletion man/iberia_ncep_psl.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ data(iberia_ncep_psl)
plotMeanField(iberia_ncep_psl)
}
\seealso{
\code{\link{makeMultifield}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
\code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
}

2 changes: 1 addition & 1 deletion man/iberia_ncep_ta850.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ data(iberia_ncep_ta850)
plotMeanField(iberia_ncep_ta850)
}
\seealso{
\code{\link{makeMultifield}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
\code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
}

3 changes: 1 addition & 2 deletions man/interpGridData.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ J. Bedia \email{[email protected]} and S. Herrera
}
\seealso{
Other loading.grid: \code{\link{getGrid}};
\code{\link{loadGridData}}; \code{\link{loadMultiField}};
\code{\link{plotEOF}}
\code{\link{loadGridData}}; \code{\link{loadMultiField}}
}

2 changes: 1 addition & 1 deletion man/loadGridData.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ Other loading: \code{\link{dataInventory}};

Other loading.grid: \code{\link{getGrid}};
\code{\link{interpGridData}};
\code{\link{loadMultiField}}; \code{\link{plotEOF}}
\code{\link{loadMultiField}}
}

5 changes: 1 addition & 4 deletions man/loadMultiField.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ Other loading: \code{\link{dataInventory}};
\code{\link{makeAggregatedDataset}}

Other loading.grid: \code{\link{getGrid}};
\code{\link{interpGridData}}; \code{\link{loadGridData}};
\code{\link{plotEOF}}

Other multifield: \code{\link{plotEOF}}
\code{\link{interpGridData}}; \code{\link{loadGridData}}
}

12 changes: 6 additions & 6 deletions man/makeMultifield.Rd → man/makeMultiField.Rd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{makeMultifield}
\alias{makeMultifield}
\name{makeMultiField}
\alias{makeMultiField}
\title{Constructor of a multifield from various fields, supporting multimember fields.}
\usage{
makeMultifield(field.list)
makeMultiField(field.list)
}
\arguments{
\item{field.list}{A list containing the different input fields, either multimember or not.}
Expand Down Expand Up @@ -48,7 +48,7 @@ range(iberia_ncep_ta850$Dates$end) # start and end are identical (instantaneous)
# sea-level pressure
range(iberia_ncep_psl$Dates$start)
range(iberia_ncep_psl$Dates$end) # start and end differ in 24 h (daily mean)
mf <- makeMultifield(list(iberia_ncep_hus850, iberia_ncep_psl, iberia_ncep_ta850))
mf <- makeMultiField(list(iberia_ncep_hus850, iberia_ncep_psl, iberia_ncep_ta850))
# The new object inherits the global attributes from the first field, as it is assumed
# that all input fields come from the same data source:
attributes(mf)
Expand All @@ -61,7 +61,7 @@ plotMeanField(mf)
data(tasmax_forecast)
data(tasmin_forecast)
data(tp_forecast)
mm.mf <- makeMultifield(field.list = list(tasmax_forecast, tasmin_forecast, tp_forecast))
mm.mf <- makeMultiField(field.list = list(tasmax_forecast, tasmin_forecast, tp_forecast))
# 'plotMeanField' can just handle the multi-member mean for each variable in this case:
plotMeanField(mm.mf)
}
Expand All @@ -70,7 +70,7 @@ J. bedia \email{[email protected]}
}
\seealso{
\code{\link{loadGridData}} and \code{\link[ecomsUDG.Raccess]{loadECOMS}} for loading fields (the latter also for loading
multimember fields), \code{\link{loadMultifield}}, which directly loads a multifield. \code{\link{interpGridData}} and \code{\link{getGrid}}
multimember fields), \code{\link{loadMultiField}}, which directly loads a multifield. \code{\link{interpGridData}} and \code{\link{getGrid}}
for spatial consistency of input fields.
}

20 changes: 8 additions & 12 deletions man/plotEOF.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\alias{plotEOF}
\title{Plot an arbitrary number of EOFs}
\usage{
plotEOF(prinCompObj, var = NULL, n.eofs = NULL)
plotEOF(prinCompObj, var = NULL, member = 1, n.eofs = NULL)
}
\arguments{
\item{prinCompObj}{A PCA object as returned by \code{\link{prinComp}}}
Expand All @@ -14,31 +14,31 @@ been applied to 1 single field, this argument can be omitted.}
\item{n.eofs}{Number of EOFs to be displayed. Default to NULL, indicating that all computed EOFS
will be represented}

\item{member}{Default to NULL, indicating that the multimember mean will be represented. Otherwise,
this is an integer indicating the position of the member whose EOFs are to be displayed}
\item{member}{An integer indicating the position of the member whose EOFs are to be displayed. Default 1,
corresponding to the first member. Ignored for non multimember fields.}
}
\value{
A plot with as many panels as EOFs requested, in the original units of the variable
#
}
\description{
Plots an arbitrary number of EOFs. Useful to have a quick overview of the main spatial modes
of a field.
of a (possibly multimember) field.
}
\examples{
\dontrun{
# Winter temperature at 850 mb isobaric surface pressure level is loaded (period 1981--2010):
ncep <- file.path(find.package("downscaleR"), "datasets/reanalysis/Iberia_NCEP/Iberia_NCEP.ncml")
field <- loadGridData(ncep, var = "ta@85000", season = c(12,1,2), years = 1981:2010)
data(iberia_ncep_ta850)
# PCA analysis, retaining the PCs that explain 95\\\% of the total variance:
pca <- prinComp(field, v.exp = .95)
pca <- prinComp(iberia_ncep_ta850, v.exp = .95)
# Plot of all EOFs
plotEOF(pca)
# Plot the first 4 EOFs:
plotEOF(pca, n.eofs = 4)

# Example with PCA analysis of a multifield (multiple variables)
load geopotential heigth at 500 mb, temperature at 1000 mb and sea-level pressure
ncep <- file.path(find.package("downscaleR"), "datasets/reanalysis/Iberia_NCEP/Iberia_NCEP.ncml")
multifield <- loadMultiField(ncep, vars = c("z@50000", "ta@100000", "psl"), season = c(12,1,2), years = 1981:2010)
# PCA analysis, retaining the first 9 PCs of each variable:
pca2 <- prinComp(multifield, n.eofs = 9)
Expand All @@ -53,10 +53,6 @@ plotEOF(pca2, "psl", n.eofs = 2)
J. Bedia \email{joaquin.bedia@gmail.com}
}
\seealso{
Other loading.grid: \code{\link{getGrid}};
\code{\link{interpGridData}}; \code{\link{loadGridData}};
\code{\link{loadMultiField}}

Other multifield: \code{\link{loadMultiField}}
\code{\link{prinComp}}
}

2 changes: 1 addition & 1 deletion man/prinComp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ data(tasmin_forecast)
# We interpolate using an identical grid than the previous example:
multimember2 <- interpGridData(tasmin_forecast, new.grid = getGrid(multimember))
# Now the multimember multifield is constructed
mm.multifield <- mm2mm.mf(list(multimember, multimember2))
mm.multifield <- makeMultiField(list(multimember, multimember2))
pca.mm.mf <- prinComp(mm.multifield, n.eofs = 10)
# Now there is a "COMBINED" element at the end of the output list
str(pca.mm.mf)
Expand Down
2 changes: 1 addition & 1 deletion man/tasmax_forecast.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ plotMeanField(tasmax_forecast, multi.member = TRUE)
Saha, S. \emph{et al.}, 2013. The NCEP Climate Forecast System Version 2. J Clim 130925135638001. doi:10.1175/JCLI-D-12-00823.1
}
\seealso{
\code{\link{mm2mm.mf}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
\code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
}

2 changes: 1 addition & 1 deletion man/tasmin_forecast.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ plotMeanField(tasmin_forecast, multi.member = TRUE)
Saha, S. \emph{et al.}, 2013. The NCEP Climate Forecast System Version 2. J Clim 130925135638001. doi:10.1175/JCLI-D-12-00823.1
}
\seealso{
\code{\link{mm2mm.mf}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
\code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
}

2 changes: 1 addition & 1 deletion man/tp_forecast.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ plotMeanField(tp_forecast, multi.member = TRUE)
Saha, S. \emph{et al.}, 2013. The NCEP Climate Forecast System Version 2. J Clim 130925135638001. doi:10.1175/JCLI-D-12-00823.1
}
\seealso{
\code{\link{mm2mm.mf}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
\code{\link{makeMultiField}}, \code{\link[ecomsUDG.Raccess]{loadECOMS}}
}

0 comments on commit 90906d1

Please sign in to comment.