You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to move to VIC image and I would like to transfer all my files which I prepared for the classical version (version 5) to NetCDF format. I am using tonic toolkit.
I have encounter couple of issues which I managed to solve but there is an issue which persists.
The issue is in grid_params function when the code try to add bare soil parameter in case it is not specify in the veg library.
My code together with the error messages is as follow; I have tried many combination but the issue still persists (such as removing the bare soil None changing it or adding or removing version_in and…). I tied to find the issue in the code it is around line 1010 to 1020 with new[:-1,yi,xi] = … The example is from stehekin basin. I just simplify the vegetation param to include only one vegetation type.
I would appreciate if you can give me some insight into why this problem remains as it remains. I hope the issue is not very stupid…
BTW, I see that apparently there is no version_in 5. I am working with version 5 and basically I want to have the classical files to be in a netcdf. I am not sure if this make lot of difference in this case.
fromtonic.models.vic.grid_paramsimportsoil, snow, veg, veg_class, Cols, Desc, calc_grid, grid_paramsn_veg_classes=11root_zones=3# Read the soil parameterssoil_dict=soil('D:/VIC_modeling/stehekin/params/vic/soil_param.txt', c=Cols(nlayers=3))
#%%# Read the snow parameterssnow_dict=snow('D:/VIC_modeling/stehekin/params/vic/snowbands.txt',
soil_dict, c=Cols(snow_bands=5))
#%%# Read the veg parameter fileveg_dict=veg('D:/VIC_modeling/stehekin/params/vic/veg_param_1.txt',
soil_dict,
vegparam_lai=True,
lai_src='FROM_VEGPARAM',
veg_classes=n_veg_classes)
#%%# Read the veg library fileveg_lib=veg_class('D:/VIC_modeling/stehekin/params/vic/veglib.txt')
#%%# Determine the grid shapetarget_grid, target_attrs=calc_grid(soil_dict['lats'], soil_dict['lons'])
#%%# Grid all the parametersgrid_dict=grid_params(soil_dict, target_grid, version_in='4.2',
veg_dict=veg_dict, veglib_dict=veg_lib, snow_dict=snow_dict,
vegparam_lai=True, lai_src='FROM_VEGPARAM',
lib_bare_idx=None)
yields
File "C:\Users\SHERVAN\Anaconda3\lib\site-packages\tonic-0.0.0.dev_67cc1a1-py3.6.egg\tonic\models\vic\grid_params.py"
new[:-1, yi, xi] = veglib_dict[lib_var][:, np.newaxis]
TypeError: tuple indices must be integers or slices, not str
Hi Jhamman,
did you manage to solve this? I am facing the same issue using the same code and for Stehekin.
I am also trying to convert other files for very large basins and I got an error as:
grid_params: line 1515, in veg
root_depth[cell, vind, :] = temp[2:tmp:2]
ValueError: could not broadcast input array from shape (2) into shape (3)
the same code as above is used. Please let me know :)
Email from Shervan:
yields
snowbands.txt
soil_param.txt
veg_param_1.txt
veglib.txt
The text was updated successfully, but these errors were encountered: