pyet-org/pyet

Hargreaves method is not calculating for some days in winter

Closed this issue · 4 comments

Dear

I have tried the Hargreaves method to calculate the PET in some places in Chile, but in winter days (June, July and August) it gives me missing values and the following message:

"RuntimeWarning: invalid value encountered in sqrt result_data = func(*input_data)"

I have tried the "clip_zero" option and manually change negative values. However there is no change. With Oudin's method I don't have this problem.

What could be the problem?

Thanks for your time

Hi Francisco,
Thank you for posting this issue!
The issue arises for extreme latitudes (lat>75°) in summer/winter months when internally computing extraterrestrial radiation.
The issue should be fixed in the developer branch.
You can install the developer branch by cloning the repository and installing it with pip install -e .
, or you can wait until we merge it with the main branch (which will happen in the next few days).

Let me know if the error still persists.
Thank's again, and good luck with your work!

Hi!
I followed the steps but now I don't get any results with the Hargreaves method. I ran the routines found in the "test" folder and I got the following results:

test_calculate_all (test_all.Testall) ... ok
test_abtew (test_rpackage.Testr) ... ok
test_asce_pm (test_rpackage.Testr) ... ok
test_blaney_criddle (test_rpackage.Testr) ... ok
test_fao56 (test_rpackage.Testr) ... ok
test_hamon (test_rpackage.Testr) ... ok
test_hargreaves (test_rpackage.Testr) ... ok
test_jensen_haise (test_rpackage.Testr) ... ok
test_linacre (test_rpackage.Testr) ... ok
test_makkink (test_rpackage.Testr) ... ok
test_makkink_knmi (test_rpackage.Testr) ... ok
test_mcguinnessbordne (test_rpackage.Testr) ... ok
test_penman (test_rpackage.Testr) ... ok
test_pm (test_rpackage.Testr) ... ok
test_pt (test_rpackage.Testr) ... ok
test_romanenko (test_rpackage.Testr) ... ok
test_turc (test_rpackage.Testr) ... ok
test_blaney_criddle (testalternative.Testalternative) ... ok
test_blaney_criddle1 (testalternative.Testalternative) ... ok
test_hargreaves (testalternative.Testalternative) ... ok
test_hargreaves_samani (testalternative.Testalternative) ... ok
test_haude (testalternative.Testalternative) ... ok
test_makkink (testalternative.Testalternative) ... ok
test_makkink_knmi (testalternative.Testalternative) ... ok
test_priestley_taylor (testalternative.Testalternative) ... ok
test_turc (testalternative.Testalternative) ... ok
test_day_of_year (testfao56.TestFAO56) ... ok
test_daylight_hours (testfao56.TestFAO56) ... ok
test_e0_calc (testfao56.TestFAO56) ... ok
test_ea_calc (testfao56.TestFAO56) ... ok
test_es_calc (testfao56.TestFAO56) ... ok
test_et_fao56 (testfao56.TestFAO56) ... ok
test_extraterrestrial_r (testfao56.TestFAO56) ... ERROR
test_press_calc (testfao56.TestFAO56) ... ok
test_psy_calc (testfao56.TestFAO56) ... ok
test_relative_distance (testfao56.TestFAO56) ... ok
test_solar_declination (testfao56.TestFAO56) ... ok
test_sunset_angle (testfao56.TestFAO56) ... ERROR
test_vpc (testfao56.TestFAO56) ... ok
test_calc_rad_sol_in (testmeteo.Testmeteo) ... ok

======================================================================
ERROR: test_extraterrestrial_r (testfao56.TestFAO56)

Traceback (most recent call last):
File ".../pyet/tests/testfao56.py", line 90, in test_extraterrestrial_r
self.assertAlmostEqual(float(extrar), 32.2, 1)
TypeError: float() argument must be a string or a number, not 'Float64Index'

======================================================================
ERROR: test_sunset_angle (testfao56.TestFAO56)

Traceback (most recent call last):
File ".../pyet/tests/testfao56.py", line 73, in test_sunset_angle
sangle = et.sunset_angle(0.12, -0.35)
TypeError: sunset_angle() missing 1 required positional argument: 'tindex'


Ran 40 tests in 0.201s

FAILED (errors=2)

Hi Francisco,

Thank you for bringing up this issue, and I apologize for my delayed response. I was caught up with other work, including the finalization of my PhD =).

I have updated the code, so all methods should also work for latitudes above 75 degrees.
The pip install -e . should also work now.

If you have a chance to give it a try, please let me know how it goes.

Best,
Matevz

Dear

thank you for your time and effort, it works now!

However, it took me a while to verify its operation because now the function does not accept a one-dimensional array in the 'lat' parameter, now it works with a two-dimensional array.