UW-Hydro / RVIC

RVIC Streamflow Routing Model
http://rvic.readthedocs.org
GNU General Public License v3.0
34 stars 58 forks source link

Errors when running rvic #97

Open pyested opened 7 years ago

pyested commented 7 years ago

I get some error messages when executing rvic parameters with the RASM sample dataset, but the code is able to generate a final parameter file in netcdf format. Although, when using this parameter file for executing rvic convolution I get more errors. Here are the lines with the error messages when generating RVIC parameters:

ERROR:write>> /usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/rvic/core/param_file.py:331: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
ERROR:write>>   dtype=np.float64)
ERROR:write>> /usr/lib/python2.7/dist-packages/numpy/ma/core.py:3114: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
ERROR:write>>   dout = self.data[indx]
ERROR:write>> /usr/lib/python2.7/dist-packages/numpy/ma/core.py:3169: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
ERROR:write>>   dout._mask = _mask[indx]
INFO:subset>> Done subsetting
DEBUG:finish_params>> plotting unit hydrograph timeseries now for before / after subseting
INFO:finish_params>> UHS before subset Plot:  ../cases/sample_rasm_parameters/plots/uhs_before_subset_sample_rasm_parameters_20170511.png
INFO:finish_params>> UHS after subset Plot:  ../cases/sample_rasm_parameters/plots/uhs_after_subset_sample_rasm_parameters_20170511.png
INFO:finish_params>> Adjusting Fractions to be less than or equal to domain fractions
INFO:adjust_fractions>> Adjusting fractions now
INFO:adjust_fractions>> Adjust fractions for 0 grid cells
DEBUG:group>> n_outlets: 5
DEBUG:group>> n_sources: 10
DEBUG:group>> subset_length: 10.0
ERROR:write>> /usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/rvic/core/param_file.py:405: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
ERROR:write>>   dtype=np.float64)

I attach the file with the whole log: run_rvic_parameters.txt

On the other hand, the error messages that appear when running rvic convolution are shown below:

ERROR:write>> Traceback (most recent call last):
ERROR:write>>   File "/usr/local/bin/rvic", line 4, in <module>
ERROR:write>> __import__('pkg_resources').run_script('rvic==1.1.1', 'rvic')
ERROR:write>>   File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
ERROR:write>> self.require(requires)[0].run_script(script_name, ns)
ERROR:write>>   File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1504, in run_script
ERROR:write>> exec(code, namespace, namespace)
ERROR:write>>   File "/usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/rvic", line 61, in <module>
ERROR:write>> main()
ERROR:write>>   File "/usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/rvic", line 50, in main
ERROR:write>> convolution(args.config_file)
ERROR:write>>   File "/usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/rvic/convolution.py", line 54, in convolution
ERROR:write>> time_handle, directories)
ERROR:write>>   File "/usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/rvic/convolution.py", line 350, in convolution_run
ERROR:write>> history_restart_files)
ERROR:write>>   File "/usr/local/lib/python2.7/dist-packages/rvic-1.1.1-py2.7-linux-x86_64.egg/rvic/core/variables.py", line 427, in write_restart
ERROR:write>> setattr(timemgr_rst_step_sec, key, val)
ERROR:write>>   File "netCDF4/_netCDF4.pyx", line 3702, in netCDF4._netCDF4.Variable.__setattr__ (netCDF4/_netCDF4.c:37094)
ERROR:write>> ValueError
ERROR:write>> :
ERROR:write>> invalid literal for float(): 0, 86400

And this is the log file for the convolution: run_rvic_convolution.txt

I am trying to find the solution on internet, but it seems that there is nobody with the same problem. I will really appreciate it if you give me some help. I also attach the paramater and convolution configuration files:

rvic.parameters.rasm.txt

rvic.convolution.rasm.txt

Thanks!!

solomonsg commented 5 years ago

Hi,

did you solve this? I am also getting the same error ERROR:write>> dtype=np.float64) ERROR:write>> TypeError ERROR:write>> : ERROR:write>> 'float' object cannot be interpreted as an integer

corviday commented 5 years ago

A solution for the invalid literal for float(): 0, 86400 error is described in #96 by @frezersa. I made those changes and it fixed the error for me; perhaps it will help you as well.

pyested commented 5 years ago

We are currently working in an application of the VIC model without post-processing the runoff outputs with a routing scheme, so we have overcome this problem for the time being. However, we are planning to use a routing scheme at some point, and a little research reveals that there are some interesting alternatives besides RVIC:

solomonsg commented 5 years ago

Hi corviday,

thanks for the reply! but the error is when running the parameters. if the solution in #96 helps it didn't help when running rvic.parameters.

DEBUG:subset>> Subset Length: 10.0 DEBUG:subset>> full_time_length: 50 ERROR:write>> Traceback (most recent call last): ERROR:write>> File "/home/shg1f19/.conda/envs/solenv/bin/rvic", line 61, in ERROR:write>> main() ERROR:write>> File "/home/shg1f19/.conda/envs/solenv/bin/rvic", line 43, in main ERROR:write>> parameters(args.config_file, numofproc=args.numofproc) ERROR:write>> File "/home/shg1f19/.conda/envs/solenv/lib/python3.7/site-packages/rvic/parameters.py", line 97, in parameters ERROR:write>> gen_uh_final(outlets, dom_data, config_dict, directories) ERROR:write>> File "/home/shg1f19/.conda/envs/solenv/lib/python3.7/site-packages/rvic/parameters.py", line 604, in gen_uh_final ERROR:write>> directories) ERROR:write>> File "/home/shg1f19/.conda/envs/solenv/lib/python3.7/site-packages/rvic/core/param_file.py", line 55, in finish_params ERROR:write>> before, after = subset(outlets, subset_length=subset_length) ERROR:write>> File "/home/shg1f19/.conda/envs/solenv/lib/python3.7/site-packages/rvic/core/param_file.py", line 327, in subset ERROR:write>> dtype=np.float64) ERROR:write>> TypeError ERROR:write>> : ERROR:write>> 'float' object cannot be interpreted as an integer

Best, Solomon

navass11 commented 4 years ago

@solomonsg Could you solve this problem? I have the same problem and I cannot solve it.

adpandit27 commented 2 years ago

@solomonsg and @navass11 In Line 327 of param_file.py change out_uh = np.zeros((subset_length, outlet.unit_hydrograph.shape[1]), dtype=np.float64) with out_uh = np.zeros((int(subset_length), utlet.unit_hydrograph.shape[1]), dtype=np.float64). This is happening because subset_length=10.0 or 15.0 that is a float so just use int before subset_length. Also Change

clip and normalize

        tot = outlet.unit_hydrograph[left:right), j].sum()
        out_uh[:, j] = outlet.unit_hydrograph[left:right, j] / tot

with

clip and normalize

        tot = outlet.unit_hydrograph[int(left):int(right), j].sum()
        out_uh[:, j] = outlet.unit_hydrograph[int(left):int(right), j] / tot

You also need to change one more thing in same code nearly in line 401 Change

Source specific values

gd['unit_hydrograph'] = np.empty(subset_length, n_sources),

with # Source specific values gd['unit_hydrograph'] = np.empty((int(subset_length), n_sources), and Code will Run Fine. Thanks adpandit