hzambran / hydrogof Goto Github PK
View Code? Open in Web Editor NEWGoodness-of-fit functions for comparison of simulated and observed hydrological time series
Home Page: https://CRAN.R-project.org/package=hydroGOF
Goodness-of-fit functions for comparison of simulated and observed hydrological time series
Home Page: https://CRAN.R-project.org/package=hydroGOF
data(EgaEnEstellaQts)
obs <- EgaEnEstellaQts
sim <- obs
ggof(sim=sim, obs=obs, cal.ini="1965-01-01")
I have written an R script that calculates all the GOF statistics for a lot of data. I'm getting this error:
Error in if (sd.obs > 0) { : missing value where TRUE/FALSE needed
I know that I have some long runs of '0' obs, not missing, but '0'
What to do? na.rm = TRUE is not the answer.
Thank you,
Tom
In (at least) this functions:
rd.default
cp.default
rsr.default
rsD.default
br2.default
pbias.default, etc
In the line when "denominator" argument is used as a condition inside an if-else, instead of
if (denominator != 0) { ...
i suggest use
if (denominator != 0 || is.na(denominator)) { ...
This can avoid issues.
Thanks for the package by the way, great tool
Hi,
My ggof code showing error for dates. May anybody help me in this regard? Here is my code and the data file are attached
flows=read.csv("E:/flow_sub1_sim2005_10.csv",header = T)
flows=data.frame(jday=mdy.date(flows$Month,flows$Day,flows$year),flows)
Simulated=flows$basinflow.1.
Observed=flows$Observed
ggof(Simulated, Observed,dates=flows$Date , main=" "
,ylab=expression(paste("Q, [m"^"3","/s]")),xlab="",ftype="seasonal",FUN=mean)
The error is here:
Error in .External.graphics(C_layout, num.rows, num.cols, mat, as.integer(num.figures), :
invalid graphics state
In addition: Warning message:
In if (is.na(match(class(dates), c("character", "factor", "Date", :
the condition has length > 1 and only the first element will be used
Hello
I received this error message when executing the gof function.
This is my code and error attached:
gof_total<-gof(time.serie.raster[,2:7672], time.serie.est[,2:7672],na.rm = TRUE)
Error in if (sd.obs > 0) { : missing value where TRUE/FALSE needed
What is the problem in the case if (sd.obs > 0) ?
My data frames are of precipitation data.
be able to start the plots in any month different from January.
I am trying to use the wNSE() function but have failed.
The version of hydroGOF is ‘0.5.5’.
Code :
library(hydroGOF)
packageVersion("hydroGOF")
##################
# Example 1: basic ideal case
obs <- 1:10
sim <- 1:10
hydroGOF::wNSE(sim, obs)
Error:
Error: 'wNSE' is not an exported object from 'namespace:hydroGOF'
Hi there,
just a suggestion/question for some enhancement of the package:
Did you consider implementing weighted versions of the goodness of fit measures?
We use hydroGOF as a backend in RMODFLOW (see rogiersbart/RMODFLOW#18) for model performance evaluation, but in groundwater modelling it is common to work with weights that are for instance based on the measurement error. Any thoughts on this? Would this be a useful extension for hydroGOF? Or do you consider this out of scope?
line 49 in br2.R file should read:
br2 <- ifelse(abs(b) <= 1, r2*abs(b), r2/abs(b))
The recent update of xts to 0.10 broke plotting of sim/obs in ggof, it works fine with xts 0.09-7. IIUC the error happens here, but I am downgrading xts for the moment.
Traceback:
Error in eval(plot.call$cex) : object 'cex' not found
8. eval(plot.call$cex)
7. eval(plot.call$cex)
6. plot.xts(x, axes = FALSE, type = "o", lwd = lwd[1], lty = lty[1],
col = col[1], pch = pch[1], cex = cex[1], cex.axis = cex.axis,
cex.lab = cex.lab, main = main, xlab = xlab, ylab = ylab,
ylim = ylim, ...)
5. plot(x, axes = FALSE, type = "o", lwd = lwd[1], lty = lty[1],
col = col[1], pch = pch[1], cex = cex[1], cex.axis = cex.axis,
cex.lab = cex.lab, main = main, xlab = xlab, ylab = ylab,
ylim = ylim, ...) at plot2.R#164
4. plot2(x = sim, y = obs, plot.type = "single", main = paste("Daily",
main, sep = " "), tick.tstep = tick.tstep, lab.tstep = lab.tstep,
lab.fmt = lab.fmt, cex = cex, cex.axis = cex.axis, cex.lab = cex.lab,
col = col, lwd = lwd, lty = lty, pch = pch, xlab = xlab, ... at ggof.R#198
3. ggof(sim = sim, obs = obs, main = main, ftype = ftype, FUN = FUN,
cex.main = cex.main, cex.axis = cex.axis, cex.lab = cex.lab,
leg.cex = leg.cex) at plot_out.R#141
2. plot_out(sim = model.best, obs = model.obs, dates = NULL, ptype = "ts",
MinMax = MinMax, ftype = ftype, FUN = FUN, verbose = TRUE,
main = main, leg.cex = leg.cex, cex.axis = cex.axis, cex.main = cex.main,
cex.lab = cex.lab, do.png = do.png, png.width = png.width, ... at plot_results.R#360
1. plot_results("~/hbvpso/imperial_chirps_basic/", do.png = TRUE,
MinMax = "max", sim = tryagain$bestrun$q, obs = as.zoo(obs_cut),
beh.thr = 0, ftype = "dm", FUN = mean, do.pairs = TRUE, legend.pos = "right",
main = "Imperial Chirps no zones", gof.name = "lnNSE")
if (!require(devtools)) install.packages("devtools")
library(devtools)
install_github("hzambran/hydroGOF")
Loading required package: devtools
Loading required package: usethis
Downloading GitHub repo hzambran/hydroGOF@HEAD
Warning message in system(cmd):
“error in running command”
Warning message in utils::untar(tarfile, ...):
“‘/bin/gtar -xf '/tmp/RtmpRN1216/filebccd7dfb59d4.tar.gz' -C '/tmp/RtmpRN1216/remotesbccd5f3b8fc2'’ returned error code 127”
Error: Failed to install 'hydroGOF' from GitHub:
error in running command
Traceback:
library(hydroGOF)
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
I wrote following program:
install.packages("hydroGOF", repos = "http://cran.r-project.org/")
library(hydroGOF)
library(PSF)
p <- psf(nottem)
a <- predict(p, n.ahead = 12)
a
install.packages("hydroGOF", repos = "http://cran.r-project.org/")
Installing package into ‘/home/vinodrao/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'http://cran.r-project.org/src/contrib/hydroGOF_0.3-10.tar.gz'
Content type 'application/x-gzip' length 545075 bytes (532 KB)
==================================================
downloaded 532 KB
The downloaded source packages are in
‘/tmp/RtmpxILLDO/downloaded_packages’
library(hydroGOF)
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
library(PSF)
Error in library(PSF) : there is no package called ‘PSF’p <- psf(nottem)
Error in psf(nottem) : could not find function "psf"
a <- predict(p, n.ahead = 12)
Error in predict(p, n.ahead = 12) : object 'p' not found
a
Error: object 'a' not found
According to Moriasi et al. (2007)-MODEL EVALUATION GUIDELINES FOR SYSTEMATIC QUANTIFICATION OF ACCURACY IN WATERSHED SIMULATIONS, the pbias equation needs to subtract simulated data from observed value.
Thank you
The R2 metric is implemented as the square of the pearson coefficient, this is only correct when evaluating a linear model.
When you have a non-linear model, the R2 metric will be different, and the one implemented will give incorrect results, which is what was happening to me when i used it.
The correct way of implementing the R2 metric without assuming a linear model is:
where
Hi Prof. Zambrano,
I am currently doing my PhD in Trento and I am using your library quite often, as part of my work, I am having to implement several functions not found in hydroGOF.
Would you accept a contribution? The ones I am thinking about are, MAPE, Bias Ratio, variability ratio.
I would just be happy to be listed as a contributor here, no need to add me on the citation or anything.
Let me know if this is ok with you.
Hi Mauricio,
This is the error I got when compiling from GitHub. Can you please check? Thanks!
/hydroGOF/R/KGE.R:134:53: unexpected ')'
133: if ( (mean.obs != 0) | (sigma.obs != 0) ) {
134: if ( (method=="2009") | if (method=="2012") )
^
ERROR: unable to collate and parse R files for package 'hydroGOF'
Hello Mauricio,
Recently, I have started receiving error messages when installing hydroGOF and hydroTSM from CRAN. It says they have been archived due to their dependency on maptools, which was also archived on 2023-10-16. I assume this is a known issue, but I wanted to inquire as to whether you had a tentative timeline for removing that dependency and making them available again on CRAN?
Thank you for creating these packages because they have been extremely helpful in my work.
Dear Mr. Zambrano-Bigiarini,
i recently updated to hydroGOF version 0.5-4 and realized that the KGE,NSE... results of
hydroGOF::gof hydroGOF::ggof
are not the same.
This is also true while running the example from ggof {hydroGOF}.
This wasnt the case in previous package versions.
Best
I am guessing this is an issue with the namespace exports. When running gof
with explicit call to namespace using hydroGOF::gof()
the function fails with the following error:
Error in UseMethod("gof") : no applicable method for 'gof' applied to an object of class "c('double', 'numeric')"
Here is a reproducible example:
#Get some data
sim <- runif(1:1000)
obs <- runif(1:1000)
#Using namespace call function fails
hydroGOF::gof(sim=sim,
obs=obs)
#Using library load function succeeds
library(hydroGOF)
gof(sim=sim,
obs=obs)
Data.xlsx
After arranging data i have applied the gof command as "gof=(sim=simulated, obs= observed)" and got this error.
warning messages:
1: 'rNSE' can not be computed: some elements in 'obs' are zero !
2: 'rd' can not be computed: some elements in 'obs' are zero !
I have also applied categorical statistics on this data.
And i used this command "plot(ggof(sim = sim, obs = obs,na.rm=TRUE, ylab = "Q (ft3/day)",
ftype =c("seasonal"),FUN=mean))" to draw the figures.
same issues are getting here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.