Open WieFel opened 2 weeks ago
I tried to find the issue in the source code, and came to the point that in the function calc_rad_long
https://github.com/pyet-org/pyet/blob/ff411787fbaeaa903b9966e28df41db9afb05a28/pyet/rad_utils.py#L202
the dataframe in rso
is containing a datetime index, and that is apparently causing the shape of rs / rso
to be 2x the expected shape. Both, the shapes of rs
and rso
are (5,)
.
rs
looks like this:
0 0.0
1 0.0
2 0.0
3 0.0
4 0.0
rso
looks like this:
1970-01-01 00:00:00.000000000 6.58243
1970-01-01 00:00:00.000000001 6.58243
1970-01-01 00:00:00.000000002 6.58243
1970-01-01 00:00:00.000000003 6.58243
1970-01-01 00:00:00.000000004 6.58243
However, the resulting shape of rs / rso
is (10,)
.
Changing rs / rso
to rs.values / rso.values
solves the problem. But I am asking myself if that is the desired solution!?
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: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.To Reproduce Steps to reproduce the behavior:
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)
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