Closed DavidFeitschinger closed 2 years ago
Same here, spei function assumes the pze variable exists when parameters are provided, but it does not. In fact it is declared only inside code section matching conditional if(is.null(params))
so... there is any way to skip that issue??
Hey... sadly I did not manage to find a solution to the problem.
I came across the same problem. I contacted @sbegueria but he didn't react to my e-mail so far and as no changes to the package have been made for several years I am not sure if the package is still maintained.
In the meantime, to fix it, in R/spei.R
I just moved the lines
# Probability of monthly precipitation = 0 (pze)
pze <- sum(month==0)/length(month)
to a position before the if (is.null(params)) {...}
statement which seems to work.
Yes, that was a bug due to pie calculation located within an if loop, as @tpilz suggested. This issue has now been solved in the development version and will be consolidated in the next stable release.
Hello, when I try to run a SPI-3 with triangular kernel and coefficients in "param=" from another SPI file with the same dimensions I get the following error:
Error in qnorm(pze + (1 - pze) * pnorm(std[ff, s])) : object 'pze' not found
I am unsure how to solve this. I have attached two of the datasets I am using and a section of annotated script that should show my thought process. Maybe that will provide insights into my issue. a
Thank you for your help
Supporting files and script.zip