Skip to content

Commit

Permalink
bug fixed about 0 member nc files
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuanchao-Xu committed Jan 10, 2016
1 parent 1edf1df commit a9f7088
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
36 changes: 18 additions & 18 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
sameVersion <- version12 == version_local12
if (any(sameVersion == FALSE)) {
# generate message
version_msg <- strsplit(strsplit(page[versionLine], split = '<p>')[[1]][2], split = '</p>')[[1]]
infoLine_start <- versionLine + 2
infoLine_end <- grep('<p>For historical releases and the introduction of updates about each version', page) - 1
info_msg <- character()
for (infoLine in infoLine_start:infoLine_end) {
info_line <- strsplit(strsplit(page[infoLine], split = '>')[[1]][2], split = '<')[[1]][1]
if (!is.na(info_line)) info_msg <- c(info_msg, info_line)
}
install_msg <- 'You can update by type in: devtools::install_gihub("Yuanchao-Xu/hyfo")'
message_out <- paste(version_msg, paste(info_msg, collapse = '\n'), install_msg, sep = '\n')
} else message_out <- NULL
return(message_out)
}
.onAttach <- function(libname, pkgname) {
message_out <- suppressWarnings(try(hyfoUpdates(), silent = TRUE))
if (!is.null(message_out)) {
if (grepl('Version', message_out)) {
packageStartupMessage(message_out)
Expand Down Expand Up @@ -510,3 +492,21 @@ any((a$Data - b$Data > 0.0001) == T)
any((a$Data - b$Data > 0.0000001) == T)
devtools::build()
devtools::check()
devtools::build()
library(hyfo)
?biasCorrect
filePath <- system.file("extdata", "tnc.nc", package = "hyfo")
varname <- getNcdfVar(filePath)
nc <- loadNcdf(filePath, varname)
data(tgridData)
newFrc <- biasCorrect(nc, tgridData, tgridData)
newFrc <- biasCorrect(tgridData, tgridData, tgridData)
debug(biasCorrect)
newFrc <- biasCorrect(tgridData, tgridData, tgridData)
undebug(biasCorrect)
debug(biasCorrect.list)
devtools::check()
debug(biasCorrect.list)
newFrc <- biasCorrect(tgridData, tgridData, tgridData)
memberIndex
devtools::check()
6 changes: 3 additions & 3 deletions .Rproj.user/D53FD3E6/sdb/per/t/166D8D14

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .Rproj.user/D53FD3E6/sdb/per/t/222F1822
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"contents" : "hyfo 1.3.6\n==========\nDate: 2015.12.15\n\n- transfer from ncdf to ncdf4\n- grepAndMatch created, for capturing dimension names.\n- minor bug fixed about the loadNcdf, when no dimension found, it will give an error indicating.\n- change most of the match function into grepAndMatch, in order to deal with different dimension names.\n- add name attributes to gridfile$xyCoords$x,y, when writeNcdf, the dim names will be taken from that attribute, which can be exactly the same with the original. \n\nNOTE:\n----\n- for hyfo$Data part, when load and write using ncdf4, there will be very little differences compared to the original, which cannot be addressed. If you first load an ncdf file, then write it, then load it again. The data part may have very little difference, less than 10E-5.\n\n\n\nhyfo 1.3.5\n==========\nDate: 2015.12.6\n\n- travis check passed, change the rgdal version from 0.9-3 back to 0.8-16 due to the lack of packages on travis ubuntu.\n- changed .yml file to fix the problem with No repository set, so cyclic dependency check skipped.\n- on CRAN\n- fully supported for windows, Linux and OS.\n\n\n\nhyfo 1.3.3\n==========\nDate: 2015.11.27\n\n- Delete readData_folder, since it's only windows based, add information to get special version for windows users.\n- travis test added.\n\n\nhyfo 1.3.2\n==========\nDate: 2015.11.7\n\n- bug fixed about getPreciBar, signature('data.frame')\n- vignettes updated about bug and hided the warning information.\n- Add how to debug in the documentation for the generic functions.\n\n\n\nhyfo 1.3.1\n==========\nDate: 2015.11.3\n\n- new generic function biasCorrect, extractPeriod, resample, getAnnual, getPreciBar added. No need to designate input type any more, R will detect automatically.\n- coordinates conversion function extracted.\n- new user manual about real time bias correction and resample added.\n\n\n\nhyfo 1.2.9\n==========\nDate: 2015.10.30\n\n- new biasFactor S4 class added, to avoid set the input type every time.\n- operational bias correction has been changed to generic function.\n- news file added.\n\n\n\nhyfo 1.2.8\n==========\nDate: 2015.10.10\n\n- operational bias correction added, in normal function.",
"contents" : "hyfo 1.3.6\n==========\nDate: 2015.12.15\n\n- transfer from ncdf to ncdf4\n- grepAndMatch created, for capturing dimension names.\n- minor bug fixed about the loadNcdf, when no dimension found, it will give an error indicating.\n- change most of the match function into grepAndMatch, in order to deal with different dimension names.\n- add name attributes to gridfile$xyCoords$x,y, when writeNcdf, the dim names will be taken from that attribute, which can be exactly the same with the original. \n- bug fixed for nc files without members.\n\nNOTE:\n----\n- for hyfo$Data part, when load and write using ncdf4, there will be very little differences compared to the original, which cannot be addressed. If you first load an ncdf file, then write it, then load it again. The data part may have very little difference, less than 10E-5.\n\n\n\nhyfo 1.3.5\n==========\nDate: 2015.12.6\n\n- travis check passed, change the rgdal version from 0.9-3 back to 0.8-16 due to the lack of packages on travis ubuntu.\n- changed .yml file to fix the problem with No repository set, so cyclic dependency check skipped.\n- on CRAN\n- fully supported for windows, Linux and OS.\n\n\n\nhyfo 1.3.3\n==========\nDate: 2015.11.27\n\n- Delete readData_folder, since it's only windows based, add information to get special version for windows users.\n- travis test added.\n\n\nhyfo 1.3.2\n==========\nDate: 2015.11.7\n\n- bug fixed about getPreciBar, signature('data.frame')\n- vignettes updated about bug and hided the warning information.\n- Add how to debug in the documentation for the generic functions.\n\n\n\nhyfo 1.3.1\n==========\nDate: 2015.11.3\n\n- new generic function biasCorrect, extractPeriod, resample, getAnnual, getPreciBar added. No need to designate input type any more, R will detect automatically.\n- coordinates conversion function extracted.\n- new user manual about real time bias correction and resample added.\n\n\n\nhyfo 1.2.9\n==========\nDate: 2015.10.30\n\n- new biasFactor S4 class added, to avoid set the input type every time.\n- operational bias correction has been changed to generic function.\n- news file added.\n\n\n\nhyfo 1.2.8\n==========\nDate: 2015.10.10\n\n- operational bias correction added, in normal function.",
"created" : 1446423165783.000,
"dirty" : false,
"encoding" : "ASCII",
"folds" : "",
"hash" : "477136685",
"hash" : "4159313557",
"id" : "222F1822",
"lastKnownWriteTime" : 1450178913,
"lastKnownWriteTime" : 1452416339,
"path" : "E:/1/R/hyfo/NEWS",
"project_path" : "NEWS",
"properties" : {
Expand Down
2 changes: 1 addition & 1 deletion .Rproj.user/D53FD3E6/sdb/per/t/9CDBC212
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"folds" : "",
"hash" : "547348008",
"id" : "9CDBC212",
"lastKnownWriteTime" : 1450178919,
"lastKnownWriteTime" : 1452416343,
"path" : "E:/1/R/hyfo/NAMESPACE",
"project_path" : "NAMESPACE",
"properties" : {
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Date: 2015.12.15
- minor bug fixed about the loadNcdf, when no dimension found, it will give an error indicating.
- change most of the match function into grepAndMatch, in order to deal with different dimension names.
- add name attributes to gridfile$xyCoords$x,y, when writeNcdf, the dim names will be taken from that attribute, which can be exactly the same with the original.
- bug fixed for nc files without members.

NOTE:
----
Expand Down
2 changes: 1 addition & 1 deletion R/biasCorrect(generic).R
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ biasCorrect.list <- function(frc, hindcast, obs, method, scaleType, preci, prThr
memberIndex <- grepAndMatch('member', attributes(frcData)$dimensions)

# For dataset that has a member part
if (!is.na(memberIndex)) {
if (length(memberIndex) != 0) {
# check if frcData and hindcastData has the same dimension and length.
checkDimLength(frcData, hindcastData, dim = 'member')

Expand Down

0 comments on commit a9f7088

Please sign in to comment.