pyet-org / pyet

:sunflower: pyet is a Python package to estimate reference and potential evaporation.
https://pyet.readthedocs.io/
MIT License
130 stars 33 forks source link

The radiation input provided is greater than 100 MJ/m2d, which is not realistic. Please convert the radiation input to MJ/m2d #71

Closed miaozewei closed 8 months ago

miaozewei commented 9 months ago

To whom it may concern:

I've tried to invoke the pyet package to calculate ET0. I downloaded the pyet package from this github account. I tested the ZAMG exsample data (https://pyet.readthedocs.io/en/latest/examples/01_example_zamg.ipynb.html).

Unfortunately I got an error with message of "The radiation input provided is greater than 100 MJ/m2d, which is not realistic. Please convert the radiation input to MJ/m2d". The radiation is correct and less than 100 MJ/m2d. Please see my screenshot. Any suggestions will be welcome. question1.pptx

Thanks,

Zewei

raoulcollenteur commented 9 months ago

Does this also occur if you use the dev-branch of this repository?

miaozewei commented 9 months ago

Yes. My radiation (rs (surface radiation)) is much less than 100 MJ/m2d, only 3-6 MJ m-2d-1. But the error is still coming out. Thanks

miaozewei commented 9 months ago

Raoul,

Please see the example data. I downloaded a zip file from this division and pip install the zip file to my computer. Thanks very much in advance. data_16412.csv

raoulcollenteur commented 9 months ago

Can you run pyet.show_versions() and report the PyET version?

mvremec commented 9 months ago

Hi @miaozewei,

Based on your screenshot, it is not visible how you convert the radiation data from 'data_16412.csv'. Since the radiation data in 'data_16412.csv' is in J/cm²d, you need to divide it by 100 to convert it to MJ/m²d. Let me know if this works, or send the script you are using so I can double-check.

Cheers, Matevz

miaozewei commented 8 months ago

Hi Matevz:

Thanks so much for your reply. Yes, I had divide the radiation data - data_16412.strahl/100 by 100. Please see the example data and testing code. look forward to your feedback soon. data_16412.csv pyet_test.txt

Thanks again.

Zewei P.S.: Since a *.py file is not supported to upload in github, I saved my test python codes to a text file. Thanks

mvremec commented 8 months ago

Hi @miaozewei, I didn't encounter the same error as you, but I noticed an issue with the input data you're using for the pyet.pm_fao56 function.

The input's index should be of type "DatetimeIndex", as shown in the examples. I realize this detail isn't emphasized enough in the documentation. I'll consider ways to make this requirement more visible, perhaps in the documentation or the README file.

Here's the corrected code that should work:

data = pd.read_csv("data_16412.csv", index_col="time", parse_dates=True)

meteo = pd.DataFrame({"tmean":data.t, "tmax":data.tmax, "tmin":data.tmin, 
                      "rh":data.rel, "wind":data.vv, 
                      "rs":data.strahl/100}, index=data.index)
tmean, tmax, tmin, rh, wind, rs = [meteo[col] for col in meteo.columns]

lat = 47.077778*np.pi/180  # Latitude of the meteorological station, converting from degrees to radians
elevation = 367  # meters above sea-level

pet_pm = pyet.pm_fao56(tmean, wind, rs=rs, elevation=elevation, lat=lat, tmax=tmax, tmin=tmin, rh=rh)
pet_df = pyet.calculate_all(tmean, wind, rs, elevation, lat, tmax=tmax, tmin=tmin, rh=rh)

Please let me know if you still encounter the same error when using the above.

Cheers, Matevz

miaozewei commented 8 months ago

Matevz, thanks so much. It works well.

Cheers,

Zewei