Skip to content

PyET not checking the similarity of indices causing failure #81

@WieFel

Description

@WieFel

Describe the bug
Hi, I am trying to use the pm_fao56 function to calculate the PET, but I am always getting the following error:

...
Cell In[41], [line 13](vscode-notebook-cell:?execution_count=41&line=13)
     [10] lat = 48.32829 * np.pi / 180  # Latitude of the meteorological station, converting from degrees to radians
     [11] elevation = 180  # meters above sea-level
---> [13] pet_df = pyet.pm_fao56(tmean, wind, rs=rs, elevation=elevation, lat=lat, rh=rh)
     [14] return pet_df

File .venv/lib/python3.11/site-packages/pyet/combination.py:626, in pm_fao56(tmean, wind, rs, rn, g, tmax, tmin, rhmax, rhmin, rh, pressure, elevation, lat, n, nn, rso, a, b, ea, albedo, kab, as1, bs1, clip_zero)
    [622] pressure, gamma, dlt, lambd, ea, es = _lambda_gamma_dlt_ea_es(
    [623]     elevation, pressure, tmean, tmax, tmin, rhmax, rhmin, rh, ea
    [624] )
    [625] gamma1 = gamma * (1 + 0.34 * wind)
--> [626] rn = calc_rad_net(
    [627]     tmean,
    [628]     rn,
    [629]     rs,
    [630]     lat,
    [631]     n,
    [632]     nn,
    [633]     tmax,
...
File .venv/lib/python3.11/site-packages/pandas/core/roperator.py:15, in rsub(left, right)
     [14] def rsub(left, right):
---> [15]     return right - left

ValueError: operands could not be broadcast together with shapes (5,) (10,)

Additionally, I am always seeing the following warning. I am not passing any timestamp into the pm_fao56 function. So I wonder where this warning can come from.

pyrealm/rad_utils.py:210: RuntimeWarning: '<' not supported between instances of 'Timestamp' and 'int', sort order is undefined for incomparable objects.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following code:
import pyet

meteo = pd.DataFrame({'tmean': [27.1 , 27.16, 27.22, 27.28, 27.34], 'rh': [42. , 41.6, 41.2, 40.8, 40.4], 'wind': [1.876, 1.876, 1.876, 1.876, 1.876], 'rs': [ 8.52768 , 10.062144, 11.596608, 13.131072, 14.665536]})
print(meteo)
tmean, rh, wind, rs = [meteo[col] for col in meteo.columns]

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

pet_df = pyet.pm_fao56(tmean, wind, rs=rs, elevation=elevation, lat=lat, rh=rh)

where the meteo dataframe looks like this:

   tmean    rh   wind         rs
0  27.10  42.0  1.876   8.527680
1  27.16  41.6  1.876  10.062144
2  27.22  41.2  1.876  11.596608
3  27.28  40.8  1.876  13.131072
4  27.34  40.4  1.876  14.665536
  1. See the error output

Expected behavior
The calculation should be executed without an error.

Additional context
Using Python 3.11.6 and pyet version 1.3.1

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions