Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when running rvic #97

Open
pyested opened this issue May 11, 2017 · 6 comments
Open

Errors when running rvic #97

pyested opened this issue May 11, 2017 · 6 comments

Comments

@pyested
Copy link

pyested commented May 11, 2017

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
Copy link

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
Copy link

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
Copy link
Author

pyested commented Aug 20, 2019

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:

  • You can use the previous version of VIC, VIC 4 with the routing scheme of Lohmann et al. (1996). I don't know if this routing scheme can be used with VIC 5 since the grid cell outputs files of the new version include a header that you cannot omit (in the previous version you can specify if you want the header to appear or not). The code is here, and RVIC is just a modern implementation of this routing procedure.

  • The mizuRoute routine is an interesting tool that works with the real boundaries of the subwatershed given that is not dependent on the resolution of the grid cells. This scheme has been used with VIC 4, for instance, in Melsen et al. (2019).

  • The mRM routing model is another alternative that initially was coupled to the mHM model and now can be used as a standalone application.

@solomonsg
Copy link

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
Copy link

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

@adpandit27
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants