Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Extreme Values in scPDSI and PDSI Calculations #5

Open
gingerlolipop opened this issue Aug 22, 2024 · 0 comments
Open

Unexpected Extreme Values in scPDSI and PDSI Calculations #5

gingerlolipop opened this issue Aug 22, 2024 · 0 comments

Comments

@gingerlolipop
Copy link

I'm encountering very high (e.g., Inf) and very low (e.g., < -2000) values in both scPDSI and conventional PDSI calculations using the scPDSI package.

Below I selected two pixels of my drought-mapping area as examples. One results in abnormal scPDSI value, and the other results in (not self calibrated) PDSI values:

# Example 1 - scPDSI values abnormal, PDSI values normal
p_vector_1 <- c(229, 181, 21, 15, 192, 84, 55, 113, 199, 521, 328, 165, 606, 40, 14, 27, 83, 106, 63, 229, 95, 432, 382, 182, 99, 234, 28, 25, 43, 73, 132, 118, 209, 213, 392, 142, 287, 127, 44, 22, 134, 125, 194, 233, 229, 305, 382, 112, 440, 157, 11, 41, 102, 33, 85, 106, 152, 626, 255, 108)
pe_vector_1 <- c(12, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 11, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 11, 12, 19, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 12, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001)

scpdsi_values_1 <- scPDSI::pdsi(P = p_vector_1, PE = pe_vector_1, AWC = 113, start = 1961, sc = TRUE)$X
pdsi_values_1 <- scPDSI::pdsi(P = p_vector_1, PE = pe_vector_1, AWC = 113, start = 1961, sc = FALSE)$X



# Example 2 - scPDSI values normal, PDSI values abnormal
p_vector_2 <- c(792, 997, 336, 207, 259, 147, 29, 248, 594, 1136, 1144, 1108, 2012, 148, 184, 342, 88, 176, 37, 386, 325, 853, 1404, 1227, 378, 1161, 386, 304, 59, 135, 91, 126, 656, 504, 1238, 1254, 899, 739, 663, 363, 179, 189, 139, 335, 756, 625, 1052, 777, 1355, 968, 154, 466, 155, 66, 63, 150, 534, 1194, 683, 922)
pe_vector_2 <- c(0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001)

scpdsi_values_2 <- scPDSI::pdsi(P = p_vector_2, PE = pe_vector_2, AWC = 113, start = 1961, sc = TRUE)$X
pdsi_values_2 <- scPDSI::pdsi(P = p_vector_2, PE = pe_vector_2, AWC = 113, start = 1961, sc = FALSE)$X

The p vectors are precipitation (mm), and the pe vectors are evapotranspiration (mm). I replaced 0 values as 0.0001. Could you please advise on whether this is expected or if there might be a bug in the package? Any guidance on handling such cases would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant