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

Penman function not working #75

Open
Lucy84 opened this issue Apr 22, 2024 · 3 comments
Open

Penman function not working #75

Lucy84 opened this issue Apr 22, 2024 · 3 comments

Comments

@Lucy84
Copy link

Lucy84 commented Apr 22, 2024

I have a set of data to calculate PET. The Hargreaves function has worked perfectly but the Penman keeps giving "Error in Tmean[2, , ] : subscript out of bounds". Tmean isn't requested in the documentation, I include Tmax and Tmin as stated. Running a value for Tmean included just gives the same error.

My data is as follows for one month:
U2 1.7 m/s (average)
Ra 2.23 MJ/day (average)
RH 89.65% (average)
lat 52.76624
Tmax 14.3 (degrees C)
Tmin 6.9 (degrees C)
z 59 (mASL)

Here is the code that I put in R

penman<-penman(Tmin, Tmax, U2, Ra, lat, RH, z = 59, crop='short', na.rm = TRUE)
View(penman)

I've had to state the z value in the code because for some reason calling it from a datafile kept giving an error. The rest of the variables are stated values in R studio.

Any help appreciated.

Reproducible code:

U2 <- 1.7 #m/s (average)
Pre <- 43.2 #mm (total)
Ra <- 2.23 #MJ/day (average)
RH <- 89.65 #% (average)
lat <- 52.76624
Tmax <- 14.3 #(degrees C)
Tmin <- 6.9 #(degrees C)


penman<-penman(Tmin, Tmax, U2, Ra, lat, RH, z = 59, crop='short', na.rm = TRUE)
@Lucy84
Copy link
Author

Lucy84 commented Apr 23, 2024

This has now been solved over on Stack Overflow. You must have a dataset with at least three values for each variable to use in the algorithm. I had been trying to get it to work on data from one month, incorrectly thinking that less data was better but in fact if I'd just run the algorithm with three months' data then it would have worked. An update in the instructions would be very helpful @sbegueria

@Lucy84 Lucy84 closed this as completed Apr 23, 2024
@jassler
Copy link

jassler commented Apr 24, 2024

I'd keep this issue open, as it's not at all clear from the documentation or error message that there is a minimum number of values required. Given that the penman function contains a large flock of parameter checks, this might have been an oversight :)

@Lucy84 Lucy84 reopened this Apr 24, 2024
@Lucy84
Copy link
Author

Lucy84 commented Apr 24, 2024

Thanks, I've reopened it and will close it when the documentation is improved.

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

2 participants