Code Monkey home page Code Monkey logo

hydrogof's People

Contributors

hzambran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hydrogof's Issues

GOF error

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

Problem with condition missing

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

ggof plotting error

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

Gof error

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.

Error: 'wNSE' is not an exported object from 'namespace:hydroGOF'

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'

Weighted versions of goodness of fit measures?

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?

ggof is broken with latest xts

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") 

installing errors

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:

  1. install_github("hzambran/hydroGOF")
  2. pkgbuild::with_build_tools({
    . ellipsis::check_dots_used(action = getOption("devtools.ellipsis_action",
    . rlang::warn))
    . {
    . remotes <- lapply(repo, github_remote, ref = ref, subdir = subdir,
    . auth_token = auth_token, host = host)
    . install_remotes(remotes, auth_token = auth_token, host = host,
    . dependencies = dependencies, upgrade = upgrade, force = force,
    . quiet = quiet, build = build, build_opts = build_opts,
    . build_manual = build_manual, build_vignettes = build_vignettes,
    . repos = repos, type = type, ...)
    . }
    . }, required = FALSE)
  3. install_remotes(remotes, auth_token = auth_token, host = host,
    . dependencies = dependencies, upgrade = upgrade, force = force,
    . quiet = quiet, build = build, build_opts = build_opts, build_manual = build_manual,
    . build_vignettes = build_vignettes, repos = repos, type = type,
    . ...)
  4. tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
    . stop(remote_install_error(remotes[[i]], e))
    . })
  5. tryCatchList(expr, classes, parentenv, handlers)
  6. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  7. value[3L]

Library "hydroGOF" failed to load

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

  • installing source package ‘hydroGOF’ ...
    ** package ‘hydroGOF’ successfully unpacked and MD5 sums checked
    ** R
    ** data
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (hydroGOF)

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

Error for pbias equation

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 only works for linear models

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:
$$R^2(y, \hat{y}) = 1 - \frac{\sum (y_i - \hat{y}_i)^2}{\sum (y_i - \bar{y})^2}$$
where $y$ is the real data, $\hat{y}$ is the prediction and $\bar{y}$ is the mean of the samples.

Possible contributions for functions not implemented yet?

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.

Syntax error in `KGE.R`

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'

hydroGOF & hydroTSM no longer available through CRAN

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.

version 0.5-4 ggof vs gof Metrics

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

Problem with namespace exports

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)

Goodness of fit in rstudio

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.