Dear developers,
In the hydro function, I experience the exeption "index 0 is out of bounds..." in hydro.py#34 as some of the plants that I am passing to the hydro function are outside the region delimited by the hydrobasins.
Description
The issue should arise for any problem concerning hydro.py, assuming to give a point in plants outside the region delimited by hydrobasins.
Expected Behavior
I think it would be useful to avoid this issue and simply put a 0.0 for such cases.
Actual Behavior
Currently, instead, the algorithm stops and the exception is thrown
Error Message
File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\atlite\convert.py", line 596, in hydro
basins = hydrom.determine_basins(plants, hydrobasins, show_progress=show_progress)
File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\atlite\hydro.py", line 75, in determine_basins
hid = find_basin(shapes, p.lon, p.lat)
File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\atlite\hydro.py", line 34, in find_basin
return hids[0]
File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\pandas\core\indexes\base.py", line 4604, in getitem
return getitem(key)
IndexError: index 0 is out of bounds for axis 0 with size 0
Your Environment
The atlite version used: 0.2.5
How you installed atlite (conda, pip or github): conda
Dear developers, In the hydro function, I experience the exeption "index 0 is out of bounds..." in hydro.py#34 as some of the plants that I am passing to the hydro function are outside the region delimited by the hydrobasins.
Description
The issue should arise for any problem concerning hydro.py, assuming to give a point in plants outside the region delimited by hydrobasins.
Expected Behavior
I think it would be useful to avoid this issue and simply put a 0.0 for such cases.
Actual Behavior
Currently, instead, the algorithm stops and the exception is thrown
Error Message
File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\atlite\convert.py", line 596, in hydro basins = hydrom.determine_basins(plants, hydrobasins, show_progress=show_progress) File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\atlite\hydro.py", line 75, in determine_basins hid = find_basin(shapes, p.lon, p.lat) File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\atlite\hydro.py", line 34, in find_basin return hids[0] File "C:\ProgramData\Miniconda3\envs\toast\lib\site-packages\pandas\core\indexes\base.py", line 4604, in getitem return getitem(key) IndexError: index 0 is out of bounds for axis 0 with size 0
Your Environment
atlite
version used: 0.2.5atlite
(conda
,pip
orgithub
): conda