KMarkert / servir-vic-training

Training materials for the VIC hydrologic model setup developed for the @SERVIR program
GNU General Public License v3.0
36 stars 32 forks source link

Got "IndexError: Index exceeds dimension bounds" when running Rout_vic.py #23

Open giaMSU opened 4 years ago

giaMSU commented 4 years ago

Hi all, I meet this error when running rout_vic.py. Could you please help to fix it? Best

~/VIC_running/scripts$ python rout_vic.py ../data/input/Nyando_UHFile.csv ../data/input/gis/Nyando_gauge_fraction.tif ../data/output/runoff_2005.nc ../data/output/base_2005.nc ../data/output/rout_out.csv 20050101 20131231 False Traceback (most recent call last): File "rout_vic.py", line 287, in main() File "rout_vic.py", line 281, in main sys.argv[6],sys.argv[7],sys.argv[8]) File "rout_vic.py", line 222, in rout_vic runoff = (rovar[t1off:t2off,idx[0][i],idx[1][i]]*factor) File "netCDF4/_netCDF4.pyx", line 4408, in netCDF4._netCDF4.Variable.getitem File "netCDF4/_netCDF4.pyx", line 5350, in netCDF4._netCDF4.Variable._get IndexError: index exceeds dimension bounds

KMarkert commented 4 years ago

Hi @giaMSU you are getting this error because the output model data, grid raster, and gauge fraction files do not align. This error started happening after I updated some of the input data....I haven't had the time to fix it yet but this is the error

giaMSU commented 4 years ago

Hi Market, Thank you so much. By the way, could you instruct me on how to calculate the fraction of Land Cover in grid cells? I want to run 1km grid-cell basin, but I have a 300 m Land Cover dataset. So if I snap the LC by 1km grid cell, each cell may contain multiple LC types. Regards

Neda-d91 commented 3 years ago

Dear Kel Thank you for your time. I was wondering if you had time to solve this issue. I really need to work with this. Thank you

XiaoXiaoLeisure commented 1 year ago

I meet this error when running rout_vic.py as well. I wonder how to solve this problem. Besides, will you please add more details on how to prepare the input data? Thank you for the help!

rogerzzl commented 1 year ago

The cause of this bug is mainly in 'idx', try to convert it into a 2d array to get the index will solve it. :)